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.



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

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

Instance Method Details

#authObject



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