Class: Binking::Client
- Inherits:
-
Object
- Object
- Binking::Client
- Defined in:
- lib/binking/client.rb
Instance Attribute Summary collapse
-
#api_token ⇒ Object
Returns the value of attribute api_token.
-
#cache ⇒ Object
Returns the value of attribute cache.
-
#host ⇒ Object
Returns the value of attribute host.
-
#logger ⇒ Object
Returns the value of attribute logger.
-
#options ⇒ Object
Returns the value of attribute options.
-
#sandbox ⇒ Object
Returns the value of attribute sandbox.
Instance Method Summary collapse
- #get(path, params = nil) ⇒ Object
-
#initialize(api_token: Binking.config.api_token, host: Binking.config.host, sandbox: Binking.config.sandbox, cache: Binking.config.cache, logger: Binking.config.logger, options: Binking.config.request_options) ⇒ Client
constructor
A new instance of Client.
Constructor Details
#initialize(api_token: Binking.config.api_token, host: Binking.config.host, sandbox: Binking.config.sandbox, cache: Binking.config.cache, logger: Binking.config.logger, options: Binking.config.request_options) ⇒ Client
Returns a new instance of Client.
10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/binking/client.rb', line 10 def initialize(api_token: Binking.config.api_token, host: Binking.config.host, sandbox: Binking.config.sandbox, cache: Binking.config.cache, logger: Binking.config.logger, options: Binking.config.) @api_token = api_token @host = host @sandbox = sandbox @cache = cache @logger = logger @options = end |
Instance Attribute Details
#api_token ⇒ Object
Returns the value of attribute api_token.
8 9 10 |
# File 'lib/binking/client.rb', line 8 def api_token @api_token end |
#cache ⇒ Object
Returns the value of attribute cache.
8 9 10 |
# File 'lib/binking/client.rb', line 8 def cache @cache end |
#host ⇒ Object
Returns the value of attribute host.
8 9 10 |
# File 'lib/binking/client.rb', line 8 def host @host end |
#logger ⇒ Object
Returns the value of attribute logger.
8 9 10 |
# File 'lib/binking/client.rb', line 8 def logger @logger end |
#options ⇒ Object
Returns the value of attribute options.
8 9 10 |
# File 'lib/binking/client.rb', line 8 def @options end |
#sandbox ⇒ Object
Returns the value of attribute sandbox.
8 9 10 |
# File 'lib/binking/client.rb', line 8 def sandbox @sandbox end |
Instance Method Details
#get(path, params = nil) ⇒ Object
24 25 26 27 28 29 |
# File 'lib/binking/client.rb', line 24 def get(path, params = nil) connection.get(path.gsub(%r{^/}, ""), params) do |req| req.params["apiKey"] = api_token if api_token req.params["sandbox"] = 1 if sandbox end end |