model/record.rb
# Update record and canonical document using crossref information
Update record and canonical document using crossref information
Update record and canonical document using crossref information
def update_info_using_crossref
    result=Result.new
    ri_json=CrossrefDoi.reference_integrator_json(self[:doi])
    if ri_json
      fields = [:title, :author, :year, :journal, :volume, :pages, :doi, :journal_abbr, :abstract]
      update_data=fields.inject({}) do |ac,v|
        ac[v]=ri_json.send(v)  unless ri_json.send(v).nil?
        ac
      end
      self.update(update_data) unless update_data.keys.length==0
    end
    result
  end
def update_info_using_crossref result = Result . new ri_json = CrossrefDoi . reference_integrator_json ( self [ :doi ] ) if ri_json fields = [ :title , :author , :year , :journal , :volume , :pages , :doi , :journal_abbr , :abstract ] update_data = fields . inject ( { } ) do | ac , v | ac [ v ] = ri_json . send ( v ) unless ri_json . send ( v ) . nil? ac end self . update ( update_data ) unless update_data . keys . length == 0 end result end
Update record and canonical document using crossref information
Update record and canonical document using crossref information