Class: CloudPayments::Namespaces::Base

Inherits:
Object
  • Object
show all
Defined in:
lib/cloud_payments/namespaces/base.rb

Direct Known Subclasses

ApplePay, Cards, Kassa, Orders, Payments, Subscriptions, Tokens

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, parent_path = nil) ⇒ Base

Returns a new instance of Base.



13
14
15
16
# File 'lib/cloud_payments/namespaces/base.rb', line 13

def initialize(client, parent_path = nil)
  @client = client
  @parent_path = parent_path
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



5
6
7
# File 'lib/cloud_payments/namespaces/base.rb', line 5

def client
  @client
end

#parent_pathObject (readonly)

Returns the value of attribute parent_path.



5
6
7
# File 'lib/cloud_payments/namespaces/base.rb', line 5

def parent_path
  @parent_path
end

Class Method Details

.resource_nameObject



8
9
10
# File 'lib/cloud_payments/namespaces/base.rb', line 8

def resource_name
  self.name.split('::').last.downcase
end

Instance Method Details

#request(path, params = {}) ⇒ Object



18
19
20
21
22
# File 'lib/cloud_payments/namespaces/base.rb', line 18

def request(path, params = {})
  response = client.perform_request(resource_path(path), params)
  raise_gateway_error(response.body) unless response.body[:success]
  response.body
end