puree 0.18.0 → 0.19.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: c2678f284947384cb88da1511bbdedf6cbc00314
4
- data.tar.gz: 7d8435e7e07d5e98aa8240e1e736456503457a7f
3
+ metadata.gz: 86f3775fc9747a946a2d480bd0621971d4e8ecd2
4
+ data.tar.gz: e565564db8ce6ae7af9c1d68e99f4cada1474f1f
5
5
  SHA512:
6
- metadata.gz: fe6494c3ac14f9f20811268c5b3c65b2cd5b5f888a94113cf2f887729c3ea1998d73883193bdc0db740659f8f099f354f6767e30a0c75b00c182496cba18b13a
7
- data.tar.gz: 1d9cf4abce07487bcf45881ebec3bbf7f6c1ab241002e1c91c0891cee3220dfccf1f82f2c65eac2e3cd19b7bc3eff6eccca0b9aa806b049d198a1bd496df39a8
6
+ metadata.gz: 7787556f42cf0ec6c39658200e827561a085d71164b11b60c7ea99ae3ce11c40bb73364252ac955696d7dbdeced7fc892de7c1f8e97db439bc8e6298f142d2de
7
+ data.tar.gz: fa50727a5235c18815aa667a53474faf022563c9decede02e2bec591c1c7656d525d2b492c40f2bbd2d8c9d37f765df0a6a42bc0731278a0669ba34a08f77a14
@@ -3,10 +3,18 @@ All notable changes to this project will be documented in this file.
3
3
  This project adheres to [Semantic Versioning](http://semver.org/).
4
4
 
5
5
  ## Unreleased
6
- - Metadata: clipping?, externalPerson?, journal?, publisher?
6
+ - Metadata: activity?, clipping?, externalPerson?
7
7
  - Factory to make resource objects?
8
8
  - Make ALL dates ISO 8601 YYYY-MM-DD, rather than mirror varying formats from Pure?
9
9
 
10
+ ## 0.19.0 - 2016-09-21
11
+ ### Added
12
+ - Journal - issn, publisher.
13
+ - Publisher - name.
14
+
15
+ ### Changed
16
+ - Collection - simpler api for count of records available.
17
+
10
18
  ## 0.18.0 - 2016-09-20
11
19
  ### Added
12
20
  - Collection - count of records available.
@@ -118,14 +118,7 @@ module Puree
118
118
  query['rendering'] = @options['rendering']
119
119
  end
120
120
 
121
- # @response = HTTParty.get(build_url, query: query, headers: headers)
122
-
123
121
  begin
124
- # p self.inspect
125
- # p build_url
126
- # p query
127
- # p headers
128
- # @response = HTTParty.get(build_url, query: query, headers: headers, timeout: 120)
129
122
  url = build_url
130
123
  req = HTTP.headers accept: 'application/xml'
131
124
  if @options[:basic_auth]
@@ -136,10 +129,6 @@ module Puree
136
129
  @doc.remove_namespaces!
137
130
 
138
131
  @count = extract_count
139
- # code = @response.code
140
- # body = @response.body
141
- # puts "#{self.class.name} #{code}"
142
- # puts "#{self.class.name} #{body}"
143
132
 
144
133
  rescue HTTP::Error => e
145
134
  puts 'HTTP::Error '+ e.message
@@ -164,11 +153,16 @@ module Puree
164
153
  #
165
154
  # @return [Integer]
166
155
  def count
167
- @count
156
+ @count ||= get_count
168
157
  end
169
158
 
170
159
  private
171
160
 
161
+ def get_count
162
+ find limit: 0
163
+ extract_count
164
+ end
165
+
172
166
  def extract_count
173
167
  path = '//count'
174
168
  xpath_query_for_single_value(path).to_i
@@ -16,6 +16,26 @@ module Puree
16
16
  basic_auth: basic_auth)
17
17
  end
18
18
 
19
+ # ISSN
20
+ #
21
+ # @return [String]
22
+ def issn
23
+ @metadata['issn']
24
+ end
25
+
26
+ # Publisher
27
+ #
28
+ # @return [String]
29
+ def publisher
30
+ @metadata['publisher']
31
+ end
32
+
33
+ # Title
34
+ #
35
+ # @return [String]
36
+ def title
37
+ @metadata['title']
38
+ end
19
39
 
20
40
  # All metadata
21
41
  #
@@ -27,8 +47,26 @@ module Puree
27
47
 
28
48
  private
29
49
 
50
+ def extract_issn
51
+ path = '/issns/issn/string'
52
+ xpath_query_for_single_value path
53
+ end
54
+
55
+ def extract_publisher
56
+ path = '/publisher/name'
57
+ xpath_query_for_single_value path
58
+ end
59
+
60
+ def extract_title
61
+ path = '/titles/title/string'
62
+ xpath_query_for_single_value path
63
+ end
64
+
30
65
  def combine_metadata
31
66
  o = super
67
+ o['issn'] = extract_issn
68
+ o['publisher'] = extract_publisher
69
+ o['title'] = extract_title
32
70
  @metadata = o
33
71
  end
34
72
 
@@ -16,6 +16,21 @@ module Puree
16
16
  basic_auth: basic_auth)
17
17
  end
18
18
 
19
+ # Name
20
+ #
21
+ # @return [String]
22
+ def name
23
+ @metadata['name']
24
+ end
25
+
26
+ # Adds no value as value is Publisher
27
+ # Type
28
+ #
29
+ # @return [String]
30
+ # def type
31
+ # @metadata['type']
32
+ # end
33
+
19
34
  # All metadata
20
35
  #
21
36
  # @return [Hash]
@@ -26,8 +41,21 @@ module Puree
26
41
 
27
42
  private
28
43
 
44
+ def extract_name
45
+ path = '/name'
46
+ xpath_query_for_single_value path
47
+ end
48
+
49
+ # Adds no value as value is Publisher
50
+ # def extract_type
51
+ # path = '/typeClassification/term/localizedString'
52
+ # xpath_query_for_single_value path
53
+ # end
54
+
29
55
  def combine_metadata
30
56
  o = super
57
+ o['name'] = extract_name
58
+ # o['type'] = extract_type
31
59
  @metadata = o
32
60
  end
33
61
 
@@ -1,5 +1,5 @@
1
1
  module Puree
2
2
  # Semantic version number
3
3
  #
4
- VERSION = "0.18.0"
4
+ VERSION = "0.19.0"
5
5
  end
@@ -32,6 +32,10 @@ describe 'Journal' do
32
32
  expect(@p.created).to be_an_instance_of(String)
33
33
  end
34
34
 
35
+ it '#issn' do
36
+ expect(@p.issn).to be_an_instance_of(String)
37
+ end
38
+
35
39
  it '#metadata' do
36
40
  expect(@p.metadata).to be_an_instance_of(Hash)
37
41
  end
@@ -40,6 +44,14 @@ describe 'Journal' do
40
44
  expect(@p.modified).to be_an_instance_of(String)
41
45
  end
42
46
 
47
+ it '#publisher' do
48
+ expect(@p.publisher).to be_an_instance_of(String)
49
+ end
50
+
51
+ it '#title' do
52
+ expect(@p.title).to be_an_instance_of(String)
53
+ end
54
+
43
55
  it '#uuid' do
44
56
  expect(@p.uuid).to be_an_instance_of(String)
45
57
  end
@@ -40,6 +40,15 @@ describe 'Publisher' do
40
40
  expect(@p.modified).to be_an_instance_of(String)
41
41
  end
42
42
 
43
+ it '#name' do
44
+ expect(@p.name).to be_an_instance_of(String)
45
+ end
46
+
47
+ # Adds no value as value is Publisher
48
+ # it '#type' do
49
+ # expect(@p.type).to be_an_instance_of(String)
50
+ # end
51
+
43
52
  it '#uuid' do
44
53
  expect(@p.uuid).to be_an_instance_of(String)
45
54
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: puree
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.18.0
4
+ version: 0.19.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Adrian Albin-Clark
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-20 00:00:00.000000000 Z
11
+ date: 2016-09-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: http