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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 747d015331b55f840aa0065fbfc3e2822fda2f2f52a5a6ddede4b7f62ade5735
4
- data.tar.gz: ac3158ff771e89fc1fb3d563920b02797c97c15be9dbd8a1ed5618649b53194b
3
+ metadata.gz: 45f5c8d43daa6e64da5cb3c6788ee090c82070d84d9dbca31afb0bb3463dfcdc
4
+ data.tar.gz: 2bbbf5262f1bef794f6af6b7656903d17b1b9b11b5b37679a49a6abb852a6818
5
5
  SHA512:
6
- metadata.gz: c02a1a47672656535464183e79b4129b0d4b12632b48382afe8a3aff36d24af355620b51097324157f04342c361dcf62d74396916b52edf05359de6a011a37b1
7
- data.tar.gz: 33eedda5f92fe536476dd03c0ba50aad36610f09440fcf15317b905baeac576108d3ac7993269a2619ed403c3ab5883a21193d87da2f72c3fb9e5358a67dd58f
6
+ metadata.gz: 03053e41e8aa40ab045f480a7bfbe0bfb38a2a909d5776f937938acec59afc3d964cb508e5756de2e11ae123059718659a8e4bcd74247e3eb84837c6ba9d9b9b
7
+ data.tar.gz: 214a6dd1cbeb31b8aa221fe794c7f3bcda4af5ef6ab41498830c8e4cd0582c2d7ea30178eff241f0c177ee618ab40dc577e1fbaa7492a2ecbadc0378bcffa13b
@@ -15,7 +15,7 @@ jobs:
15
15
  runs-on: ubuntu-latest
16
16
  strategy:
17
17
  matrix:
18
- ruby: [ '2.6', '2.7', '3.0', '3.1' ]
18
+ ruby: [ '2.7', '3.0', '3.1' ]
19
19
  name: Ruby ${{ matrix.ruby }} spec
20
20
  steps:
21
21
  - uses: actions/checkout@v2
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env sh
2
+ bundle exec rspec spec/
data/.ruby-version ADDED
@@ -0,0 +1 @@
1
+ 3.1.0
data/Gemfile CHANGED
@@ -6,3 +6,5 @@ end
6
6
 
7
7
  # Specify your gem's dependencies in met_museum.gemspec
8
8
  gemspec
9
+
10
+ gem "rbgithook", "~> 0.1.2"
data/Gemfile.lock CHANGED
@@ -1,61 +1,54 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- met_museum (1.4.1)
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.1)
12
- coderay (1.1.2)
13
- diff-lcs (1.3)
14
- faraday (1.2.0)
15
- multipart-post (>= 1.2, < 3)
16
- ruby2_keywords
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.12.2)
24
- coderay (~> 1.1.0)
25
- method_source (~> 0.9.0)
26
- rainbow (3.0.0)
27
- rake (13.0.1)
28
- regexp_parser (1.7.1)
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.8.0)
31
- rspec-core (~> 3.8.0)
32
- rspec-expectations (~> 3.8.0)
33
- rspec-mocks (~> 3.8.0)
34
- rspec-core (3.8.0)
35
- rspec-support (~> 3.8.0)
36
- rspec-expectations (3.8.2)
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.8.0)
39
- rspec-mocks (3.8.0)
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.8.0)
42
- rspec-retry (0.6.1)
35
+ rspec-support (~> 3.11.0)
36
+ rspec-retry (0.6.2)
43
37
  rspec-core (> 3.3)
44
- rspec-support (3.8.0)
45
- rubocop (0.86.0)
38
+ rspec-support (3.11.0)
39
+ rubocop (1.30.1)
46
40
  parallel (~> 1.10)
47
- parser (>= 2.7.0.1)
41
+ parser (>= 3.1.0.0)
48
42
  rainbow (>= 2.2.2, < 4.0)
49
- regexp_parser (>= 1.7)
50
- rexml
51
- rubocop-ast (>= 0.0.3, < 1.0)
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, < 2.0)
54
- rubocop-ast (0.1.0)
55
- parser (>= 2.7.0.1)
56
- ruby-progressbar (1.10.1)
57
- ruby2_keywords (0.0.5)
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/travis/hyuraku/met_museum.svg"> <img src="https://img.shields.io/github/license/hyuraku/met_museum.svg">
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 = nil)
120
- Faraday.new(url: url).get dir, params
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?(response)
124
- response.status == HTTP_OK_CODE
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
- return Oj.load(response.body) if response_successful?(response)
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(response), "Code: #{response.status}, response: #{response.body}"
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(response)
10
- case response.status
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
@@ -1,3 +1,3 @@
1
1
  module MetMuseum
2
- VERSION = "1.4.1".freeze
2
+ VERSION = "1.4.2".freeze
3
3
  end
data/met_museum.gemspec CHANGED
@@ -38,7 +38,4 @@ Gem::Specification.new do |spec|
38
38
  spec.add_development_dependency "rspec", "~> 3.0"
39
39
  spec.add_development_dependency "rspec-retry"
40
40
  spec.add_development_dependency "rubocop"
41
-
42
- spec.add_dependency "faraday"
43
- spec.add_dependency "oj"
44
41
  end
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.1
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-02-05 00:00:00.000000000 Z
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
- - ".travis.yml"
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.3
131
+ rubygems_version: 3.3.8
159
132
  signing_key:
160
133
  specification_version: 4
161
134
  summary: MET museum api wrapper
data/.travis.yml DELETED
@@ -1,13 +0,0 @@
1
- ---
2
- sudo: false
3
- language: ruby
4
- cache: bundler
5
- rvm:
6
- - 2.7.1
7
- - 2.6.0
8
- - 2.5.0
9
- script:
10
- - bundle exec rspec spec/
11
- before_install:
12
- - gem install -v 2.0.1 bundler
13
- - bundle update --bundler