Class: Googletastic::Head
Constant Summary
Constants included from Mixins::Namespaces
Mixins::Namespaces::NAMESPACES
Instance Attribute Summary collapse
-
#per_page ⇒ Object
Returns the value of attribute per_page.
-
#start_index ⇒ Object
Returns the value of attribute start_index.
-
#title ⇒ Object
Returns the value of attribute title.
-
#total_results ⇒ Object
Returns the value of attribute total_results.
Attributes inherited from Base
#acl, #attachment_path, #created_at, #etag, #head, #id, #keep_raw, #raw, #response, #synced_with, #updated_at
Attributes included from Mixins::Attributes
Class Method Summary collapse
Methods inherited from Base
client_class, #initialize, #to_xml
Methods included from Mixins::Pagination
Methods included from Mixins::Finders
Methods included from Mixins::Parsing
Methods included from Mixins::Requesting
Methods included from Mixins::Attributes
#attribute_names, #has_attribute?, #inspect
Methods included from Mixins::Namespaces
Constructor Details
This class inherits a constructor from Googletastic::Base
Instance Attribute Details
#per_page ⇒ Object
Returns the value of attribute per_page.
3 4 5 |
# File 'lib/googletastic/head.rb', line 3 def per_page @per_page end |
#start_index ⇒ Object
Returns the value of attribute start_index.
3 4 5 |
# File 'lib/googletastic/head.rb', line 3 def start_index @start_index end |
#title ⇒ Object
Returns the value of attribute title.
3 4 5 |
# File 'lib/googletastic/head.rb', line 3 def title @title end |
#total_results ⇒ Object
Returns the value of attribute total_results.
3 4 5 |
# File 'lib/googletastic/head.rb', line 3 def total_results @total_results end |
Class Method Details
.unmarshall(xml) ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 |
# File 'lib/googletastic/head.rb', line 7 def unmarshall(xml) feed = xml.xpath("atom:feed", ns_tag("atom")).first return nil unless feed id = feed.xpath("atom:id", ns_tag("atom")).text updated_at = feed.xpath("atom:updated", ns_tag("atom")).text title = feed.xpath("atom:title", ns_tag("atom")).text total_results = feed.xpath("openSearch:totalResults", ns_tag("openSearch")).text start_index = feed.xpath("openSearch:startIndex", ns_tag("openSearch")).text per_page = feed.xpath("openSearch:itemsPerPage", ns_tag("openSearch")).text head = Googletastic::Head.new( :id => id, :title => title, :updated_at => DateTime.parse(updated_at), :total_results => total_results, :start_index => start_index, :per_page => per_page ) end |