updated account implementation

This commit is contained in:
stve 2015-02-10 00:07:01 -05:00
parent 9f2f9648ac
commit ed59ddefdf
3 changed files with 11 additions and 4 deletions

View file

@ -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
View file

@ -0,0 +1,6 @@
require 'values'
module Instapaper
class User < Value.new(:type, :user_id, :username)
end
end

View file

@ -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