Class: Ya::Direct::Api
- Inherits:
-
Object
- Object
- Ya::Direct::Api
- Defined in:
- lib/ya_direct_api.rb
Instance Attribute Summary collapse
-
#config ⇒ Object
readonly
Returns the value of attribute config.
-
#env ⇒ Object
readonly
Returns the value of attribute env.
-
#gateway ⇒ Object
readonly
Returns the value of attribute gateway.
Instance Method Summary collapse
-
#initialize(token, app_id, login, locale = 'en', mode = :sandbox) ⇒ Api
constructor
A new instance of Api.
- #method_missing(method_name, args = {}) ⇒ Object
Constructor Details
#initialize(token, app_id, login, locale = 'en', mode = :sandbox) ⇒ Api
Returns a new instance of Api.
13 14 15 16 17 18 19 20 21 |
# File 'lib/ya_direct_api.rb', line 13 def initialize(token, app_id, login, locale = 'en', mode = :sandbox) @config = { token: token, app_id: app_id, login: login, locale: locale } @gateway = Ya::Direct::Gateway.new(@env, @config, mode) end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method_name, args = {}) ⇒ Object
23 24 25 |
# File 'lib/ya_direct_api.rb', line 23 def method_missing(method_name, args = {}) @gateway.get_data(method_name.to_s.camelize, args) end |
Instance Attribute Details
#config ⇒ Object (readonly)
Returns the value of attribute config.
11 12 13 |
# File 'lib/ya_direct_api.rb', line 11 def config @config end |
#env ⇒ Object (readonly)
Returns the value of attribute env.
11 12 13 |
# File 'lib/ya_direct_api.rb', line 11 def env @env end |
#gateway ⇒ Object (readonly)
Returns the value of attribute gateway.
11 12 13 |
# File 'lib/ya_direct_api.rb', line 11 def gateway @gateway end |