Class: BibliographicalImporter::JSON::Record
- Inherits:
-
Object
- Object
- BibliographicalImporter::JSON::Record
- Includes:
- CommonRecordAttributes, ReferenceMethods
- Defined in:
- lib/bibliographical_importer/json.rb
Instance Attribute Summary collapse
-
#jv ⇒ Object
readonly
Returns the value of attribute jv.
-
#references_crossref ⇒ Object
Returns the value of attribute references_crossref.
Attributes included from CommonRecordAttributes
#abstract, #affiliation, #authors, #cited, #doi, #id_scopus, #id_wos, #journal, #journal_abbr, #keywords, #keywords_plus, #language, #pages, #references_scopus, #references_wos, #title, #type, #uid, #url, #volume, #year
Class Method Summary collapse
Instance Method Summary collapse
- #author ⇒ Object
-
#initialize(json_value) ⇒ Record
constructor
A new instance of Record.
- #parse_common ⇒ Object
- #references ⇒ Object
- #strip_lines(value) ⇒ Object
Methods included from ReferenceMethods
#authors_apa_6, #cite_apa_6, #ref_apa_6, #ref_apa_6_brief, #ref_apa_6_brief_html
Methods included from DOIHelpers
#a_doi, #doi_without_http, #find_doi, #url_doi
Constructor Details
#initialize(json_value) ⇒ Record
Returns a new instance of Record
79 80 81 82 83 84 85 |
# File 'lib/bibliographical_importer/json.rb', line 79 def initialize(json_value) @jv=json_value @authors=[] parse_common end |
Instance Attribute Details
#jv ⇒ Object (readonly)
Returns the value of attribute jv
65 66 67 |
# File 'lib/bibliographical_importer/json.rb', line 65 def jv @jv end |
#references_crossref ⇒ Object
Returns the value of attribute references_crossref
66 67 68 |
# File 'lib/bibliographical_importer/json.rb', line 66 def references_crossref @references_crossref end |
Class Method Details
.create(json) ⇒ Object
71 72 73 74 75 76 77 |
# File 'lib/bibliographical_importer/json.rb', line 71 def self.create(json) #type=self.determine_type(bibtex_value) #klass="Reference_#{type.capitalize}".to_sym #BibliographicalImporter::JSON.const_get(klass).send(:new, bibtex_value) BibliographicalImporter::JSON::Record.new(json) end |
Instance Method Details
#author ⇒ Object
123 124 125 126 127 |
# File 'lib/bibliographical_importer/json.rb', line 123 def #$log.info(@authors) @authors.join (" and ") end |
#parse_common ⇒ Object
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 |
# File 'lib/bibliographical_importer/json.rb', line 86 def parse_common begin vh=@jv["message"] @uid=vh["URL"] @title=vh["title"].join(";") #$log.info("Parseando") #$log.info(vh["author"]) @authors=vh["author"].map {|v| "#{v["family"]}, #{v["given"]}" } unless vh["author"].nil? # #$log.info(@authors) @journal=vh["container-title"].join(";") @year=vh["issued"]["date-parts"][0][0] @volume=vh["volume"] @pages=vh["page"] @type=vh["type"] @doi=vh["DOI"] @url=vh["URL"] @references_crossref=@jv["message"]["reference"] rescue Exception=>e #$log.info("Error:#{vh}") raise e end end |
#references ⇒ Object
116 117 118 119 120 |
# File 'lib/bibliographical_importer/json.rb', line 116 def references @references_crossref.map {|v| Reference.new(v) } unless @references_crossref.nil? end |
#strip_lines(value) ⇒ Object
133 134 135 |
# File 'lib/bibliographical_importer/json.rb', line 133 def strip_lines(value) value.to_s.gsub(/\n\s*/, ' ') end |