serrano 0.5.0 → 1.0.0

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.
@@ -1,8 +0,0 @@
1
- language: ruby
2
- cache: bundler
3
- rvm:
4
- - 2.1.8
5
- - 2.2.4
6
- - 2.5.0
7
- script:
8
- bundle exec rake test TESTOPTS="-v"
@@ -1,64 +0,0 @@
1
- PATH
2
- remote: .
3
- specs:
4
- serrano (0.5.0)
5
- faraday (~> 0.14.0)
6
- faraday_middleware (~> 0.12.2)
7
- multi_json (~> 1.13, >= 1.13.1)
8
- thor (~> 0.20.0)
9
-
10
- GEM
11
- remote: https://rubygems.org/
12
- specs:
13
- addressable (2.5.2)
14
- public_suffix (>= 2.0.2, < 4.0)
15
- codecov (0.1.10)
16
- json
17
- simplecov
18
- url
19
- crack (0.4.3)
20
- safe_yaml (~> 1.0.0)
21
- docile (1.3.0)
22
- faraday (0.14.0)
23
- multipart-post (>= 1.2, < 3)
24
- faraday_middleware (0.12.2)
25
- faraday (>= 0.7.4, < 1.0)
26
- hashdiff (0.3.7)
27
- json (2.1.0)
28
- multi_json (1.13.1)
29
- multipart-post (2.0.0)
30
- power_assert (1.1.1)
31
- public_suffix (3.0.2)
32
- rake (12.3.1)
33
- safe_yaml (1.0.4)
34
- simplecov (0.16.1)
35
- docile (~> 1.1)
36
- json (>= 1.8, < 3)
37
- simplecov-html (~> 0.10.0)
38
- simplecov-html (0.10.2)
39
- test-unit (3.2.7)
40
- power_assert
41
- thor (0.20.0)
42
- url (0.3.2)
43
- vcr (4.0.0)
44
- webmock (3.3.0)
45
- addressable (>= 2.3.6)
46
- crack (>= 0.3.2)
47
- hashdiff
48
-
49
- PLATFORMS
50
- ruby
51
-
52
- DEPENDENCIES
53
- bundler (~> 1.16, >= 1.16.1)
54
- codecov (~> 0.1.10)
55
- json (~> 2.1)
56
- rake (~> 12.3, >= 12.3.1)
57
- serrano!
58
- simplecov (~> 0.16.1)
59
- test-unit (~> 3.2, >= 3.2.7)
60
- vcr (~> 4.0)
61
- webmock (~> 3.3)
62
-
63
- BUNDLED WITH
64
- 1.16.1
@@ -1,36 +0,0 @@
1
- require 'net/http'
2
-
3
- NETWORKABLE_EXCEPTIONS = [Faraday::Error::ClientError,
4
- URI::InvalidURIError,
5
- Encoding::UndefinedConversionError,
6
- ArgumentError,
7
- NoMethodError,
8
- TypeError]
9
-
10
- $cn_formats = ["rdf-xml", "turtle", "citeproc-json",
11
- "citeproc-json-ish", "text", "ris", "bibtex",
12
- "crossref-xml", "datacite-xml", "bibentry",
13
- "crossref-tdm"]
14
-
15
- $cn_format_headers = {"rdf-xml" => "application/rdf+xml",
16
- "turtle" => "text/turtle",
17
- "citeproc-json" => "transform/application/vnd.citationstyles.csl+json",
18
- "text" => "text/x-bibliography",
19
- "ris" => "application/x-research-info-systems",
20
- "bibtex" => "application/x-bibtex",
21
- "crossref-xml" => "application/vnd.crossref.unixref+xml",
22
- "datacite-xml" => "application/vnd.datacite.datacite+xml",
23
- "bibentry" => "application/x-bibtex",
24
- "crossref-tdm" => "application/vnd.crossref.unixsd+xml"}
25
-
26
- $cn_types = {"rdf-xml" => "text/xml",
27
- "turtle" => "text/plain",
28
- "citeproc-json" => "application/json",
29
- "citeproc-json-ish" => "application/json",
30
- "text" => "text/plain",
31
- "ris" => "text/plain",
32
- "bibtex" => "text/plain",
33
- "crossref-xml" => "text/xml",
34
- "datacite-xml" => "text/xml",
35
- "bibentry" => "text/plain",
36
- "crossref-tdm" => "text/xml"}
@@ -1,52 +0,0 @@
1
- require 'faraday'
2
- require "multi_json"
3
-
4
- query = "widget"
5
- cursor = "*"
6
- limit = 100
7
- cursor_max = 500
8
- rows = limit
9
-
10
- filter = nil
11
- offset = nil
12
- sample = nil
13
- sort = nil
14
- order = nil
15
- facet = nil
16
-
17
- args = { query: query, filter: filter, offset: offset,
18
- rows: limit, sample: sample, sort: sort,
19
- order: order, facet: facet, cursor: cursor }
20
- opts = args.delete_if { |k, v| v.nil? }
21
-
22
- conn = Faraday.new(:url => "http://api.crossref.org/", :request => nil)
23
-
24
- def _req(conn, path, opts)
25
- res = conn.get path, opts
26
- return MultiJson.load(res.body)
27
- end
28
-
29
- def _redo_req(conn, path, js, opts, cu, max_avail, cursor_max)
30
- if !cu.nil? and cursor_max > js['message']['items'].length
31
- res = [js]
32
- total = js['message']['items'].length
33
- while (!cu.nil? and cursor_max > total and total < max_avail)
34
- opts[:cursor] = cu
35
- out = _req(conn, path, opts)
36
- cu = out['message']['next-cursor']
37
- res << out
38
- total = res.collect { |x| x['message']['items'].length }.inject(:+)
39
- end
40
- return res
41
- else
42
- return js
43
- end
44
- end
45
-
46
- path = 'works'
47
-
48
- js = _req(conn, path, opts)
49
- cu = js['message']['next-cursor']
50
- max_avail = js['message']['total-results']
51
- res = _redo_req(conn, path, js, opts, cu, max_avail, cursor_max)
52
-