Class: Monri::PaymentMethods

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#access_tokens=(value) ⇒ Monri::AccessTokens (writeonly)

Returns:



9
10
11
# File 'lib/monri/payment_methods.rb', line 9

def access_tokens=(value)
  @access_tokens = value
end

#configMonri::Config

Returns:



4
5
6
# File 'lib/monri/payment_methods.rb', line 4

def config
  @config
end

#http_client=(value) ⇒ Monri::HttpClient (writeonly)

Returns:



6
7
8
# File 'lib/monri/payment_methods.rb', line 6

def http_client=(value)
  @http_client = value
end

Instance Method Details

#list(options = {}) ⇒ Object

Parameters:

  • options (Hash) (defaults to: {})


12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/monri/payment_methods.rb', line 12

def list(options = {})
  access_token = @access_tokens.create!(scopes: ['payment-methods']).access_token
  response = @http_client.get('/v2/payment-methods', oauth: access_token)
  if response.success?
    response.body
  else
    # TODO: handle this case
  end

rescue StandardError => e
  # TODO: handle this case
  nil
end