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.

Parameters:

  • arg (Ingenico::Connect::SDK::ApiResource, Ingenico::Connect::SDK::Communicator)

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

  • path_context (Hash)

    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 eu.sandbox.api-ingenico.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 eu.sandbox.api-ingenico.com/v1/1234/payments.

  • client_meta_info (String) (defaults to: false)

    JSON string containing the meta data for the client.



37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
# File 'lib/ingenico/connect/sdk/api_resource.rb', line 37

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_infoString (readonly)

JSON string containing client info specific to the current client.

Returns:

  • (String)

    the current value of client_meta_info



24
25
26
# File 'lib/ingenico/connect/sdk/api_resource.rb', line 24

def client_meta_info
  @client_meta_info
end

#communicatorIngenico::Connect::SDK::Communicator (readonly)

Communicator instance that provides communication with the Ingenico ePayments platform.

Returns:



24
25
26
# File 'lib/ingenico/connect/sdk/api_resource.rb', line 24

def communicator
  @communicator
end