Class: Yandex::Webmaster::ApiFactory
- Extended by:
- Forwardable
- Defined in:
- lib/yandex-webmaster/api_factory.rb
Constant Summary
Constants included from Request
Request::METHODS, Request::METHODS_WITH_BODIES
Constants included from Connection
Connection::ACCEPT, Connection::ACCEPT_CHARSET, Connection::ALLOWED_OPTIONS, Connection::CONTENT_TYPE, Connection::USER_AGENT
Instance Attribute Summary collapse
-
#klass ⇒ Object
Returns the value of attribute klass.
-
#url ⇒ Object
Returns the value of attribute url.
Attributes inherited from Base
Attributes included from Authorization
Instance Method Summary collapse
- #method_missing(method, *args, &block) ⇒ Object
- #respond_to?(method, include_private = false) ⇒ Boolean
- #to_a ⇒ Object (also: #all)
Methods inherited from Base
#attributes=, const_missing, define_attributes, #initialize
Methods included from Request
#delete_request, #get_request, #post_request, #put_request, #request
Methods included from Connection
Methods included from Authorization
#auth_code, #authenticate, #authenticated?, #authorize_url, #oauth, #token
Constructor Details
This class inherits a constructor from Yandex::Webmaster::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method
#method_missing(method, *args, &block) ⇒ Object
14 15 16 17 18 19 20 21 22 23 24 |
# File 'lib/yandex-webmaster/api_factory.rb', line 14 def method_missing(method, *args, &block) if @klass.respond_to?(method) args = args.push(self) @klass.send(method, *args, &block) elsif Array.method_defined?(method) self.class.def_delegator :to_a, method self.to_a.send(method, *args, &block) else super end end |
Instance Attribute Details
#klass ⇒ Object
Returns the value of attribute klass.
8 9 10 |
# File 'lib/yandex-webmaster/api_factory.rb', line 8 def klass @klass end |
#url ⇒ Object
Returns the value of attribute url.
8 9 10 |
# File 'lib/yandex-webmaster/api_factory.rb', line 8 def url @url end |
Instance Method Details
#respond_to?(method, include_private = false) ⇒ Boolean
10 11 12 |
# File 'lib/yandex-webmaster/api_factory.rb', line 10 def respond_to?(method, include_private = false) super || Array.method_defined?(method) || @klass.respond_to?(method, include_private) end |
#to_a ⇒ Object Also known as: all
26 27 28 |
# File 'lib/yandex-webmaster/api_factory.rb', line 26 def to_a @objects ||= self.objects_from_response(self.klass, self.request(:get, self.url), :host) end |