met_museum 1.3.4 → 1.3.5
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/.travis.yml +0 -1
- data/Gemfile.lock +3 -3
- data/lib/met_museum/collection.rb +13 -8
- data/lib/met_museum/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5697b8911725b17dc47469633a365f8a9b9f9e3127e65e43746338565fefd56a
|
4
|
+
data.tar.gz: c7d6ca7fab4b88319c3310c9eebac808cf43c3ec92f50d4d247e844200f6b53b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f2be3bb4815092bff418ec2d4e68dc0facf97cb5f0c6cb74ce18f0d7d614f0c36ce12e6b6e5a296b94231e52f5dcc85dbcbf4d601eade9c88a262b3c4d97b71
|
7
|
+
data.tar.gz: 11a8dd620debdbc18c1d2ae0ef1221e7e7386669c6b75a6a8683bc68a4157645ed014b2a3c9bad270e521422f49e06e6c9bc64be87b319709722762eb11cd91b
|
data/.travis.yml
CHANGED
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
met_museum (1.3.
|
4
|
+
met_museum (1.3.5)
|
5
5
|
faraday
|
6
6
|
oj
|
7
7
|
|
@@ -10,11 +10,11 @@ GEM
|
|
10
10
|
specs:
|
11
11
|
coderay (1.1.2)
|
12
12
|
diff-lcs (1.3)
|
13
|
-
faraday (0.
|
13
|
+
faraday (0.17.1)
|
14
14
|
multipart-post (>= 1.2, < 3)
|
15
15
|
method_source (0.9.2)
|
16
16
|
multipart-post (2.1.1)
|
17
|
-
oj (3.
|
17
|
+
oj (3.10.0)
|
18
18
|
pry (0.12.2)
|
19
19
|
coderay (~> 1.1.0)
|
20
20
|
method_source (~> 0.9.0)
|
@@ -6,6 +6,7 @@ module MetMuseum
|
|
6
6
|
class Collection
|
7
7
|
# Return a listing of all valid Object IDs available to use
|
8
8
|
# @param [Date] metadataDate Returns any objects with updated data after this date
|
9
|
+
# @param [DateTime] metadataDate Returns any objects with updated data after this date
|
9
10
|
# @params [Integer] departmentIds Returns any objects in a specific department
|
10
11
|
# @return [Hash<total, Integer>] The total number of publicly-available objects
|
11
12
|
# @return [Hash<objectIDs, Array<Integer>>] An array containing the object ID of publicly-available object
|
@@ -15,7 +16,7 @@ module MetMuseum
|
|
15
16
|
departmentIds: nil
|
16
17
|
}.merge(options)
|
17
18
|
options[:metadataDate] = check_date(options[:metadataDate])
|
18
|
-
response =
|
19
|
+
response = new_faraday(API_ENDPOINT, PUBLIC_URI, {:metadataDate => options[:metadataDate], :departmentIds => options[:departmentIds]})
|
19
20
|
return_response(response)
|
20
21
|
end
|
21
22
|
|
@@ -72,7 +73,7 @@ module MetMuseum
|
|
72
73
|
# @return [Hash<objectURL, String>] URL to object's page on metmuseum.org
|
73
74
|
# @return [Hash<tags, Array<String>>] An array of subject keyword tags associated with the object
|
74
75
|
def object(objectID)
|
75
|
-
response =
|
76
|
+
response = new_faraday(API_ENDPOINT, "#{PUBLIC_URI}/#{objectID}")
|
76
77
|
return_response(response)
|
77
78
|
end
|
78
79
|
|
@@ -81,7 +82,7 @@ module MetMuseum
|
|
81
82
|
# @return [Integer] departments Department ID as an integer. The departmentId is to be used as a query parameter on the `/objects` endpoint
|
82
83
|
# @return [String] departments Display name for a department
|
83
84
|
def department
|
84
|
-
response =
|
85
|
+
response = new_faraday(API_ENDPOINT, DEPARTMENTS_URI)
|
85
86
|
return_response(response)
|
86
87
|
end
|
87
88
|
|
@@ -105,9 +106,9 @@ module MetMuseum
|
|
105
106
|
dateBegin: 0,
|
106
107
|
dateEnd: 2000
|
107
108
|
}.merge(options)
|
108
|
-
response =
|
109
|
-
:q => query,
|
110
|
-
:isHighlight => options[:isHighlight],
|
109
|
+
response = new_faraday(API_ENDPOINT, SEARCH_URI, {
|
110
|
+
:q => query,
|
111
|
+
:isHighlight => options[:isHighlight],
|
111
112
|
:departmentId => options[:departmentId],
|
112
113
|
:isOnView => options[:isOnView],
|
113
114
|
:artistOrCulture => options[:artistOrCulture],
|
@@ -116,7 +117,7 @@ module MetMuseum
|
|
116
117
|
:geoLocation => options[:geoLocation],
|
117
118
|
:dateBegin => options[:dateBegin],
|
118
119
|
:dateEnd => options[:dateEnd]
|
119
|
-
}
|
120
|
+
})
|
120
121
|
origin_response = return_response(response)
|
121
122
|
return origin_response if options[:limit] <= 0
|
122
123
|
origin_response["objectIDs"][0..options[:limit] - 1].map{|id| MetMuseum::Collection.new.object(id)}
|
@@ -124,6 +125,10 @@ module MetMuseum
|
|
124
125
|
|
125
126
|
private
|
126
127
|
|
128
|
+
def new_faraday(url, dir, params = nil)
|
129
|
+
Faraday.new(:url => url).get dir, params
|
130
|
+
end
|
131
|
+
|
127
132
|
def error_class(response)
|
128
133
|
case response.status
|
129
134
|
when HTTP_BAD_REQUEST_CODE
|
@@ -148,7 +153,7 @@ module MetMuseum
|
|
148
153
|
|
149
154
|
def check_date(date)
|
150
155
|
return nil if date.nil?
|
151
|
-
return date.to_s if date.
|
156
|
+
return date.to_date.to_s if date.kind_of?(Date)
|
152
157
|
|
153
158
|
raise TypeError, "Write certain date"
|
154
159
|
end
|
data/lib/met_museum/version.rb
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.3.
|
4
|
+
version: 1.3.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hyuraku
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-01-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -139,7 +139,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
139
139
|
- !ruby/object:Gem::Version
|
140
140
|
version: '0'
|
141
141
|
requirements: []
|
142
|
-
rubygems_version: 3.0.
|
142
|
+
rubygems_version: 3.0.3
|
143
143
|
signing_key:
|
144
144
|
specification_version: 4
|
145
145
|
summary: MET museum api wrapper
|