Class: ZenfolioAPI::Authentication
- Inherits:
-
Object
- Object
- ZenfolioAPI::Authentication
- Defined in:
- lib/ZenfolioAPI/authentication.rb
Instance Attribute Summary collapse
-
#token ⇒ Object
Returns the value of attribute token.
Instance Method Summary collapse
-
#initialize(username, password) ⇒ Authentication
constructor
Connect to the Zenfolio API.
Constructor Details
#initialize(username, password) ⇒ Authentication
Connect to the Zenfolio API
9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/ZenfolioAPI/authentication.rb', line 9 def initialize username,password @api_url = "http://api.zenfolio.com/api/1.7/zfapi.asmx" @username = username @password = password connection = ZenfolioAPI::HTTP.new() @response = connection.POST('AuthenticatePlain', [username, password]) # Unable to authenticate the user. Return error code from server raise ZenfolioAPI::ZenfolioAPIAuthenticationError, @response['error'] if !@response['error'].nil? @token = @response['result'] end |
Instance Attribute Details
#token ⇒ Object
Returns the value of attribute token.
4 5 6 |
# File 'lib/ZenfolioAPI/authentication.rb', line 4 def token @token end |