Module: Scopus

Defined in:
lib/scopus.rb,
lib/scopus/version.rb,
lib/scopus/connection.rb,
lib/scopus/uri_request.rb,
lib/scopus/xml_response.rb,
lib/scopus/xml_response/service_error.rb,
lib/scopus/xml_response/search_results.rb,
lib/scopus/xml_response/author_retrieval_response.rb,
lib/scopus/xml_response/abstract_citation_response.rb,
lib/scopus/xml_response/abstract_retrieval_response.rb,
lib/scopus/xml_response/author_retrieval_response_list.rb

Overview

PENDING

Defined Under Namespace

Modules: URIRequest, XMLResponse Classes: Connection

Constant Summary collapse

VERSION =
"0.1.0"

Class Method Summary collapse

Class Method Details

.entries_to_csv(entries, csv_file) ⇒ Object



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/scopus.rb', line 48

def self.entries_to_csv(entries,csv_file)
  require 'csv'
  d=Date.today.to_s      
  header=["scopus_id","title","journal","creator","doi","date"]
  CSV.open(csv_file,"wb") {|csv|
    csv << header
    entries.each {|e|
      csv << [e[:scopus_id],e[:title],e[:journal], e[:creator],e[:doi],d]
    }
  }
end

.process_xml(xml) ⇒ Object

Factory method



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

def self.process_xml(xml)

  xml=Nokogiri::XML(xml) if xml.is_a? String
  if xml.children.length==0
    # Error
    Scopus::XMLResponse::XMLEmpty.new
  else
    name=xml.children[0].name.gsub("-","").capitalize
    Scopus::XMLResponse.const_get(name.to_sym).new(xml)
  end

end