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 +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +0 -14
- data/lib/serrano.rb +0 -4
- data/lib/serrano/version.rb +1 -1
- metadata +1 -3
- data/lib/serrano/link_methods_array.rb +0 -51
- data/lib/serrano/link_methods_hash.rb +0 -46
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ced6b8bd574ca8a373c61dc9f239499817e27bf8
|
4
|
+
data.tar.gz: ab478119cc61771107057f55f07bea2653a611e0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 029c66c10b76af77eeeba4a76d58552b8de60eb97b310eb0ee7610a9c47726ee9a6a403a15330ea983b4fed2d6396e50a57709445998d5c6a5cc661b61edba13
|
7
|
+
data.tar.gz: fc940b4c0375aaac5d234aecf5e0939d8c017e8c05629f1f61db97c593ef619cf0b8967c98158b00dd78b029b737fc484e9bac72f2d80c510b468e2dedff5b33
|
data/Gemfile.lock
CHANGED
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
|
#
|
data/lib/serrano/version.rb
CHANGED
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
|