Class: YandexApiDirect::Methods::Proxy

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(service, resource) ⇒ Proxy

Returns a new instance of Proxy.



15
16
17
18
# File 'lib/yandex_api_direct/methods.rb', line 15

def initialize(service, resource)
  @service = service
  @resource = resource
end

Dynamic Method Handling

This class handles dynamic methods through the method_missing method

#method_missing(method_name, *arguments, &block) ⇒ Object



20
21
22
# File 'lib/yandex_api_direct/methods.rb', line 20

def method_missing(method_name, *arguments, &block)
				service.call(resource, method: method_name, params: arguments.first)
end

Instance Attribute Details

#resourceObject

Returns the value of attribute resource.



13
14
15
# File 'lib/yandex_api_direct/methods.rb', line 13

def resource
  @resource
end

#serviceObject

Returns the value of attribute service.



12
13
14
# File 'lib/yandex_api_direct/methods.rb', line 12

def service
  @service
end

Instance Method Details

#respond_to?(method_name, include_private = false) ⇒ Boolean

Returns:

  • (Boolean)


24
25
26
# File 'lib/yandex_api_direct/methods.rb', line 24

def respond_to?(method_name, include_private = false)
  true # we should respond to any method using Proxy
end