met_museum 1.4.1 → 1.4.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/ruby.yml +1 -1
- data/.rbgithook/pre-commit +2 -0
- data/.ruby-version +1 -0
- data/Gemfile +2 -0
- data/Gemfile.lock +37 -43
- data/README.md +1 -1
- data/lib/met_museum/collection.rb +13 -10
- data/lib/met_museum/http_status_code.rb +4 -2
- data/lib/met_museum/version.rb +1 -1
- data/met_museum.gemspec +0 -3
- metadata +5 -32
- data/.travis.yml +0 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 45f5c8d43daa6e64da5cb3c6788ee090c82070d84d9dbca31afb0bb3463dfcdc
|
4
|
+
data.tar.gz: 2bbbf5262f1bef794f6af6b7656903d17b1b9b11b5b37679a49a6abb852a6818
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03053e41e8aa40ab045f480a7bfbe0bfb38a2a909d5776f937938acec59afc3d964cb508e5756de2e11ae123059718659a8e4bcd74247e3eb84837c6ba9d9b9b
|
7
|
+
data.tar.gz: 214a6dd1cbeb31b8aa221fe794c7f3bcda4af5ef6ab41498830c8e4cd0582c2d7ea30178eff241f0c177ee618ab40dc577e1fbaa7492a2ecbadc0378bcffa13b
|
data/.github/workflows/ruby.yml
CHANGED
data/.ruby-version
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
3.1.0
|
data/Gemfile
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,61 +1,54 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
met_museum (1.4.
|
5
|
-
faraday
|
6
|
-
oj
|
4
|
+
met_museum (1.4.2)
|
7
5
|
|
8
6
|
GEM
|
9
7
|
remote: https://rubygems.org/
|
10
8
|
specs:
|
11
|
-
ast (2.4.
|
12
|
-
coderay (1.1.
|
13
|
-
diff-lcs (1.
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
method_source (0.9.2)
|
18
|
-
multipart-post (2.1.1)
|
19
|
-
oj (3.10.6)
|
20
|
-
parallel (1.19.2)
|
21
|
-
parser (2.7.1.4)
|
9
|
+
ast (2.4.2)
|
10
|
+
coderay (1.1.3)
|
11
|
+
diff-lcs (1.5.0)
|
12
|
+
method_source (1.0.0)
|
13
|
+
parallel (1.22.1)
|
14
|
+
parser (3.1.2.0)
|
22
15
|
ast (~> 2.4.1)
|
23
|
-
pry (0.
|
24
|
-
coderay (~> 1.1
|
25
|
-
method_source (~>
|
26
|
-
rainbow (3.
|
27
|
-
rake (13.0.
|
28
|
-
|
16
|
+
pry (0.14.1)
|
17
|
+
coderay (~> 1.1)
|
18
|
+
method_source (~> 1.0)
|
19
|
+
rainbow (3.1.1)
|
20
|
+
rake (13.0.6)
|
21
|
+
rbgithook (0.1.2)
|
22
|
+
regexp_parser (2.5.0)
|
29
23
|
rexml (3.2.5)
|
30
|
-
rspec (3.
|
31
|
-
rspec-core (~> 3.
|
32
|
-
rspec-expectations (~> 3.
|
33
|
-
rspec-mocks (~> 3.
|
34
|
-
rspec-core (3.
|
35
|
-
rspec-support (~> 3.
|
36
|
-
rspec-expectations (3.
|
24
|
+
rspec (3.11.0)
|
25
|
+
rspec-core (~> 3.11.0)
|
26
|
+
rspec-expectations (~> 3.11.0)
|
27
|
+
rspec-mocks (~> 3.11.0)
|
28
|
+
rspec-core (3.11.0)
|
29
|
+
rspec-support (~> 3.11.0)
|
30
|
+
rspec-expectations (3.11.0)
|
37
31
|
diff-lcs (>= 1.2.0, < 2.0)
|
38
|
-
rspec-support (~> 3.
|
39
|
-
rspec-mocks (3.
|
32
|
+
rspec-support (~> 3.11.0)
|
33
|
+
rspec-mocks (3.11.1)
|
40
34
|
diff-lcs (>= 1.2.0, < 2.0)
|
41
|
-
rspec-support (~> 3.
|
42
|
-
rspec-retry (0.6.
|
35
|
+
rspec-support (~> 3.11.0)
|
36
|
+
rspec-retry (0.6.2)
|
43
37
|
rspec-core (> 3.3)
|
44
|
-
rspec-support (3.
|
45
|
-
rubocop (
|
38
|
+
rspec-support (3.11.0)
|
39
|
+
rubocop (1.30.1)
|
46
40
|
parallel (~> 1.10)
|
47
|
-
parser (>=
|
41
|
+
parser (>= 3.1.0.0)
|
48
42
|
rainbow (>= 2.2.2, < 4.0)
|
49
|
-
regexp_parser (>= 1.
|
50
|
-
rexml
|
51
|
-
rubocop-ast (>=
|
43
|
+
regexp_parser (>= 1.8, < 3.0)
|
44
|
+
rexml (>= 3.2.5, < 4.0)
|
45
|
+
rubocop-ast (>= 1.18.0, < 2.0)
|
52
46
|
ruby-progressbar (~> 1.7)
|
53
|
-
unicode-display_width (>= 1.4.0, <
|
54
|
-
rubocop-ast (
|
55
|
-
parser (>=
|
56
|
-
ruby-progressbar (1.
|
57
|
-
|
58
|
-
unicode-display_width (1.7.0)
|
47
|
+
unicode-display_width (>= 1.4.0, < 3.0)
|
48
|
+
rubocop-ast (1.18.0)
|
49
|
+
parser (>= 3.1.1.0)
|
50
|
+
ruby-progressbar (1.11.0)
|
51
|
+
unicode-display_width (2.1.0)
|
59
52
|
|
60
53
|
PLATFORMS
|
61
54
|
ruby
|
@@ -65,6 +58,7 @@ DEPENDENCIES
|
|
65
58
|
met_museum!
|
66
59
|
pry
|
67
60
|
rake (~> 13.0)
|
61
|
+
rbgithook (~> 0.1.2)
|
68
62
|
rspec (~> 3.0)
|
69
63
|
rspec-retry
|
70
64
|
rubocop
|
data/README.md
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
<img src="https://img.shields.io/
|
1
|
+
<img src="https://img.shields.io/github/workflow/status/hyuraku/rbgithook/Ruby"> <img src="https://img.shields.io/github/license/hyuraku/met_museum.svg">
|
2
2
|
<img src="https://img.shields.io/gem/v/met_museum.svg">
|
3
3
|
# MetMuseum
|
4
4
|
|
@@ -1,10 +1,6 @@
|
|
1
|
-
require "met_museum/api_expections"
|
2
1
|
require "met_museum/endpoint"
|
3
2
|
require "met_museum/http_status_code"
|
4
3
|
|
5
|
-
require "faraday"
|
6
|
-
require "oj"
|
7
|
-
|
8
4
|
module MetMuseum
|
9
5
|
class Collection
|
10
6
|
# Return a listing of all valid Object IDs available to use
|
@@ -116,12 +112,17 @@ module MetMuseum
|
|
116
112
|
|
117
113
|
private
|
118
114
|
|
119
|
-
def create_request(url, dir, params =
|
120
|
-
|
115
|
+
def create_request(url, dir, params = {})
|
116
|
+
require 'uri'
|
117
|
+
require 'net/http'
|
118
|
+
|
119
|
+
uri = URI.join(url, dir)
|
120
|
+
uri.query = URI.encode_www_form(params)
|
121
|
+
Net::HTTP.get_response(uri)
|
121
122
|
end
|
122
123
|
|
123
|
-
def response_successful?(
|
124
|
-
|
124
|
+
def response_successful?(response_code)
|
125
|
+
response_code == HTTP_OK_CODE
|
125
126
|
end
|
126
127
|
|
127
128
|
def check_date(date)
|
@@ -132,9 +133,11 @@ module MetMuseum
|
|
132
133
|
end
|
133
134
|
|
134
135
|
def arrange_response(response)
|
135
|
-
|
136
|
+
response_code = response.code.to_i
|
137
|
+
require 'json'
|
138
|
+
return JSON.parse(response.body) if response_successful?(response_code)
|
136
139
|
|
137
|
-
raise MetMuseum.error_class(
|
140
|
+
raise MetMuseum.error_class(response_code), "Code: #{response_code}, response: #{response.body}"
|
138
141
|
end
|
139
142
|
|
140
143
|
def multi_option
|
@@ -1,3 +1,5 @@
|
|
1
|
+
require "met_museum/api_expections"
|
2
|
+
|
1
3
|
module MetMuseum
|
2
4
|
HTTP_OK_CODE = 200
|
3
5
|
HTTP_BAD_REQUEST_CODE = 400
|
@@ -6,8 +8,8 @@ module MetMuseum
|
|
6
8
|
HTTP_NOT_FOUND_CODE = 404
|
7
9
|
HTTP_UNPROCESSABLE_ENTITY_CODE = 429
|
8
10
|
|
9
|
-
def self.error_class(
|
10
|
-
case
|
11
|
+
def self.error_class(response_code)
|
12
|
+
case response_code
|
11
13
|
when HTTP_BAD_REQUEST_CODE
|
12
14
|
BadRequestError
|
13
15
|
when HTTP_UNAUTHORIZED_CODE
|
data/lib/met_museum/version.rb
CHANGED
data/met_museum.gemspec
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: met_museum
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.4.
|
4
|
+
version: 1.4.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hyuraku
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2022-
|
11
|
+
date: 2022-11-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -80,34 +80,6 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
-
- !ruby/object:Gem::Dependency
|
84
|
-
name: faraday
|
85
|
-
requirement: !ruby/object:Gem::Requirement
|
86
|
-
requirements:
|
87
|
-
- - ">="
|
88
|
-
- !ruby/object:Gem::Version
|
89
|
-
version: '0'
|
90
|
-
type: :runtime
|
91
|
-
prerelease: false
|
92
|
-
version_requirements: !ruby/object:Gem::Requirement
|
93
|
-
requirements:
|
94
|
-
- - ">="
|
95
|
-
- !ruby/object:Gem::Version
|
96
|
-
version: '0'
|
97
|
-
- !ruby/object:Gem::Dependency
|
98
|
-
name: oj
|
99
|
-
requirement: !ruby/object:Gem::Requirement
|
100
|
-
requirements:
|
101
|
-
- - ">="
|
102
|
-
- !ruby/object:Gem::Version
|
103
|
-
version: '0'
|
104
|
-
type: :runtime
|
105
|
-
prerelease: false
|
106
|
-
version_requirements: !ruby/object:Gem::Requirement
|
107
|
-
requirements:
|
108
|
-
- - ">="
|
109
|
-
- !ruby/object:Gem::Version
|
110
|
-
version: '0'
|
111
83
|
description: 'The Metropolitan Museum of Art Collection API wrapper '
|
112
84
|
email:
|
113
85
|
- calenthird@gamil.com
|
@@ -117,9 +89,10 @@ extra_rdoc_files: []
|
|
117
89
|
files:
|
118
90
|
- ".github/workflows/ruby.yml"
|
119
91
|
- ".gitignore"
|
92
|
+
- ".rbgithook/pre-commit"
|
120
93
|
- ".rspec"
|
121
94
|
- ".rubocop.yml"
|
122
|
-
- ".
|
95
|
+
- ".ruby-version"
|
123
96
|
- CODE_OF_CONDUCT.md
|
124
97
|
- Gemfile
|
125
98
|
- Gemfile.lock
|
@@ -155,7 +128,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
155
128
|
- !ruby/object:Gem::Version
|
156
129
|
version: '0'
|
157
130
|
requirements: []
|
158
|
-
rubygems_version: 3.3.
|
131
|
+
rubygems_version: 3.3.8
|
159
132
|
signing_key:
|
160
133
|
specification_version: 4
|
161
134
|
summary: MET museum api wrapper
|