paper_metadata 0.0.3 → 0.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -5
- data/lib/paper_metadata/version.rb +1 -1
- data/lib/paper_metadata.rb +8 -5
- data/test/doi_guestquery.html +297 -0
- data/test/test_paper_metadata.rb +14 -8
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f404b9b484329f732c2b71bd2e4abdf84ca97cee
|
4
|
+
data.tar.gz: 8f4b35221f91a12d49a445028462d9561ea8424a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9baba7b45129a21cf0ad08a6db0469d0f395bd848a9e619bce67d77cfb9d9ab2f08423d5444ad4a87ef7c44d5b9d4b3cccc4a3b124bbac98d157f50a66fb4d26
|
7
|
+
data.tar.gz: bd61fc685c0419d584040a7fe01b13d5630769378b72ce48f8c369982851cd02def110229c245c5601b38ae3ea8b2da37ad71ef5da5a12b07fbebd9a8f9ab113
|
data/README.md
CHANGED
@@ -18,11 +18,7 @@ Or install it yourself as:
|
|
18
18
|
|
19
19
|
## Usage
|
20
20
|
|
21
|
-
You
|
22
|
-
|
23
|
-
PaperMetadata.doi_username = 'email@example.com'
|
24
|
-
|
25
|
-
You can then access API:
|
21
|
+
You can use PaperMetadata like this:
|
26
22
|
|
27
23
|
result = PaperMetadata.metadata_for('doi:10.1021/ac1014832')
|
28
24
|
|
data/lib/paper_metadata.rb
CHANGED
@@ -3,6 +3,7 @@ require 'nokogiri'
|
|
3
3
|
require 'net/http'
|
4
4
|
require 'open-uri'
|
5
5
|
require 'cgi'
|
6
|
+
require 'uri'
|
6
7
|
|
7
8
|
module PaperMetadata
|
8
9
|
class << self
|
@@ -14,17 +15,19 @@ module PaperMetadata
|
|
14
15
|
end
|
15
16
|
|
16
17
|
def metadata_for(identifier)
|
17
|
-
if identifier =~ /^arxiv
|
18
|
-
metadata_for_arxiv(
|
19
|
-
elsif identifier =~ /^doi
|
20
|
-
metadata_for_doi(
|
18
|
+
if identifier =~ /^arxiv\:(.*)/i
|
19
|
+
metadata_for_arxiv($1.strip)
|
20
|
+
elsif identifier =~ /^doi\:(.*)/i
|
21
|
+
metadata_for_doi($1.strip)
|
21
22
|
end
|
22
23
|
end
|
23
24
|
|
24
25
|
def metadata_for_doi(doi)
|
25
|
-
doc = Nokogiri::XML(open("http://www.crossref.org/
|
26
|
+
doc = Nokogiri::XML(open("http://www.crossref.org/guestquery?queryType=doi&restype=unixref&doi=#{URI.escape(doi)}&doi_search=Search"))
|
26
27
|
paper = Hash.new
|
27
28
|
|
29
|
+
doc = doc.css('table[name=doiresult]').first
|
30
|
+
|
28
31
|
if doc.xpath("//titles/title").first
|
29
32
|
paper[:volume] = doc.xpath("//journal_issue/journal_volume/volume").inner_html.to_s
|
30
33
|
paper[:isssue] = doc.xpath("//journal_issue/issue").inner_html.to_s
|
@@ -0,0 +1,297 @@
|
|
1
|
+
<html>
|
2
|
+
<head>
|
3
|
+
<META HTTP-EQUIV="Content-Type" content="text/html;charset=UTF-8">
|
4
|
+
<meta name="generator" content="Adobe GoLive 6">
|
5
|
+
<title>crossref.org : : free DOI guest search</title>
|
6
|
+
|
7
|
+
<link href="http://www.crossref.org/css/master.css" rel="stylesheet" media="screen">
|
8
|
+
<script type="text/javascript" src="/guestquery.js"></script>
|
9
|
+
|
10
|
+
<script type="text/javascript" src="http://www.crossref.org/js/blackrule.js"></script>
|
11
|
+
<script type="text/javascript" src="http://www.crossref.org/js/greyrule.js"></script>
|
12
|
+
<script type="text/javascript" src="http://www.crossref.org/js/tablerule.js"></script>
|
13
|
+
<csimport user="http://www.crossref.org/crossref.org.data/Components/imenu.html" occur="90">
|
14
|
+
<script type="text/javascript" src="http://www.crossref.org/GeneratedItems/menumachine.js"></script>
|
15
|
+
</csimport>
|
16
|
+
|
17
|
+
</head>
|
18
|
+
|
19
|
+
<body onload="CSScriptInit();void(0);" background="http://www.crossref.org/images/backpattern.gif" bottommargin="0" leftmargin="0" rightmargin="0" topmargin="0" marginheight="0" marginwidth="0" >
|
20
|
+
<table width="100%" border="0" cellspacing="0" cellpadding="0" height="100%">
|
21
|
+
<tr height="88">
|
22
|
+
<td valign="top" height="88"><csobj csref="http://www.crossref.org/crossref.org.data/Components/ihead.html" h="8" occur="0" t="Component" w="916">
|
23
|
+
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
24
|
+
<tr>
|
25
|
+
<td width="158"><a href="http://www.crossref.org/index.html"><img src="http://www.crossref.org/images/homeImages/crLogo.gif" alt="" height="38" width="114" align="top" border="0" hspace="10" vspace="14"></a></td>
|
26
|
+
<td class="headercell" align="right" valign="top" ><img src="http://www.crossref.org/images/spacer.gif" alt="" height="36" width="32" border="0"><br>
|
27
|
+
|
28
|
+
<img src="http://www.crossref.org/images/spacer.gif" alt="" height="36" width="24" border="0"></td>
|
29
|
+
</tr>
|
30
|
+
<tr>
|
31
|
+
<td colspan="2" background="http://www.crossref.org/images/homeImages/headerBar.gif"><img src="http://www.crossref.org/images/spacer.gif" alt="" height="10" width="114" border="0"></td>
|
32
|
+
</tr>
|
33
|
+
</table>
|
34
|
+
</csobj>
|
35
|
+
</td>
|
36
|
+
</tr>
|
37
|
+
|
38
|
+
<tr>
|
39
|
+
<td valign="top">
|
40
|
+
<table width="95%" border="0" cellspacing="0" cellpadding="0">
|
41
|
+
<tr valign="top">
|
42
|
+
<td align="left" valign="top" width="24"><img src="http://www.crossref.org/images/spacer.gif" alt="" height="18" width="18" border="0"></td>
|
43
|
+
<td align="left" valign="top">
|
44
|
+
<p> <img src="http://www.crossref.org/images/hds/hd-freeDOIlookup.gif" alt="" height="75" width="295" border="0" </p>
|
45
|
+
|
46
|
+
<p>
|
47
|
+
|
48
|
+
<script language="JavaScript">
|
49
|
+
blackrule();
|
50
|
+
|
51
|
+
</script>
|
52
|
+
</p>
|
53
|
+
<csobj csref="http://www.crossref.org/crossref.org.data/Components/query_form.html" h="285" occur="22" t="Component" w="505">
|
54
|
+
<p>Review the <a href="http://www.crossref.org/01company/free_services_agreement.html" target="_blank">terms</a> for using this service.</p>
|
55
|
+
<p>CrossRef currently provides a number of ways for you to locate a DOI. </p>
|
56
|
+
<ul>
|
57
|
+
<li>If you have bibliographic data for a item and would like to find the DOI, please use the <a href="#bibsearch">metadata</a> section of this form.</li>
|
58
|
+
<li>If you only have an article title and author, please use the <a href="#textsearch">article title search</a> section of this form.</li>
|
59
|
+
<li>If you have the text of a bibliographic reference, please use our <a href="http://www.crossref.org/SimpleTextQuery">Simple Text Query</a> service.</li>
|
60
|
+
<li>If you are a developer and wish to submit a raw XML query use <a href="#xmlsearch">the XML form</a> section of this page.</li>
|
61
|
+
</ul>
|
62
|
+
</td></tr></table>
|
63
|
+
|
64
|
+
<!-- ======================================================================== -->
|
65
|
+
|
66
|
+
<table width="90%" border="0"><tr><td width="20"> </td><td>
|
67
|
+
<script language="JavaScript">
|
68
|
+
|
69
|
+
blackrule();
|
70
|
+
</script>
|
71
|
+
|
72
|
+
<b><i id="bibsearch">Bibliographic metadata search</i></b>
|
73
|
+
<p>This form is a guest query interface to the CrossRef system for individual DOI retrieval. This interface is not intended for automated querying. If you would like to query CrossRef on an automated batch basis,
|
74
|
+
please obtain an account on our system.</p><p>You must supply either author or first page and we recommend using journal title as well as ISSN.
|
75
|
+
For a list of journal titles in the CrossRef holdings please visit <a href="http://www.crossref.org/titleList"> our browsable journal list</a>.</p>
|
76
|
+
|
77
|
+
<form enctype="application/x-www-form-urlencoded" accept-charset="UTF-8" method="POST" name="form1" onSubmit="return validate_form1();">
|
78
|
+
<input type="hidden" name="queryType" value="bibsearch">
|
79
|
+
<table><tr><td width="120" colspan=2>Limit search to: <td colspan=4><input type="radio" name="search_type" value="journal" checked>Journal OR <input type="radio" name="search_type" value="books" >Book/Conference Proceeding<br>
|
80
|
+
<tr><td width="80px">First Author <td colspan=3><input style='font-size:10px;height:18px;' type='text' name='auth' size='30'value="" >
|
81
|
+
<td colspan=3 align=right>ISSN<td colspan=1 align=right><input style='font-size:10px;height:18px;' type='text' name='issn' size='8' maxlength='8' value="">
|
82
|
+
<tr><td>Journal Title <td colspan=7><input style='font-size:10px;height:18px;' type='text' name='title' size='84' value="" alt='Enter Journal Title for Journal searches or Book/Conference Title for Book/Conference searches'>
|
83
|
+
<tr><td>Article Title <td colspan=7><input style='font-size:10px;height:18px;' type='text' name='atitle' MAXLENGTH='256' size='84' value="" alt='Enter Article Title for Journal searches'>
|
84
|
+
<tr><td>Volume<td><input style='font-size:10px;height:18px;' type='text' name='volume' size='8' value="">
|
85
|
+
<td width="80" align=right>Issue<td><input style='font-size:10px;height:18px;' type='text' name='issue' size='8' value="">
|
86
|
+
<td align=right>Page<td><input style='font-size:10px;height:18px;' type='text' name='page' size='8' value="">
|
87
|
+
<td align=right>Year<td><input style='font-size:10px;height:18px;' type='text' name='year' size='4' maxlength='4' value="">
|
88
|
+
<tr><td>
|
89
|
+
<tr><td colspan=1>ISBN <td colspan=2><input style='font-size:10px;height:18px;' type='text' name='isbn' size='16' maxlength='16' value="">
|
90
|
+
<td colspan=2 align=right>Component Number <td colspan=4 align=right><input style='font-size:10px;height:18px;' type='text' name='compnum' size='32' maxlength='32' value="">
|
91
|
+
<tr><td>Series Title <td colspan=7><input style='font-size:10px;height:18px;' type='text' name='stitle' size='84' value="">
|
92
|
+
<tr><td colspan=2>Enable Multiple Hits <td colspan=2><input type='checkbox' name='multi_hit' value='true' checked >
|
93
|
+
<tr><td colspan=8 align=center><input style='font-weight:normal;font-size:10px;' type='submit' name='view_records' value='Search'>
|
94
|
+
<input style='font-weight:normal;font-size:10px;' type='button' name='Reset' value='Clear Form' onClick='clearAllFields();'>
|
95
|
+
</table>
|
96
|
+
</form>
|
97
|
+
</td></tr>
|
98
|
+
|
99
|
+
</table>
|
100
|
+
|
101
|
+
<!-- ======================================================================== -->
|
102
|
+
|
103
|
+
<table width="90%" border="0"><tr><td width="20"> </td><td>
|
104
|
+
|
105
|
+
<script language="JavaScript">
|
106
|
+
blackrule();
|
107
|
+
</script>
|
108
|
+
|
109
|
+
<b><i id="textsearch">Search on article title</i></b>
|
110
|
+
<p>If you only know the title of an item (article, book chapter, report, working-paper ... etc.) and the author submit them here.
|
111
|
+
This form is a guest query interface to the CrossRef system for individual DOI retrieval. This interface
|
112
|
+
is not intended for automated querying.
|
113
|
+
If you would like to query CrossRef on an automated batch basis, please obtain an account on our system.
|
114
|
+
</p>
|
115
|
+
<form enctype="application/x-www-form-urlencoded" accept-charset="UTF-8" method="POST" name="form2" onSubmit="return validate_form2();">
|
116
|
+
<input type="hidden" name="queryType" value="author-title">
|
117
|
+
<table>
|
118
|
+
<tr><td width=\"80px\">First Author (surname) </td><td colspan=3><input style='font-size:10px;height:18px;' type='text' name='auth2' size='30'value=""></td></tr>
|
119
|
+
<tr><td>Article Title </td><td colspan=7><input style='font-size:10px;height:18px;' type='text' name='atitle2' MAXLENGTH='256' size='120' value="" alt='Enter Article Title'></td></tr>
|
120
|
+
<tr><td colspan=2>Enable Multiple Hits <td colspan=2><input type='checkbox' name='multi_hit' value='true' checked >
|
121
|
+
<tr><td colspan=8 align=center><input style='font-weight:normal;font-size:10px;' type='submit' name='article_title_search' value='Search'> <input style='font-weight:normal;font-size:10px;' type='button' name='Reset' value='Clear Form' onClick='clearAllFields();'></td></tr>
|
122
|
+
</table>
|
123
|
+
</form>
|
124
|
+
|
125
|
+
</td></tr>
|
126
|
+
|
127
|
+
</table>
|
128
|
+
|
129
|
+
<!-- ======================================================================== -->
|
130
|
+
|
131
|
+
<table width="90%" border="0"><tr><td width="20"> </td><td >
|
132
|
+
<script language="JavaScript">
|
133
|
+
blackrule();
|
134
|
+
</script>
|
135
|
+
|
136
|
+
<b><i id="doisearch">A DOI query</i></b>
|
137
|
+
|
138
|
+
<form enctype="application/x-www-form-urlencoded" method="POST" name="form5" onSubmit="return validate_form5();">
|
139
|
+
<input type="hidden" name="queryType" value="doi">
|
140
|
+
<table>
|
141
|
+
<tr><td colspan="2">Select result format -- xml-xsd:<input type='radio' name='restype' value='xsl_xml' > OR unixref:<input type='radio' name='restype' value='unixref' checked></td></tr>
|
142
|
+
<tr><td>DOI: </td><td><textarea style='font-size:14px;' name='doi' rows='1' cols='80'>10.1021/ac1014832</textarea></td></tr>
|
143
|
+
<tr><td colspan=8 align=center><input style='font-weight:normal;font-size:10px;' type='submit' name='doi_search' value='Search'></tr>
|
144
|
+
</table>
|
145
|
+
</form>
|
146
|
+
</td></tr>
|
147
|
+
|
148
|
+
<tr><td width="20"> </td><td>
|
149
|
+
|
150
|
+
<table name="doiresult" width="90%" border="0"><tr>
|
151
|
+
|
152
|
+
<tr><td>XML Result</td><td><textarea style='font-size:12px;' name='xml' rows='30' cols='140'><?xml version="1.0" encoding="UTF-8"?>
|
153
|
+
<doi_records>
|
154
|
+
<doi_record key="key" owner="10.1021" timestamp="2011-05-21 00:52:16">
|
155
|
+
<crossref>
|
156
|
+
<journal>
|
157
|
+
<journal_metadata language="en">
|
158
|
+
<full_title>Analytical Chemistry</full_title>
|
159
|
+
<abbrev_title>Anal. Chem.</abbrev_title>
|
160
|
+
<issn media_type="print">0003-2700</issn>
|
161
|
+
<issn media_type="electronic">1520-6882</issn>
|
162
|
+
</journal_metadata>
|
163
|
+
<journal_issue>
|
164
|
+
<publication_date media_type="print">
|
165
|
+
<month>10</month>
|
166
|
+
<year>2010</year>
|
167
|
+
</publication_date>
|
168
|
+
<journal_volume>
|
169
|
+
<volume>82</volume>
|
170
|
+
</journal_volume>
|
171
|
+
<issue>19</issue>
|
172
|
+
</journal_issue>
|
173
|
+
<journal_article publication_type="full_text">
|
174
|
+
<titles>
|
175
|
+
<title>Basic Modeling Approach To Optimize Elemental Imaging by Laser Ablation ICPMS</title>
|
176
|
+
</titles>
|
177
|
+
<contributors>
|
178
|
+
<person_name sequence="first" contributor_role="author">
|
179
|
+
<given_name>Jure</given_name>
|
180
|
+
<surname>Triglav</surname>
|
181
|
+
</person_name>
|
182
|
+
<person_name sequence="additional" contributor_role="author">
|
183
|
+
<given_name>Johannes T.</given_name>
|
184
|
+
<surname>van Elteren</surname>
|
185
|
+
</person_name>
|
186
|
+
<person_name sequence="additional" contributor_role="author">
|
187
|
+
<given_name>Vid S.</given_name>
|
188
|
+
<surname>Šelih</surname>
|
189
|
+
</person_name>
|
190
|
+
</contributors>
|
191
|
+
<publication_date media_type="print">
|
192
|
+
<month>10</month>
|
193
|
+
<year>2010</year>
|
194
|
+
</publication_date>
|
195
|
+
<pages>
|
196
|
+
<first_page>8153</first_page>
|
197
|
+
<last_page>8160</last_page>
|
198
|
+
</pages>
|
199
|
+
<publisher_item>
|
200
|
+
<identifier id_type="doi">10.1021/ac1014832</identifier>
|
201
|
+
</publisher_item>
|
202
|
+
<doi_data>
|
203
|
+
<doi>10.1021/ac1014832</doi>
|
204
|
+
<resource>http://pubs.acs.org/doi/abs/10.1021/ac1014832</resource>
|
205
|
+
</doi_data>
|
206
|
+
</journal_article>
|
207
|
+
</journal>
|
208
|
+
</crossref>
|
209
|
+
</doi_record>
|
210
|
+
</doi_records></textarea></td></tr>
|
211
|
+
|
212
|
+
</table>
|
213
|
+
</td></tr>
|
214
|
+
|
215
|
+
</table>
|
216
|
+
|
217
|
+
<!-- ======================================================================== -->
|
218
|
+
|
219
|
+
<table width="90%" border="0"><tr><td width="20"> </td><td>
|
220
|
+
<script language="JavaScript">
|
221
|
+
blackrule();
|
222
|
+
</script>
|
223
|
+
<b><i id="xmlsearch" onclick="toggleMenu('xmlinput');toggleMenu('xmlresult')">Build an XML query (<font style="cursor:pointer" color="red">click here</font>) (for experts only!)</i></b>
|
224
|
+
<br>
|
225
|
+
<p>You may enter a query in XML form if you <a href="http://www.crossref.org/schema/querySchema/crossref_query_input2.0.9.xsd">know the tags</a> and wish to experiment with the query control attributes.</p>
|
226
|
+
<form enctype="application/x-www-form-urlencoded" accept-charset="UTF-8" method="POST" name="form4" onSubmit="return validate_form4();">
|
227
|
+
<input type="hidden" name="queryType" value="xml">
|
228
|
+
|
229
|
+
<table id="xmlinput" name="xmlinput" style="display:none" >
|
230
|
+
<tr><td colspan="3">Select result format -- xml-xsd:<input type='radio' name='restype' value='xsl_xml' > OR unixref:<input type='radio' name='restype' value='unixref' checked></td></tr>
|
231
|
+
<tr><td>XML Query </td><td colspan=3><textarea style='font-size:12px;' name='xml' rows='30' cols='140'></textarea></td></tr>
|
232
|
+
<tr><td colspan=8 align=center><input style='font-weight:normal;font-size:10px;' type='submit' name='xml_search' value='Search'> <input style='font-weight:normal;font-size:10px;' type='button' name='Reset' value='Clear Form' onClick='clearAllFields();'></td></tr>
|
233
|
+
</table>
|
234
|
+
|
235
|
+
</form>
|
236
|
+
</td></tr>
|
237
|
+
<tr><td width="20"> </td><td>
|
238
|
+
|
239
|
+
</td></tr>
|
240
|
+
</table>
|
241
|
+
|
242
|
+
</csobj>
|
243
|
+
<p>
|
244
|
+
<script language="JavaScript"><!--
|
245
|
+
blackrule();
|
246
|
+
// -->
|
247
|
+
</script>
|
248
|
+
</p>
|
249
|
+
<!-- #EndEditable -->
|
250
|
+
<p><img src="http://www.crossref.org/images/spacer.gif" alt="" height="36" width="36" border="0"></p>
|
251
|
+
</td>
|
252
|
+
</tr>
|
253
|
+
|
254
|
+
|
255
|
+
<tr valign="bottom" height="80">
|
256
|
+
<td height="80"><csobj csref="http://www.crossref.org/crossref.org.data/Components/footer_rev.html" h="78" occur="65" t="Component" w="916">
|
257
|
+
<table width="100%" border="0" cellspacing="0" cellpadding="0">
|
258
|
+
<tr>
|
259
|
+
<td width="655">
|
260
|
+
<TABLE WIDTH=775 BORDER="0" CELLPADDING=0 CELLSPACING=0>
|
261
|
+
<TR>
|
262
|
+
<TD COLSPAN=8><IMG SRC="http://www.crossref.org/images/rev_footer_images/f_toplines.gif" WIDTH=800 HEIGHT=3 ALT=""></TD>
|
263
|
+
|
264
|
+
</TR>
|
265
|
+
<TR>
|
266
|
+
<TD COLSPAN=8 BGCOLOR=#D4D2E3><IMG SRC="http://www.crossref.org/images/rev_footer_images/fbar01.gif" WIDTH=800 HEIGHT=10 ALT=""></TD>
|
267
|
+
</TR>
|
268
|
+
<TR>
|
269
|
+
<TD ROWSPAN=2 BGCOLOR=#535151><a href="http://www.crossref.org/index.html" onfocus="if(this.blur)this.blur();"><IMG SRC="http://www.crossref.org/images/footer_images/flogo_cr.gif" WIDTH=166 HEIGHT=65 ALT="" border="0"></a></TD>
|
270
|
+
<TD BGCOLOR=#535151><csobj al="" h="30" ht="http://www.crossref.org/images/rev_footer_images/f_about_cr-over.gif" t="Button" w="71"><a href="http://www.crossref.org/01company/index.html" onmouseover="return CSIShow(/*CMP*/'button',1)" onmouseout="return CSIShow(/*CMP*/'button',0)" onclick="return CSButtonReturn()"><img src="http://www.crossref.org/images/rev_footer_images/f_about_cr.gif" width="71" height="30" name="button" border="0" alt=""></a></csobj></TD>
|
271
|
+
<TD BGCOLOR=#535151><csobj al="" h="30" ht="http://www.crossref.org/images/rev_footer_images/f_info_pub-over.gif" t="Button" w="82"><a href="index.html" onmouseover="return CSIShow(/*CMP*/'button2',1)" onmouseout="return CSIShow(/*CMP*/'button2',0)" onclick="return CSButtonReturn()"><img src="http://www.crossref.org/images/rev_footer_images/f_info_pub.gif" width="82" height="30" name="button2" border="0" alt=""></a></csobj></TD>
|
272
|
+
<TD BGCOLOR=#535151><csobj al="" h="30" ht="http://www.crossref.org/images/rev_footer_images/f_info_lib-over.gif" t="Button" w="72"><a href="http://www.crossref.org/03libraries/index.html" onmouseover="return CSIShow(/*CMP*/'button7',1)" onmouseout="return CSIShow(/*CMP*/'button7',0)" onclick="return CSButtonReturn()"><img src="http://www.crossref.org/images/rev_footer_images/f_info_lib.gif" width="72" height="30" name="button7" border="0" alt=""></a></csobj></TD>
|
273
|
+
|
274
|
+
<TD BGCOLOR=#535151><csobj al="" h="30" ht="http://www.crossref.org/images/rev_footer_images/f_info_int-over.gif" t="Button" w="79"><a href="http://www.crossref.org/04intermediaries/index.html" onmouseover="return CSIShow(/*CMP*/'button3',1)" onmouseout="return CSIShow(/*CMP*/'button3',0)" onclick="return CSButtonReturn()"><img src="http://www.crossref.org/images/rev_footer_images/f_info_int.gif" width="79" height="30" name="button3" border="0" alt=""></a></csobj></TD>
|
275
|
+
<TD BGCOLOR=#535151><csobj al="" h="30" ht="http://www.crossref.org/images/rev_footer_images/f_info_res-over.gif" t="Button" w="90"><a href="http://www.crossref.org/05researchers/index.html" onmouseover="return CSIShow(/*CMP*/'button4',1)" onmouseout="return CSIShow(/*CMP*/'button4',0)" onclick="return CSButtonReturn()"><img src="http://www.crossref.org/images/rev_footer_images/f_info_res.gif" width="90" height="30" name="button4" border="0" alt=""></a></csobj></TD>
|
276
|
+
<TD BGCOLOR=#535151><csobj al="" h="30" ht="http://www.crossref.org/images/rev_footer_images/f_mem_area-over.gif" t="Button" w="112"><a href="http://www.crossref.org/06members/index.html" onmouseover="return CSIShow(/*CMP*/'button5',1)" onmouseout="return CSIShow(/*CMP*/'button5',0)" onclick="return CSButtonReturn()"><img src="http://www.crossref.org/images/rev_footer_images/f_mem_area.gif" width="112" height="30" name="button5" border="0" alt=""></a></csobj></TD>
|
277
|
+
<TD ROWSPAN=2 BGCOLOR=#535151><a href="http://www.atypon.com" onfocus="if(this.blur)this.blur();"><IMG SRC="http://www.crossref.org/images/rev_footer_images/crfooter_10.gif" WIDTH=128 HEIGHT=65 ALT="" border="0"></a></TD>
|
278
|
+
</TR>
|
279
|
+
<TR>
|
280
|
+
<TD><csobj al="" h="35" ht="http://www.crossref.org/images/rev_footer_images/f_sitemap-over.gif" t="Button" w="71"><a href="http://www.crossref.org/01company/sitemap.html" onmouseover="return CSIShow(/*CMP*/'button6',1)" onmouseout="return CSIShow(/*CMP*/'button6',0)" onclick="return CSButtonReturn()"><img src="http://www.crossref.org/images/rev_footer_images/f_sitemap.gif" width="71" height="35" name="button6" border="0" alt=""></a></csobj></TD>
|
281
|
+
<TD COLSPAN=2><IMG SRC="http://www.crossref.org/images/footer_images/f_fill.gif" WIDTH=154 HEIGHT=35 ALT=""></TD>
|
282
|
+
<TD COLSPAN=3 BGCOLOR=#535151><IMG SRC="http://www.crossref.org/images/rev_footer_images/f_copyright.gif" WIDTH=281 HEIGHT=35 ALT="copyright 2002, pila, inc. all rights reserved"></TD>
|
283
|
+
|
284
|
+
</TR>
|
285
|
+
</TABLE>
|
286
|
+
</td>
|
287
|
+
<td background="http://www.crossref.org/images/footer_images/f_continue.gif"><img src="http://www.crossref.org/images/spacer.gif"></td>
|
288
|
+
</tr>
|
289
|
+
</table>
|
290
|
+
</csobj></td>
|
291
|
+
</tr>
|
292
|
+
</table>
|
293
|
+
|
294
|
+
</body>
|
295
|
+
</html>
|
296
|
+
|
297
|
+
|
data/test/test_paper_metadata.rb
CHANGED
@@ -5,7 +5,7 @@ require 'test_helper'
|
|
5
5
|
class PaperMetadataTest < Test::Unit::TestCase
|
6
6
|
def test_doi_parsing
|
7
7
|
|
8
|
-
doi_response = File.read(File.join(File.dirname(__FILE__), '
|
8
|
+
doi_response = File.read(File.join(File.dirname(__FILE__), 'doi_guestquery.html'))
|
9
9
|
stub_request(:any, /www.crossref.org\/.*/).
|
10
10
|
to_return(:body => doi_response, :status => 200, :headers => { 'Content-Length' => doi_response.length } )
|
11
11
|
|
@@ -15,14 +15,13 @@ class PaperMetadataTest < Test::Unit::TestCase
|
|
15
15
|
PaperMetadata.metadata_for('doi:10.1021/ac1014832')[:title]
|
16
16
|
end
|
17
17
|
|
18
|
-
def
|
18
|
+
def test_doi_parsing_live
|
19
|
+
WebMock.allow_net_connect!
|
19
20
|
doi_response = File.read(File.join(File.dirname(__FILE__), 'doi.xml'))
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
PaperMetadata.metadata_for('doi:10.1021/ac1014832')
|
25
|
-
end
|
21
|
+
PaperMetadata.doi_username = 'test@crossref.org'
|
22
|
+
assert_equal "Basic Modeling Approach To Optimize Elemental Imaging by Laser Ablation ICPMS",
|
23
|
+
PaperMetadata.metadata_for('doi:10.1021/ac1014832')[:title]
|
24
|
+
WebMock.disable_net_connect!
|
26
25
|
end
|
27
26
|
|
28
27
|
def test_arxiv_parsing
|
@@ -32,4 +31,11 @@ class PaperMetadataTest < Test::Unit::TestCase
|
|
32
31
|
assert_equal "Thomas Vojta",
|
33
32
|
PaperMetadata.metadata_for('arXiv:1301.7746')[:author]
|
34
33
|
end
|
34
|
+
|
35
|
+
def test_arxiv_parsing_live
|
36
|
+
WebMock.allow_net_connect!
|
37
|
+
assert_equal "Thomas Vojta",
|
38
|
+
PaperMetadata.metadata_for('arXiv:1301.7746')[:author]
|
39
|
+
WebMock.disable_net_connect!
|
40
|
+
end
|
35
41
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: paper_metadata
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jure Triglav
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-07-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: pry
|
@@ -84,6 +84,7 @@ files:
|
|
84
84
|
- paper_metadata.gemspec
|
85
85
|
- test/arxiv.xml
|
86
86
|
- test/doi.xml
|
87
|
+
- test/doi_guestquery.html
|
87
88
|
- test/test_helper.rb
|
88
89
|
- test/test_paper_metadata.rb
|
89
90
|
homepage: http://github.com/jure/paper_metadata
|
@@ -112,5 +113,6 @@ summary: Paper_metadata gem gets the metadata for papers with a DOI or an arXiv
|
|
112
113
|
test_files:
|
113
114
|
- test/arxiv.xml
|
114
115
|
- test/doi.xml
|
116
|
+
- test/doi_guestquery.html
|
115
117
|
- test/test_helper.rb
|
116
118
|
- test/test_paper_metadata.rb
|