crossref 0.0.1 → 0.0.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (4) hide show
  1. data/History.txt +4 -1
  2. data/Rakefile +1 -0
  3. data/lib/crossref.rb +8 -3
  4. metadata +12 -2
data/History.txt CHANGED
@@ -1,4 +1,7 @@
1
- === 1.0.0 / 2009-05-06
1
+
2
+ === 0.0.2 / 2009-05-07
3
+ * Added dependencies in Rakefile
4
+ === 0.0.1 / 2009-05-06
2
5
 
3
6
  * 1 major enhancement
4
7
 
data/Rakefile CHANGED
@@ -8,6 +8,7 @@ Hoe.new('crossref', Crossref::VERSION) do |p|
8
8
  # p.rubyforge_name = 'crossrefx' # if different than lowercase project name
9
9
  p.developer('Robert Crim', 'robert@servermilk.com')
10
10
  p.remote_rdoc_dir = ''
11
+ p.extra_deps << ['nokogiri', '>= 1.2.3']
11
12
  end
12
13
 
13
14
  # vim: syntax=Ruby
data/lib/crossref.rb CHANGED
@@ -3,7 +3,7 @@ require 'nokogiri'
3
3
  require 'open-uri'
4
4
 
5
5
  module Crossref
6
- VERSION = '0.0.1'
6
+ VERSION = '0.0.2'
7
7
 
8
8
  class Metadata
9
9
  attr_accessor :doi, :url, :xml
@@ -15,6 +15,7 @@ module Crossref
15
15
  @base_url += '&pid=' + @pid if @pid
16
16
 
17
17
  if @doi
18
+ @doi = sanitize_doi(@doi)
18
19
  @url = @base_url + "&id=doi:" + @doi
19
20
  @xml = get_xml(@url)
20
21
  end
@@ -55,8 +56,8 @@ module Crossref
55
56
 
56
57
  def published
57
58
  pub = Hash.new
58
- pub[:year] = self.xml.xpath('//publication_date/year')
59
- pub[:month] = self.xml.xpath('//publication_date/month')
59
+ pub[:year] = xpath_first('//publication_date/year')
60
+ pub[:month] = xpath_first('//publication_date/month')
60
61
  pub
61
62
  end
62
63
 
@@ -93,6 +94,10 @@ module Crossref
93
94
  end
94
95
  h
95
96
  end
97
+
98
+ def sanitize_doi(doi)
99
+ doi.gsub(/\n+|\s+/,'')
100
+ end
96
101
 
97
102
  end
98
103
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: crossref
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Crim
@@ -9,9 +9,19 @@ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
11
 
12
- date: 2009-05-08 00:00:00 +01:00
12
+ date: 2009-05-11 00:00:00 +01:00
13
13
  default_executable:
14
14
  dependencies:
15
+ - !ruby/object:Gem::Dependency
16
+ name: nokogiri
17
+ type: :runtime
18
+ version_requirement:
19
+ version_requirements: !ruby/object:Gem::Requirement
20
+ requirements:
21
+ - - ">="
22
+ - !ruby/object:Gem::Version
23
+ version: 1.2.3
24
+ version:
15
25
  - !ruby/object:Gem::Dependency
16
26
  name: hoe
17
27
  type: :development