Class: Webmaster::Host
- Extended by:
- Forwardable
- Includes:
- Virtus
- Defined in:
- lib/webmaster/host.rb
Constant Summary
Constants included from Api::Request
Api::Request::METHODS, Api::Request::METHODS_WITH_BODIES
Constants included from Api::Connection
Api::Connection::ACCEPT, Api::Connection::ACCEPT_CHARSET, Api::Connection::ALLOWED_OPTIONS, Api::Connection::CONTENT_TYPE, Api::Connection::USER_AGENT
Instance Attribute Summary collapse
-
#crawling ⇒ Object
readonly
Returns the value of attribute crawling.
Attributes inherited from Base
Attributes included from Api::Authorization
Instance Method Summary collapse
-
#delete ⇒ Object
Delete information about the host from Yandex.Market [RU] api.yandex.ru/webmaster/doc/dg/reference/hosts-delete.xml [EN] api.yandex.com/webmaster/doc/dg/reference/hosts-delete.xml.
- #deleted? ⇒ Boolean
-
#id ⇒ Integer
Id of the host.
-
#incoming_links ⇒ Webmaster::Host
Load information about incoming links for the host [RU] api.yandex.ru/webmaster/doc/dg/reference/host-links.xml [EN] api.yandex.com/webmaster/doc/dg/reference/host-links.xml.
-
#indexed_urls ⇒ Webmaster::Host
Load information about indexed urls for the host [RU] api.yandex.ru/webmaster/doc/dg/reference/hosts-indexed.xml [EN] api.yandex.com/webmaster/doc/dg/reference/hosts-indexed.xml.
-
#resources ⇒ Hash
Load information about resources that are available for the host.
-
#stats ⇒ Webmaster::Host
Load stats for the host [RU] api.yandex.ru/webmaster/doc/dg/reference/hosts-stats.xml [EN] api.yandex.com/webmaster/doc/dg/reference/hosts-stats.xml.
-
#verification(reload = false) ⇒ Webmaster::Hosts::Verification
Information about verification for the host [RU] api.yandex.ru/webmaster/doc/dg/reference/hosts-verify.xml [EN] api.yandex.com/webmaster/doc/dg/reference/hosts-verify.xml.
-
#verify(type) ⇒ Object
Load information about verification for the host.
Methods inherited from Base
#arguments, #attributes=, #initialize, #inspect, #method_missing, #set, #with
Methods included from Api::Request
#delete_request, #get_request, #post_request, #put_request, #request
Methods included from Api::Connection
Methods included from Api::Authorization
#auth_code, #authenticate, #authenticated?, #authorize_url, #oauth, #token
Constructor Details
This class inherits a constructor from Webmaster::Base
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class Webmaster::Base
Instance Attribute Details
#crawling ⇒ Object
Returns the value of attribute crawling.
27 28 29 |
# File 'lib/webmaster/host.rb', line 27 def crawling @crawling end |
Instance Method Details
#delete ⇒ Object
Delete information about the host from Yandex.Market
54 55 56 57 58 59 |
# File 'lib/webmaster/host.rb', line 54 def delete response = self.request(:delete, self.href) # @deleted = true if response.status.to_i == 204 @deleted = true if response.status.to_i == 405 self end |
#deleted? ⇒ Boolean
63 64 65 |
# File 'lib/webmaster/host.rb', line 63 def deleted? !!@deleted end |
#id ⇒ Integer
Id of the host
34 35 36 37 |
# File 'lib/webmaster/host.rb', line 34 def id return @id if defined?(@id) @id = self.href.match(/\/(\d+)\z/)[1].to_i end |
#incoming_links ⇒ Webmaster::Host
Load information about incoming links for the host
122 123 124 125 126 127 |
# File 'lib/webmaster/host.rb', line 122 def incoming_links self.validate_resource!(:incoming_links) self.attributes = self.request(:get, self.resources[:incoming_links]).body self end |
#indexed_urls ⇒ Webmaster::Host
Load information about indexed urls for the host
110 111 112 113 114 115 |
# File 'lib/webmaster/host.rb', line 110 def indexed_urls self.validate_resource!(:indexed_urls) self.attributes = self.request(:get, self.resources[:indexed_urls]).body self end |
#resources ⇒ Hash
Load information about resources that are available for the host
42 43 44 45 46 47 48 |
# File 'lib/webmaster/host.rb', line 42 def resources return @resources if defined?(@resources) @resources = self.fetch_value(self.request(:get, self.href), :link).inject({}) do |h, resource| h[resource[:rel].underscore.to_sym] = resource[:href]; h end end |
#stats ⇒ Webmaster::Host
Load stats for the host
98 99 100 101 102 103 |
# File 'lib/webmaster/host.rb', line 98 def stats self.validate_resource!(:host_information) self.attributes = self.request(:get, self.resources[:host_information]).body self end |
#verification(reload = false) ⇒ Webmaster::Hosts::Verification
Information about verification for the host
82 83 84 85 86 87 88 89 90 91 |
# File 'lib/webmaster/host.rb', line 82 def verification(reload = false) @verification = nil if reload if @verification.nil? self.validate_resource!(:verify_host) self.verification = self.fetch_value(self.request(:get, self.resources[:verify_host]), :verification) end @verification end |
#verify(type) ⇒ Object
Load information about verification for the host
69 70 71 72 73 74 75 76 |
# File 'lib/webmaster/host.rb', line 69 def verify(type) self.validate_resource!(:verify_host) status = self.verification.run(type) @verification = nil status end |