Class: PromisePay::Marketplace

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Marketplace

Returns a new instance of Marketplace.



8
9
10
11
# File 'lib/promise_pay/marketplace.rb', line 8

def initialize(options = {})
  @user     = options.fetch(:user)
  @password = options.fetch(:password)
end

Instance Attribute Details

#tokenObject (readonly)

Returns the value of attribute token.



6
7
8
# File 'lib/promise_pay/marketplace.rb', line 6

def token
  @token
end

Instance Method Details

#request_tokenObject



13
14
15
16
17
18
19
20
21
22
# File 'lib/promise_pay/marketplace.rb', line 13

def request_token
  response = PromisePay::Request.new(
    path:     api_resource,
    user:     user,
    password: password
  ).execute

  @token = JSON.parse(response)["token"]
  token
end