Class: Worldline::Acquiring::SDK::ApiResource

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

Overview

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

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

Creates a new ApiResource.

Parameters:

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

    parent resource instance.

  • communicator (Worldline::Acquiring::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.

Raises:

  • (ArgumentError)


16
17
18
19
20
21
# File 'lib/worldline/acquiring/sdk/api_resource.rb', line 16

def initialize(parent: nil, communicator: nil, path_context: 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
end

Instance Attribute Details

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

Communicator instance that provides communication with the Worldline Acquiring platform.

Returns:



8
9
10
# File 'lib/worldline/acquiring/sdk/api_resource.rb', line 8

def communicator
  @communicator
end