Class: Paymo::Base
- Inherits:
-
Object
- Object
- Paymo::Base
- Defined in:
- lib/paymo.rb
Instance Method Summary collapse
- #auth ⇒ Object
-
#initialize(options = {}) ⇒ Base
constructor
A new instance of Base.
Constructor Details
#initialize(options = {}) ⇒ Base
Returns a new instance of Base.
34 35 36 37 38 39 |
# File 'lib/paymo.rb', line 34 def initialize( = {}) @username = [:username] @password = [:password] @format = [:format] || 'json' self.auth end |
Instance Method Details
#auth ⇒ Object
41 42 43 44 45 46 47 48 49 50 |
# File 'lib/paymo.rb', line 41 def auth response = Paymo::API.post :auth, :login, { format: @format, username: @username, password: @password, api_key: Paymo.api_key } # add error checking Paymo.auth_token = response['token']['_content'] end |