Class: Scopus::XMLResponse::Searchresults

Inherits:
XMLResponseGeneric show all
Defined in:
lib/scopus/xml_response/search_results.rb

Instance Method Summary collapse

Constructor Details

This class inherits a constructor from Scopus::XMLResponse::XMLResponseGeneric

Instance Method Details

#entries_to_hashObject



35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
# File 'lib/scopus/xml_response/search_results.rb', line 35

def entries_to_hash
  @xml.xpath("//atom:entry").map {|v|
    title=v.at_xpath("dc:title").nil? ? nil : v.at_xpath("dc:title").text
    journal=v.at_xpath("prism:publicationName").nil? ? nil : v.at_xpath("prism:publicationName").text
    h={
      :scopus_id=>v.at_xpath("dc:identifier").text,
      :title=>title,
      :journal=>journal
    }
    {:creator=>"dc:creator",:doi=>"prism:doi"}.each_pair {|key,xv|
      h[key]=v.at_xpath(xv).text unless v.at_xpath(xv).nil?
    }
    h
  }
end

#next_pageObject



32
33
34
# File 'lib/scopus/xml_response/search_results.rb', line 32

def next_page
  @xml.at_xpath("//atom:link[@ref='next']")
end