Class: Ingenico::Connect::SDK::ApiResource

Inherits:
Object
  • Object
show all
Defined in:
lib/ingenico/connect/sdk/api_resource.rb

Overview

Base class of all Ingenico ePayments platform API resources. Provides shared functionality to facilitate communication with the Ingenico ePayments platform.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(arg, path_context, client_meta_info = FALSE) ⇒ ApiResource

Creates a new ApiResource.

arg

Parent class or Communicator instance. If a parent class is given its communicator will be used for communication.

path_context

Hash that contains substitutions for generic locations in the url path. This hash will be used to instantiate a concrete url used to access specific resources. For example in the url api-sandbox.globalcollect.com/{version}/{merchantId}/payments {version} and {merchantId} can be instantiated using the hash {‘version’ => ‘v1’, ‘merchantId’ => ‘1234’}. The final url in this case will be api-sandbox.globalcollect.com/v1/1234/payments.

client_meta_info

JSON string containing the meta data for the client.



19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
# File 'lib/ingenico/connect/sdk/api_resource.rb', line 19

def initialize(arg, path_context, client_meta_info=FALSE)
  if client_meta_info == FALSE
    if arg.nil?
      raise ArgumentError.new('parent is required')
    end
    @parent = arg
    @communicator = arg.communicator
    @path_context = path_context
    @client_meta_info = arg.client_meta_info
  else
    if arg.nil?
      raise ArgumentError.new('communicator is required')
    end
    @parent = nil
    @communicator = arg
    @path_context = path_context
    @client_meta_info = client_meta_info
  end
end

Instance Attribute Details

#client_meta_infoObject (readonly)

JSON string containing client info specific to the current client.



43
44
45
# File 'lib/ingenico/connect/sdk/api_resource.rb', line 43

def client_meta_info
  @client_meta_info
end

#communicatorObject (readonly)

Communicator instance that provides communication with the Ingenico ePayments platform.



40
41
42
# File 'lib/ingenico/connect/sdk/api_resource.rb', line 40

def communicator
  @communicator
end