Class: YandexApiDirect::Methods::Proxy
- Inherits:
-
Object
- Object
- YandexApiDirect::Methods::Proxy
- Defined in:
- lib/yandex_api_direct/methods.rb
Instance Attribute Summary collapse
-
#resource ⇒ Object
Returns the value of attribute resource.
-
#service ⇒ Object
Returns the value of attribute service.
Instance Method Summary collapse
-
#initialize(service, resource) ⇒ Proxy
constructor
A new instance of Proxy.
- #method_missing(method_name, *arguments, &block) ⇒ Object
- #respond_to?(method_name, include_private = false) ⇒ Boolean
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
#resource ⇒ Object
Returns the value of attribute resource.
13 14 15 |
# File 'lib/yandex_api_direct/methods.rb', line 13 def resource @resource end |
#service ⇒ Object
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
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 |