Class: Worldline::Connect::SDK::ApiResource

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

Overview

Base class of all Worldline Global Collect platform API resources. Provides shared functionality to facilitate communication with the Worldline Global Collect platform.

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(parent: nil, communicator: nil, path_context: nil, client_meta_info: nil) ⇒ ApiResource

Creates a new ApiResource.

Parameters:

  • parent (Worldline::Connect::SDK::ApiResource) (defaults to: nil)

    parent resource instance.

  • communicator (Worldline::Connect::SDK::Communicator) (defaults to: nil)

    Communicator instance.

  • path_context (Hash) (defaults to: nil)

    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.

  • client_meta_info (String) (defaults to: nil)

    JSON string containing the metadata for the client.

Raises:

  • (ArgumentError)


20
21
22
23
24
25
26
# File 'lib/worldline/connect/sdk/api_resource.rb', line 20

def initialize(parent: nil, communicator: nil, path_context: nil, client_meta_info: nil)
  raise ArgumentError.new('parent and/or communicator is required') if parent.nil? and communicator.nil?
  @parent = parent
  @communicator = communicator.nil? ? parent.communicator : communicator
  @path_context = path_context
  @client_meta_info = client_meta_info || parent.nil? ? client_meta_info : parent.client_meta_info
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



11
12
13
# File 'lib/worldline/connect/sdk/api_resource.rb', line 11

def client_meta_info
  @client_meta_info
end

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

Communicator instance that provides communication with the Worldline Global Collect platform.

Returns:



11
12
13
# File 'lib/worldline/connect/sdk/api_resource.rb', line 11

def communicator
  @communicator
end