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
- DEFAULT_HTTP_TIMEOUT =
10- VERSION =
'2.3.0'- SUPPORTED_API_VERSIONS =
['2']
Class Attribute Summary collapse
-
.api_key ⇒ Object
readonly
Returns the value of attribute api_key.
-
.timeout ⇒ Object
readonly
Returns the value of attribute timeout.
-
.version ⇒ Object
readonly
Returns the value of attribute version.
Class Method Summary collapse
Class Attribute Details
.api_key ⇒ Object (readonly)
Returns the value of attribute api_key.
36 37 38 |
# File 'lib/bayonet_client.rb', line 36 def api_key @api_key end |
.timeout ⇒ Object (readonly)
Returns the value of attribute timeout.
38 39 40 |
# File 'lib/bayonet_client.rb', line 38 def timeout @timeout end |
.version ⇒ Object (readonly)
Returns the value of attribute version.
37 38 39 |
# File 'lib/bayonet_client.rb', line 37 def version @version end |
Class Method Details
.configure(api_key, version, timeout = DEFAULT_HTTP_TIMEOUT) ⇒ Object
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 |
# File 'lib/bayonet_client.rb', line 12 def self.configure(api_key, version, timeout = DEFAULT_HTTP_TIMEOUT) if version.nil? || version.empty? = 'Please specify Api version' raise BayonetClient::BayonetError.new(nil, nil, nil, nil, -1, ) end if api_key.nil? || api_key.empty? = 'Please specify Api key' raise BayonetClient::BayonetError.new(nil, nil, nil, nil, -1, ) end unless timeout.is_a? Numeric = 'Please specify a valid timeout value' raise BayonetClient::BayonetError.new(nil, nil, nil, nil, -1, ) end unless BayonetClient::SUPPORTED_API_VERSIONS.include?(version) = 'This library does not support the version specified. Please consider updating your dependencies' raise BayonetClient::BayonetError.new(nil, nil, nil, nil, -1, ) end @api_key = api_key @version = version @timeout = timeout end |