serrano 0.1.4 → 0.1.4.1

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: ecc2b22a17fb2e658070f687b18232a534a33f7a
4
- data.tar.gz: c24446bd652f48cd806319914a4ce15dd3b20565
3
+ metadata.gz: ced6b8bd574ca8a373c61dc9f239499817e27bf8
4
+ data.tar.gz: ab478119cc61771107057f55f07bea2653a611e0
5
5
  SHA512:
6
- metadata.gz: 2542e1fe55dcaac00e62afb198f59ada4691cd44f347d2364528d282cdda1768cb303495cc5d2e1e82b22e7a281a846fef2b3185129e14c391f1f43de75e6c6a
7
- data.tar.gz: 0ed3050c3ab2c7ef709902893bc4c334996f248b72d43d50a6228323664f1c92a3083a1edba6b2bca87417e00e8dba034e2acff20290627b7c441b97c53b614a
6
+ metadata.gz: 029c66c10b76af77eeeba4a76d58552b8de60eb97b310eb0ee7610a9c47726ee9a6a403a15330ea983b4fed2d6396e50a57709445998d5c6a5cc661b61edba13
7
+ data.tar.gz: fc940b4c0375aaac5d234aecf5e0939d8c017e8c05629f1f61db97c593ef619cf0b8967c98158b00dd78b029b737fc484e9bac72f2d80c510b468e2dedff5b33
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- serrano (0.1.4)
4
+ serrano (0.1.4.1)
5
5
  faraday (~> 0.9.1)
6
6
  faraday_middleware (~> 0.10.0)
7
7
  multi_json (~> 1.0)
data/README.md CHANGED
@@ -86,20 +86,6 @@ Search works by query string
86
86
  Serrano.works(query: "ecology")
87
87
  ```
88
88
 
89
- Get links
90
-
91
- ```ruby
92
- res = Serrano.works(filter: {has_full_text: true})
93
- # entire links metadata
94
- res.links
95
- # just links URLs
96
- res.links(true)
97
- # just xml links, if present
98
- res.links_xml(true)
99
- # just pdf links, if present
100
- res.links_pdf
101
- ```
102
-
103
89
  Search journals by publisher name
104
90
 
105
91
  ```ruby
data/lib/serrano.rb CHANGED
@@ -4,8 +4,6 @@ require "serrano/filterhandler"
4
4
  require "serrano/cnrequest"
5
5
  require "serrano/filters"
6
6
  require "serrano/styles"
7
- require "serrano/link_methods_hash"
8
- require "serrano/link_methods_array"
9
7
 
10
8
  require 'rexml/document'
11
9
  require 'rexml/xpath'
@@ -95,8 +93,6 @@ module Serrano
95
93
  # # Filters
96
94
  # Serrano.works(filter: {has_full_text: true})
97
95
  # res = Serrano.works(filter: {has_full_text: true})
98
- # res.links # entire links metadata
99
- # res.links(true) # just links URLs
100
96
  # Serrano.works(filter: {has_funder: true, has_full_text: true})
101
97
  # Serrano.works(filter: {award_number: 'CBET-0756451', award_funder: '10.13039/100000001'})
102
98
  #
@@ -1,3 +1,3 @@
1
1
  module Serrano
2
- VERSION = "0.1.4"
2
+ VERSION = "0.1.4.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: serrano
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.1.4.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Scott Chamberlain
@@ -181,8 +181,6 @@ files:
181
181
  - lib/serrano/filterhandler.rb
182
182
  - lib/serrano/filters.rb
183
183
  - lib/serrano/helpers/configuration.rb
184
- - lib/serrano/link_methods_array.rb
185
- - lib/serrano/link_methods_hash.rb
186
184
  - lib/serrano/request.rb
187
185
  - lib/serrano/styles.rb
188
186
  - lib/serrano/version.rb
@@ -1,51 +0,0 @@
1
- # Array methods
2
- class Array
3
- def links(just_urls = false)
4
- return self.collect{ |x| x.links(just_urls) }.flatten
5
- # if temp.length == 1
6
- # return tmp[0]
7
- # else
8
- # return tmp
9
- # end
10
- # tmp = self.collect{ |x| x['message']['link'] }
11
- # return parse_link(tmp, just_urls)
12
- end
13
- end
14
-
15
- class Array
16
- def links_xml(just_urls = false)
17
- return parse_link(self.collect { |z| z.links_xml }[0], just_urls)
18
- # return parse_link(pull_link(self, '^application\/xml$|^text\/xml$'), just_urls)
19
- end
20
- end
21
-
22
- class Array
23
- def links_pdf(just_urls = false)
24
- return parse_link(self.collect { |z| z.links_pdf }[0], just_urls)
25
- # return parse_link(pull_link(self, '^application\/pdf$'), just_urls)
26
- end
27
- end
28
-
29
- class Array
30
- def links_plain(just_urls = false)
31
- return parse_link(self.collect { |z| z.links_plain }[0], just_urls)
32
- # return parse_link(pull_link(self, '^application\/plain$|^text\/plain$'), just_urls)
33
- end
34
- end
35
-
36
- def pull_link(x, y)
37
- return x.collect { |z| z.links_xml }[0]
38
- # return x.collect { |z| z['message']['link'] }.compact.collect { |z| z.compact.select { |w| w['content-type'].match(/#{y}/) } }
39
- end
40
-
41
- def parse_link(x, just_urls)
42
- if x.nil?
43
- return x
44
- else
45
- if just_urls
46
- return x.compact.collect { |z| z.collect{ |y| y['URL'] }}.flatten
47
- else
48
- return x
49
- end
50
- end
51
- end
@@ -1,46 +0,0 @@
1
- # Hash methods
2
- class Hash
3
- def links(just_urls = false)
4
- if self['message']['items'].nil?
5
- tmp = self['message']['link'].reject { |c| c.empty? }
6
- else
7
- tmp = self['message']['items'].collect { |x| x['link'] }.reject { |c| c.empty? }
8
- end
9
-
10
- return parse_links(tmp, just_urls)
11
- end
12
- end
13
-
14
- class Hash
15
- def links_xml(just_urls = false)
16
- return parse_links(pull_links(self, '^application\/xml$|^text\/xml$'), just_urls)
17
- end
18
- end
19
-
20
- class Hash
21
- def links_pdf(just_urls = false)
22
- return parse_links(pull_links(self, '^application\/pdf$'), just_urls)
23
- end
24
- end
25
-
26
- class Hash
27
- def links_plain(just_urls = false)
28
- return parse_links(pull_links(self, '^application\/plain$|^text\/plain$'), just_urls)
29
- end
30
- end
31
-
32
- def pull_links(x, y)
33
- return x['message']['items'].collect { |x| x['link'].select { |z| z['content-type'].match(/#{y}/) } }.reject { |c| c.empty? }
34
- end
35
-
36
- def parse_links(x, just_urls)
37
- if x.empty?
38
- return x
39
- else
40
- if just_urls
41
- return x.collect { |x| x.collect { |z| z['URL'] }}.flatten
42
- else
43
- return x
44
- end
45
- end
46
- end