Class: Paymo::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/paymo.rb

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Base

Returns a new instance of Base.



35
36
37
38
39
40
# File 'lib/paymo.rb', line 35

def initialize(options = {})
  @username = options[:username]
  @password = options[:password]
  @format   = options[:format] || 'json'
  self.auth
end

Instance Method Details

#authObject



42
43
44
45
46
47
48
49
50
51
# File 'lib/paymo.rb', line 42

def auth
  response = Paymo::API.post :auth, :login, {
    format: @format,
    username: @username,
    password: @password,
    api_key: Paymo.config.api_key
  }
  # add error checking
  Paymo.config.auth_token = response['token']['_content']
end