Class: Genius::WebPage
Instance Attribute Summary collapse
-
#annotation_count ⇒ Object
readonly
Returns the value of attribute annotation_count.
-
#domain ⇒ Object
readonly
Returns the value of attribute domain.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#normalized_url ⇒ Object
readonly
Returns the value of attribute normalized_url.
-
#share_url ⇒ Object
readonly
Returns the value of attribute share_url.
-
#title ⇒ Object
readonly
Returns the value of attribute title.
-
#url ⇒ Object
readonly
Returns the value of attribute url.
Attributes inherited from Resource
Class Method Summary collapse
Instance Method Summary collapse
Methods inherited from Resource
default_headers, default_params, from_hash, handle_response, http_delete, http_get, http_post, http_put, #initialize, resource_name
Constructor Details
This class inherits a constructor from Genius::Resource
Instance Attribute Details
#annotation_count ⇒ Object (readonly)
Returns the value of attribute annotation_count.
5 6 7 |
# File 'lib/genius/web_page.rb', line 5 def annotation_count @annotation_count end |
#domain ⇒ Object (readonly)
Returns the value of attribute domain.
5 6 7 |
# File 'lib/genius/web_page.rb', line 5 def domain @domain end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
5 6 7 |
# File 'lib/genius/web_page.rb', line 5 def id @id end |
#normalized_url ⇒ Object (readonly)
Returns the value of attribute normalized_url.
5 6 7 |
# File 'lib/genius/web_page.rb', line 5 def normalized_url @normalized_url end |
#share_url ⇒ Object (readonly)
Returns the value of attribute share_url.
5 6 7 |
# File 'lib/genius/web_page.rb', line 5 def share_url @share_url end |
#title ⇒ Object (readonly)
Returns the value of attribute title.
5 6 7 |
# File 'lib/genius/web_page.rb', line 5 def title @title end |
#url ⇒ Object (readonly)
Returns the value of attribute url.
5 6 7 |
# File 'lib/genius/web_page.rb', line 5 def url @url end |
Class Method Details
.find ⇒ Object
17 18 19 |
# File 'lib/genius/web_page.rb', line 17 def self.find(*) raise NotImplementedError, "A Web Page cannot be loaded by its ID in the public API" end |
.lookup(params = {}) ⇒ Object
25 26 27 28 29 30 31 32 33 |
# File 'lib/genius/web_page.rb', line 25 def self.lookup(params = {}) headers = default_headers.merge(params.delete(:headers) || {}) params = default_params.merge(params) new(http_get("/#{resource_name}s/lookup", query: params, headers: headers), text_format: params[:text_format]) end |
Instance Method Details
#parse_resource! ⇒ Object
7 8 9 10 11 12 13 14 15 |
# File 'lib/genius/web_page.rb', line 7 def parse_resource! @id = resource["id"] @url = resource["url"] @title = resource["title"] @normalized_url = resource["normalized_url"] @domain = resource["domain"] @share_url = resource["share_url"] @annotation_count = resource["annotation_count"] end |
#reload ⇒ Object
21 22 23 |
# File 'lib/genius/web_page.rb', line 21 def reload raise NotReloadableError, "A Web Page cannot be reloaded" end |