mirror of
https://github.com/samsonjs/instapaper.git
synced 2026-03-25 08:55:49 +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 API
|
||||
# Defines methods related to accounts
|
||||
module Account
|
||||
# Returns the currently logged in user.
|
||||
def verify_credentials
|
||||
post('/api/1/account/verify_credentials')
|
||||
perform_post_with_object('/api/1/account/verify_credentials', {}, Instapaper::User)
|
||||
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
|
||||
|
||||
it 'should return the user' do
|
||||
user = client.verify_credentials.first
|
||||
expect(user).to be_a Hashie::Rash
|
||||
expect(user.username).to eq('TestUserOMGLOL')
|
||||
user = client.verify_credentials
|
||||
expect(user).to be_a Instapaper::User
|
||||
end
|
||||
end
|
||||
end
|
||||
|
|
|
|||
Loading…
Reference in a new issue