Module: IpTracker::Client::Authentication
- Defined in:
- lib/ip_tracker/client/authentication.rb
Instance Attribute Summary collapse
-
#auth_token ⇒ Object
Returns the value of attribute auth_token.
-
#user ⇒ Object
readonly
Returns the value of attribute user.
Instance Method Summary collapse
Instance Attribute Details
#auth_token ⇒ Object
Returns the value of attribute auth_token.
4 5 6 |
# File 'lib/ip_tracker/client/authentication.rb', line 4 def auth_token @auth_token end |
#user ⇒ Object (readonly)
Returns the value of attribute user.
5 6 7 |
# File 'lib/ip_tracker/client/authentication.rb', line 5 def user @user end |
Instance Method Details
#login(username, password) ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/ip_tracker/client/authentication.rb', line 7 def login(username, password) response = post("#{IpTracker::USERS_PATH}/#{username}/tokens", :body => { :password => password }) raise TargetError if response.code == 200 @user = username @auth_token = response.token end |