Class: Ingenico::Connect::SDK::Session

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

Overview

Contains networking and authentication data needed to communicate with the GlobalCollect platform

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_endpoint, connection, authenticator, meta_data_provider) ⇒ Session

Construct a new Session. The session object stores the following:

api_endpoint

The base url to the GlobalCollect platform, given as a string and converted to a URI object

connection

An instance of the Connection class used to communicate with

authenticator

An instance of the Authenticator class used for authenticating messages sent

meta_data_provider

An instance of the MetaDataProvider class containing information relevant for sending requests

Raises:

  • (ArgumentError)


14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'lib/ingenico/connect/sdk/session.rb', line 14

def initialize(api_endpoint, connection, authenticator, )
  raise ArgumentError.new('api_endpoint is required') unless api_endpoint
  raise ArgumentError.new('connection is required') unless connection
  raise ArgumentError.new('authenticator is required') unless authenticator
  raise ArgumentError.new('meta_data_provider is required') unless 

  uri = URI(api_endpoint)
  if uri.path.length > 0 || uri.query || uri.fragment
    raise ArgumentError.new("Base url should not contain a path, query or fragment #{uri.to_s}")
  end
  @api_endpoint = uri
  @connection = connection
  @authenticator = authenticator
   = 
end

Instance Attribute Details

#api_endpointObject (readonly)

The base URI to the GlobalCollect platform as a URI object



31
32
33
# File 'lib/ingenico/connect/sdk/session.rb', line 31

def api_endpoint
  @api_endpoint
end

#authenticatorObject (readonly)

An instance of the Authenticator class used for authenticating messages sent



35
36
37
# File 'lib/ingenico/connect/sdk/session.rb', line 35

def authenticator
  @authenticator
end

#connectionObject (readonly)

An instance of the Connection class used to communicate with



33
34
35
# File 'lib/ingenico/connect/sdk/session.rb', line 33

def connection
  @connection
end

#meta_data_providerObject (readonly)

An instance of the MetaDataProvider class containing information relevant for sending requests



37
38
39
# File 'lib/ingenico/connect/sdk/session.rb', line 37

def 
  
end