serrano 0.6.0 → 1.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.github/dependabot.yml +22 -0
- data/.github/workflows/ruby.yml +30 -0
- data/.gitignore +1 -1
- data/CHANGELOG.md +14 -0
- data/Gemfile +1 -1
- data/LICENSE +1 -1
- data/README.md +11 -9
- data/Rakefile +22 -20
- data/lib/serrano/cn.rb +4 -4
- data/lib/serrano/cnrequest.rb +34 -48
- data/lib/serrano/faraday.rb +55 -53
- data/lib/serrano/filterhandler.rb +22 -22
- data/lib/serrano/filters.rb +67 -67
- data/lib/serrano/request.rb +29 -32
- data/lib/serrano/request_cursor.rb +48 -52
- data/lib/serrano/styles.rb +17 -17
- data/lib/serrano/utils.rb +8 -9
- data/lib/serrano/version.rb +1 -1
- data/lib/serrano.rb +69 -73
- data/serrano.gemspec +34 -33
- metadata +76 -75
- data/.rubocop.yml +0 -30
- data/.rubocop_todo.yml +0 -105
- data/.travis.yml +0 -11
- data/Gemfile.lock +0 -82
data/lib/serrano/filters.rb
CHANGED
@@ -28,73 +28,73 @@ module Serrano
|
|
28
28
|
end
|
29
29
|
|
30
30
|
FILTER_DETAILS = {
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
96
|
-
|
97
|
-
|
31
|
+
"has_funder" => {"possible_values" => nil, "description" => "metadata which includes one or more funder entry"},
|
32
|
+
"funder" => {"possible_values" => "{funder_id}", "description" => "metadata which include the {funder_id} in FundRef data"},
|
33
|
+
"location" => {"possible_values" => "{country_name}", "description" => "funder records where location = {country name}. Only works on /funders route"},
|
34
|
+
"prefix" => {"possible_values" => "{owner_prefix}", "description" => "metadata belonging to a DOI owner prefix {owner_prefix} (e.g. '10.1016' )"},
|
35
|
+
"member" => {"possible_values" => "{member_id}", "description" => "metadata belonging to a CrossRef member"},
|
36
|
+
"from_index_date" => {"possible_values" => "{date}", "description" => "metadata indexed since (inclusive) {date}"},
|
37
|
+
"until_index_date" => {"possible_values" => "{date}", "description" => "metadata indexed before (inclusive) {date}"},
|
38
|
+
"from_deposit_date" => {"possible_values" => "{date}", "description" => "metadata last (re)deposited since (inclusive) {date}"},
|
39
|
+
"until_deposit_date" => {"possible_values" => "{date}", "description" => "metadata last (re)deposited before (inclusive) {date}"},
|
40
|
+
"from_update_date" => {"possible_values" => "{date}", "description" => "Metadata updated since (inclusive) {date} Currently the same as 'from_deposit_date'"},
|
41
|
+
"until_update_date" => {"possible_values" => "{date}", "description" => "Metadata updated before (inclusive) {date} Currently the same as 'until_deposit_date'"},
|
42
|
+
"from_created_date" => {"possible_values" => "{date}", "description" => "metadata first deposited since (inclusive) {date}"},
|
43
|
+
"until_created_date" => {"possible_values" => "{date}", "description" => "metadata first deposited before (inclusive) {date}"},
|
44
|
+
"from_pub_date" => {"possible_values" => "{date}", "description" => "metadata where published date is since (inclusive) {date}"},
|
45
|
+
"until_pub_date" => {"possible_values" => "{date}", "description" => "metadata where published date is before (inclusive) {date}"},
|
46
|
+
"from_online_pub_date" => {"possible_values" => "{date}", "description" => "metadata where online published date is since (inclusive) {date}"},
|
47
|
+
"until_online_pub_date" => {"possible_values" => "{date}", "description" => "metadata where online published date is before (inclusive) {date}"},
|
48
|
+
"from_print_pub_date" => {"possible_values" => "{date}", "description" => "metadata where print published date is since (inclusive) {date}"},
|
49
|
+
"until_print_pub_date" => {"possible_values" => "{date}", "description" => "metadata where print published date is before (inclusive) {date}"},
|
50
|
+
"from_posted_date" => {"possible_values" => "{date}", "description" => "metadata where posted date is since (inclusive) {date}"},
|
51
|
+
"until_posted_date" => {"possible_values" => "{date}", "description" => "metadata where posted date is before (inclusive) {date}"},
|
52
|
+
"from_accepted_date" => {"possible_values" => "{date}", "description" => "metadata where accepted date is since (inclusive) {date}"},
|
53
|
+
"until_accepted_date" => {"possible_values" => "{date}", "description" => "metadata where accepted date is before (inclusive) {date}"},
|
54
|
+
"has_license" => {"possible_values" => nil, "description" => "metadata that includes any '<license_ref>' elements"},
|
55
|
+
"license_url" => {"possible_values" => "{url}", "description" => "metadata where '<license_ref>' value equals {url}"},
|
56
|
+
"license_version" => {"possible_values" => "{string}", "description" => "metadata where the '<license_ref>''s 'applies_to' attribute is '{string}'"},
|
57
|
+
"license_delay" => {"possible_values" => "{integer}", "description" => "metadata where difference between publication date and the '<license_ref>''s 'start_date' attribute is <= '{integer}' (in days"},
|
58
|
+
"has_full_text" => {"possible_values" => nil, "description" => "metadata that includes any full text '<resource>' elements_"},
|
59
|
+
"full_text_version" => {"possible_values" => "{string}", "description" => "metadata where '<resource>' element's 'content_version' attribute is '{string}'"},
|
60
|
+
"full_text_type" => {"possible_values" => "{mime_type}", "description" => "metadata where '<resource>' element's 'content_type' attribute is '{mime_type}' (e.g. 'application/pdf')"},
|
61
|
+
"full_text_application" => {"possible_values" => "{string}", "description" => "metadata where <resource> link has one of the following intended applications: text-mining, similarity-checking or unspecified"},
|
62
|
+
"has_references" => {"possible_values" => nil, "description" => "metadata for works that have a list of references"},
|
63
|
+
"has_archive" => {"possible_values" => nil, "description" => "metadata which include name of archive partner"},
|
64
|
+
"archive" => {"possible_values" => "{string}", "description" => "metadata which where value of archive partner is '{string}'"},
|
65
|
+
"has_orcid" => {"possible_values" => nil, "description" => "metadata which includes one or more ORCIDs"},
|
66
|
+
"has_authenticated_orcid" => {"possible_values" => nil, "description" => "metadata which includes one or more ORCIDs where the depositing publisher claims to have witness the ORCID owner authenticate with ORCID"},
|
67
|
+
"orcid" => {"possible_values" => "{orcid}", "description" => "metadata where '<orcid>' element's value = '{orcid}'"},
|
68
|
+
"issn" => {"possible_values" => "{issn}", "description" => "metadata where record has an ISSN = '{issn}' Format is 'xxxx_xxxx'."},
|
69
|
+
"directory" => {"possible_values" => "{directory}", "description" => "metadata records whose article or serial are mentioned in the given '{directory}'. Currently the only supported value is 'doaj'"},
|
70
|
+
"doi" => {"possible_values" => "{doi}", "description" => "metadata describing the DOI '{doi}'"},
|
71
|
+
"updates" => {"possible_values" => "{doi}", "description" => "metadata for records that represent editorial updates to the DOI '{doi}'"},
|
72
|
+
"is_update" => {"possible_values" => nil, "description" => "metadata for records that represent editorial updates"},
|
73
|
+
"has_update_policy" => {"possible_values" => nil, "description" => "metadata for records that include a link to an editorial update policy"},
|
74
|
+
"container_title" => {"possible_values" => nil, "description" => "metadata for records with a publication title exactly with an exact match"},
|
75
|
+
"category_name" => {"possible_values" => nil, "description" => "metadata for records with an exact matching category label"},
|
76
|
+
"type" => {"possible_values" => "{type}", "description" => "metadata records whose type = '{type}' Type must be an ID value from the list of types returned by the '/types' resource"},
|
77
|
+
"type_name" => {"possible_values" => nil, "description" => "metadata for records with an exacty matching type label"},
|
78
|
+
"award_number" => {"possible_values" => "{award_number}", "description" => "metadata for records with a matching award nunber_ Optionally combine with 'award_funder'"},
|
79
|
+
"award_funder" => {"possible_values" => "{funder doi or id}", "description" => "metadata for records with an award with matching funder. Optionally combine with 'award_number'"},
|
80
|
+
"has_assertion" => {"possible_values" => nil, "description" => "metadata for records with any assertions"},
|
81
|
+
"assertion_group" => {"possible_values" => nil, "description" => "metadata for records with an assertion in a particular group"},
|
82
|
+
"assertion" => {"possible_values" => nil, "description" => "metadata for records with a particular named assertion"},
|
83
|
+
"has_affiliation" => {"possible_values" => nil, "description" => "metadata for records that have any affiliation information"},
|
84
|
+
"alternative_id" => {"possible_values" => nil, "description" => "metadata for records with the given alternative ID, which may be a publisher_specific ID, or any other identifier a publisher may have provided"},
|
85
|
+
"article_number" => {"possible_values" => nil, "description" => "metadata for records with a given article number"},
|
86
|
+
"has_abstract" => {"possible_values" => nil, "description" => "metadata for records which include an abstract"},
|
87
|
+
"has_clinical_trial_number" => {"possible_values" => nil, "description" => "metadata for records which include a clinical trial number"},
|
88
|
+
"content_domain" => {"possible_values" => nil, "description" => "metadata where the publisher records a particular domain name as the location Crossmark content will appear"},
|
89
|
+
"has_content_domain" => {"possible_values" => nil, "description" => "metadata where the publisher records a domain name location for Crossmark content"},
|
90
|
+
"has_crossmark_restriction" => {"possible_values" => nil, "description" => "metadata where the publisher restricts Crossmark usage to content domains"},
|
91
|
+
"has_relation" => {"possible_values" => nil, "description" => "metadata for records that either assert or are the object of a relation"},
|
92
|
+
"relation_type" => {"possible_values" => nil, "description" => "One of the relation types from the Crossref relations schema (e.g. is-referenced-by, is-parent-of, is-preprint-of)"},
|
93
|
+
"relation_object" => {"possible_values" => nil, "description" => "Relations where the object identifier matches the identifier provided"},
|
94
|
+
"relation_object_type" => {"possible_values" => nil, "description" => "One of the identifier types from the Crossref relations schema (e.g. doi, issn)"},
|
95
|
+
"public_references" => {"possible_values" => nil, "description" => "metadata where publishers allow references to be distributed publically"},
|
96
|
+
"publisher_name" => {"possible_values" => nil, "description" => "metadata for records with an exact matching publisher name"},
|
97
|
+
"affiliation" => {"possible_values" => nil, "description" => "metadata for records with at least one contributor with the given affiliation"}
|
98
98
|
}.freeze
|
99
99
|
end
|
100
100
|
end
|
data/lib/serrano/request.rb
CHANGED
@@ -1,18 +1,18 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
3
|
+
require "erb"
|
4
|
+
require "faraday"
|
5
|
+
require "multi_json"
|
6
|
+
require "serrano/error"
|
7
|
+
require "serrano/utils"
|
8
|
+
require "serrano/helpers/configuration"
|
9
9
|
|
10
10
|
##
|
11
11
|
# Serrano::Request
|
12
12
|
#
|
13
13
|
# Class to perform HTTP requests to the Crossref API
|
14
14
|
module Serrano
|
15
|
-
class Request
|
15
|
+
class Request # :nodoc:
|
16
16
|
attr_accessor :endpt
|
17
17
|
attr_accessor :id
|
18
18
|
attr_accessor :query
|
@@ -30,8 +30,8 @@ module Serrano
|
|
30
30
|
attr_accessor :verbose
|
31
31
|
|
32
32
|
def initialize(endpt, id, query, filter, offset,
|
33
|
-
|
34
|
-
|
33
|
+
limit, sample, sort, order, facet, select,
|
34
|
+
works, agency, options, verbose)
|
35
35
|
|
36
36
|
self.endpt = endpt
|
37
37
|
self.id = id
|
@@ -53,29 +53,26 @@ module Serrano
|
|
53
53
|
def perform
|
54
54
|
filt = filter_handler(filter)
|
55
55
|
|
56
|
-
self.select = select.join(
|
56
|
+
self.select = select&.instance_of?(Array) ? select.join(",") : select
|
57
57
|
|
58
|
-
args = {
|
59
|
-
|
60
|
-
|
61
|
-
select: select }
|
58
|
+
args = {query: query, filter: filt, offset: offset, rows: limit,
|
59
|
+
sample: sample, sort: sort, order: order, facet: facet,
|
60
|
+
select: select}
|
62
61
|
opts = args.delete_if { |_k, v| v.nil? }
|
63
62
|
|
64
63
|
conn = if verbose
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
74
|
-
end
|
75
|
-
end
|
64
|
+
Faraday.new(url: Serrano.base_url, request: options || {}) do |f|
|
65
|
+
f.response :logger
|
66
|
+
f.use Faraday::SerranoErrors::Middleware
|
67
|
+
end
|
68
|
+
else
|
69
|
+
Faraday.new(url: Serrano.base_url, request: options || {}) do |f|
|
70
|
+
f.use Faraday::SerranoErrors::Middleware
|
71
|
+
end
|
72
|
+
end
|
76
73
|
|
77
74
|
conn.headers[:user_agent] = make_ua
|
78
|
-
conn.headers[
|
75
|
+
conn.headers["X-USER-AGENT"] = make_ua
|
79
76
|
|
80
77
|
if id.nil?
|
81
78
|
res = conn.get endpt, opts
|
@@ -87,12 +84,12 @@ module Serrano
|
|
87
84
|
coll = []
|
88
85
|
id.each do |x|
|
89
86
|
endpt = if works
|
90
|
-
|
91
|
-
|
92
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
87
|
+
self.endpt + "/" + x.to_s + "/works"
|
88
|
+
elsif agency
|
89
|
+
self.endpt + "/" + x.to_s + "/agency"
|
90
|
+
else
|
91
|
+
self.endpt + "/" + x.to_s
|
92
|
+
end
|
96
93
|
|
97
94
|
res = conn.get endpt, opts
|
98
95
|
coll << MultiJson.load(res.body)
|
@@ -1,22 +1,20 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
5
|
-
require
|
6
|
-
require
|
7
|
-
require
|
8
|
-
require
|
9
|
-
require
|
10
|
-
require
|
11
|
-
require 'serrano/faraday'
|
12
|
-
require 'serrano/utils'
|
3
|
+
require "erb"
|
4
|
+
require "faraday"
|
5
|
+
require "multi_json"
|
6
|
+
require "serrano/error"
|
7
|
+
require "serrano/helpers/configuration"
|
8
|
+
require "serrano/filterhandler"
|
9
|
+
require "serrano/faraday"
|
10
|
+
require "serrano/utils"
|
13
11
|
|
14
12
|
##
|
15
13
|
# Serrano::RequestCursor
|
16
14
|
#
|
17
15
|
# Class to perform HTTP requests to the Crossref API
|
18
16
|
module Serrano
|
19
|
-
class RequestCursor
|
17
|
+
class RequestCursor # :nodoc:
|
20
18
|
attr_accessor :endpt
|
21
19
|
attr_accessor :id
|
22
20
|
attr_accessor :query
|
@@ -37,9 +35,9 @@ module Serrano
|
|
37
35
|
attr_accessor :args
|
38
36
|
|
39
37
|
def initialize(endpt, id, query, filter, offset,
|
40
|
-
|
41
|
-
|
42
|
-
|
38
|
+
limit, sample, sort, order, facet, select,
|
39
|
+
works, agency, options, verbose, cursor,
|
40
|
+
cursor_max, args)
|
43
41
|
|
44
42
|
self.endpt = endpt
|
45
43
|
self.id = id
|
@@ -64,42 +62,40 @@ module Serrano
|
|
64
62
|
def perform
|
65
63
|
filt = filter_handler(filter)
|
66
64
|
fieldqueries = field_query_handler(args)
|
67
|
-
self.select = select.join(
|
65
|
+
self.select = select&.instance_of?(Array) ? select.join(",") : select
|
68
66
|
|
69
67
|
unless cursor_max.class.nil?
|
70
|
-
raise
|
68
|
+
raise "cursor_max must be of class int" unless cursor_max.is_a?(Integer)
|
71
69
|
end
|
72
70
|
|
73
|
-
arguments = {
|
74
|
-
|
75
|
-
|
76
|
-
|
71
|
+
arguments = {query: query, filter: filt, offset: offset,
|
72
|
+
rows: limit, sample: sample, sort: sort,
|
73
|
+
order: order, facet: facet, select: select,
|
74
|
+
cursor: cursor}.tostrings
|
77
75
|
arguments = arguments.merge(fieldqueries)
|
78
76
|
opts = arguments.delete_if { |_k, v| v.nil? }
|
79
77
|
|
80
78
|
conn = if verbose
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
end
|
91
|
-
end
|
79
|
+
Faraday.new(url: Serrano.base_url, request: options || {}) do |f|
|
80
|
+
f.response :logger
|
81
|
+
f.use Faraday::SerranoErrors::Middleware
|
82
|
+
end
|
83
|
+
else
|
84
|
+
Faraday.new(url: Serrano.base_url, request: options || {}) do |f|
|
85
|
+
f.use Faraday::SerranoErrors::Middleware
|
86
|
+
end
|
87
|
+
end
|
92
88
|
|
93
89
|
conn.headers[:user_agent] = make_ua
|
94
|
-
conn.headers[
|
90
|
+
conn.headers["X-USER-AGENT"] = make_ua
|
95
91
|
|
96
92
|
if id.nil?
|
97
93
|
endpt2 = endpt
|
98
94
|
js = _req(conn, endpt, opts)
|
99
|
-
cu = js[
|
100
|
-
max_avail = js[
|
101
|
-
|
102
|
-
|
95
|
+
cu = js["message"]["next-cursor"]
|
96
|
+
max_avail = js["message"]["total-results"]
|
97
|
+
_redo_req(conn, js, opts, cu, max_avail, endpt2)
|
98
|
+
|
103
99
|
else
|
104
100
|
self.id = Array(id)
|
105
101
|
# url encoding
|
@@ -107,34 +103,34 @@ module Serrano
|
|
107
103
|
coll = []
|
108
104
|
id.each do |x|
|
109
105
|
endpt2 = if works
|
110
|
-
|
111
|
-
|
112
|
-
|
113
|
-
|
114
|
-
|
115
|
-
|
116
|
-
|
117
|
-
|
106
|
+
endpt + "/" + x.to_s + "/works"
|
107
|
+
else
|
108
|
+
endpt2 = if agency
|
109
|
+
endpt + "/" + x.to_s + "/agency"
|
110
|
+
else
|
111
|
+
endpt + "/" + x.to_s
|
112
|
+
end
|
113
|
+
end
|
118
114
|
|
119
115
|
js = _req(conn, endpt2, opts)
|
120
|
-
cu = js[
|
121
|
-
max_avail = js[
|
122
|
-
coll << _redo_req(conn, js, opts, cu, max_avail)
|
116
|
+
cu = js["message"]["next-cursor"]
|
117
|
+
max_avail = js["message"]["total-results"]
|
118
|
+
coll << _redo_req(conn, js, opts, cu, max_avail, endpt2)
|
123
119
|
end
|
124
120
|
coll
|
125
121
|
end
|
126
122
|
end
|
127
123
|
|
128
|
-
def _redo_req(conn, js, opts, cu, max_avail)
|
129
|
-
if !cu.nil? && (cursor_max > js[
|
124
|
+
def _redo_req(conn, js, opts, cu, max_avail, endpt2)
|
125
|
+
if !cu.nil? && (cursor_max > js["message"]["items"].length)
|
130
126
|
res = [js]
|
131
|
-
total = js[
|
127
|
+
total = js["message"]["items"].length
|
132
128
|
while !cu.nil? && (cursor_max > total) && (total < max_avail)
|
133
129
|
opts[:cursor] = cu
|
134
130
|
out = _req(conn, endpt2, opts)
|
135
|
-
cu = out[
|
131
|
+
cu = out["message"]["next-cursor"]
|
136
132
|
res << out
|
137
|
-
total = res.collect { |x| x[
|
133
|
+
total = res.collect { |x| x["message"]["items"].length }.sum
|
138
134
|
end
|
139
135
|
res
|
140
136
|
else
|
data/lib/serrano/styles.rb
CHANGED
@@ -1,28 +1,28 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require
|
4
|
-
require
|
3
|
+
require "faraday"
|
4
|
+
require "multi_json"
|
5
5
|
|
6
6
|
def fetch_styles
|
7
|
-
base =
|
8
|
-
conn = Faraday.new(url: base)
|
9
|
-
f.use
|
10
|
-
f.adapter Faraday.default_adapter
|
11
|
-
|
12
|
-
args = {
|
13
|
-
tt = conn.get
|
7
|
+
base = "https://api.github.com/repos/citation-style-language/styles"
|
8
|
+
conn = Faraday.new(url: base) { |f|
|
9
|
+
f.use Faraday::Response::RaiseError
|
10
|
+
# f.adapter Faraday.default_adapter
|
11
|
+
}
|
12
|
+
args = {per_page: 1}
|
13
|
+
tt = conn.get "commits", args
|
14
14
|
commres = MultiJson.load(tt.body)
|
15
|
-
sha = commres[0][
|
16
|
-
sty = conn.get
|
15
|
+
sha = commres[0]["sha"]
|
16
|
+
sty = conn.get "git/trees/" + sha
|
17
17
|
res = MultiJson.load(sty.body)
|
18
|
-
files = res[
|
19
|
-
matches = files.collect
|
20
|
-
if x.match(
|
18
|
+
files = res["tree"].collect { |x| x["path"] }
|
19
|
+
matches = files.collect { |x|
|
20
|
+
if x.match("csl").nil?
|
21
21
|
nil
|
22
22
|
else
|
23
|
-
x.match(
|
23
|
+
x.match("csl").string
|
24
24
|
end
|
25
|
-
|
25
|
+
}
|
26
26
|
csls = matches.compact
|
27
|
-
csls.collect { |z| z.gsub(
|
27
|
+
csls.collect { |z| z.gsub(".csl", "") }
|
28
28
|
end
|
data/lib/serrano/utils.rb
CHANGED
@@ -1,11 +1,11 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
3
|
def make_ua
|
4
|
-
requa =
|
5
|
-
habua =
|
6
|
-
ua = requa +
|
4
|
+
requa = "Faraday/v" + Faraday::VERSION
|
5
|
+
habua = "Serrano/v" + Serrano::VERSION
|
6
|
+
ua = requa + " " + habua
|
7
7
|
if Serrano.mailto
|
8
|
-
ua
|
8
|
+
ua += " (mailto:%s)" % Serrano.mailto
|
9
9
|
end
|
10
10
|
# ua += format(' (mailto:%s)', Serrano.mailto) if Serrano.mailto
|
11
11
|
ua
|
@@ -18,19 +18,18 @@ end
|
|
18
18
|
|
19
19
|
def rename_query_filters(foo)
|
20
20
|
foo = foo.tostrings
|
21
|
-
foo = foo.map { |x, y| [x.to_s.sub(
|
22
|
-
foo
|
23
|
-
foo
|
21
|
+
foo = foo.map { |x, y| [x.to_s.sub("container_title", "container-title"), y] }.to_h
|
22
|
+
foo.map { |x, y| [x.to_s.sub("query_", "query."), y] }.to_h
|
24
23
|
end
|
25
24
|
|
26
25
|
class Hash
|
27
26
|
def tostrings
|
28
|
-
|
27
|
+
map { |(k, v)| [k.to_s, v] }.to_h
|
29
28
|
end
|
30
29
|
end
|
31
30
|
|
32
31
|
class Hash
|
33
32
|
def tosymbols
|
34
|
-
|
33
|
+
map { |(k, v)| [k.to_sym, v] }.to_h
|
35
34
|
end
|
36
35
|
end
|
data/lib/serrano/version.rb
CHANGED