Module: BayonetClient

Defined in:
lib/bayonet_client.rb,
lib/bayonet_client/lending.rb,
lib/bayonet_client/version.rb,
lib/bayonet_client/response.rb,
lib/bayonet_client/ecommerce.rb,
lib/bayonet_client/api_helper.rb,
lib/bayonet_client/exceptions.rb,
lib/bayonet_client/device_fingerprint.rb

Defined Under Namespace

Classes: ApiHelper, BayonetError, BayonetResponse, DeviceFingerprint, Ecommerce, Lending

Constant Summary collapse

VERSION =
'2.2.0'
SUPPORTED_API_VERSIONS =
['2']

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_keyObject (readonly)

Returns the value of attribute api_key.



30
31
32
# File 'lib/bayonet_client.rb', line 30

def api_key
  @api_key
end

.versionObject (readonly)

Returns the value of attribute version.



31
32
33
# File 'lib/bayonet_client.rb', line 31

def version
  @version
end

Class Method Details

.configure(api_key, version) ⇒ Object



11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
# File 'lib/bayonet_client.rb', line 11

def self.configure(api_key, version)
  if version.nil? || version.empty?
    message = 'Please specify Api version'
    raise BayonetClient::BayonetError.new(nil, nil, nil, nil, -1, message)
  end
  if api_key.nil? || api_key.empty?
    message = 'Please specify Api key'
    raise BayonetClient::BayonetError.new(nil, nil, nil, nil, -1, message)
  end
  unless BayonetClient::SUPPORTED_API_VERSIONS.include?(version)
    message = 'This library does not support the version specified. Please consider updating your dependencies'
    raise BayonetClient::BayonetError.new(nil, nil, nil, nil, -1, message)
  end

  @api_key = api_key
  @version = version
end