Class: Ya::Direct::Api

Inherits:
Object
  • Object
show all
Defined in:
lib/ya_direct_api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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, , locale = 'en', mode = :sandbox)
  @config = {
    token: token,
    app_id: app_id,
    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

#configObject (readonly)

Returns the value of attribute config.



11
12
13
# File 'lib/ya_direct_api.rb', line 11

def config
  @config
end

#envObject (readonly)

Returns the value of attribute env.



11
12
13
# File 'lib/ya_direct_api.rb', line 11

def env
  @env
end

#gatewayObject (readonly)

Returns the value of attribute gateway.



11
12
13
# File 'lib/ya_direct_api.rb', line 11

def gateway
  @gateway
end