mirror of
https://github.com/samsonjs/instapaper.git
synced 2026-04-27 14:57:44 +00:00
updated account implementation
This commit is contained in:
parent
9f2f9648ac
commit
ed59ddefdf
3 changed files with 11 additions and 4 deletions
|
|
@ -1,10 +1,12 @@
|
||||||
|
require 'instapaper/user'
|
||||||
|
|
||||||
module Instapaper
|
module Instapaper
|
||||||
module API
|
module API
|
||||||
# Defines methods related to accounts
|
# Defines methods related to accounts
|
||||||
module Account
|
module Account
|
||||||
# Returns the currently logged in user.
|
# Returns the currently logged in user.
|
||||||
def verify_credentials
|
def verify_credentials
|
||||||
post('/api/1/account/verify_credentials')
|
perform_post_with_object('/api/1/account/verify_credentials', {}, Instapaper::User)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
6
lib/instapaper/user.rb
Normal file
6
lib/instapaper/user.rb
Normal file
|
|
@ -0,0 +1,6 @@
|
||||||
|
require 'values'
|
||||||
|
|
||||||
|
module Instapaper
|
||||||
|
class User < Value.new(:type, :user_id, :username)
|
||||||
|
end
|
||||||
|
end
|
||||||
|
|
@ -16,9 +16,8 @@ describe Instapaper::Client::Account do
|
||||||
end
|
end
|
||||||
|
|
||||||
it 'should return the user' do
|
it 'should return the user' do
|
||||||
user = client.verify_credentials.first
|
user = client.verify_credentials
|
||||||
expect(user).to be_a Hashie::Rash
|
expect(user).to be_a Instapaper::User
|
||||||
expect(user.username).to eq('TestUserOMGLOL')
|
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue