met_museum 1.3.3 → 1.3.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/README.md +66 -3
- data/lib/met_museum/collection.rb +23 -3
- data/lib/met_museum/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: f318ac9ca9aedae15b10e0202143b88719a0df5324a8057f33dda6ea52e59909
|
|
4
|
+
data.tar.gz: 1fb234a9ebbfd1f6bcd39f4626446a0fabaae0f10e7a98a9b41e0bb69c3783df
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: c88e7b0f617dd49b90f05d6d78e5e0d0172dab5465b765adf747258d012b10879206e8a5065bfde771f140bb69b9c8ec3065332172af0bcab12467e4215ae9eb
|
|
7
|
+
data.tar.gz: d972b17a10bc8042d5663a361e4c8da5d611a7dcd0d7eef887c6e95ac274eb94adc608e5ef548ca9a9c9976dcafaae1674ff1dbd821e1d22be5e812a62dfd2f4
|
data/README.md
CHANGED
|
@@ -240,9 +240,72 @@ MetMuseum::Collection.new.search('akasaka', {limit: 1})
|
|
|
240
240
|
"tags"=>["Buildings", "Men", "Women"]}]
|
|
241
241
|
|
|
242
242
|
|
|
243
|
-
# show
|
|
244
|
-
MetMuseum::Collection.new.search('
|
|
245
|
-
=> {"total"=>
|
|
243
|
+
# show object_ids size and themselves with certain departmentId --< omit >--
|
|
244
|
+
MetMuseum::Collection.new.search('flower', {departmentId: 12})
|
|
245
|
+
=> {"total"=>7922,
|
|
246
|
+
"objectIDs"=>
|
|
247
|
+
[207138,
|
|
248
|
+
197555,
|
|
249
|
+
207151,
|
|
250
|
+
206979,
|
|
251
|
+
--< omit >--
|
|
252
|
+
|
|
253
|
+
# show object_ids size and themselves which are isOnView
|
|
254
|
+
MetMuseum::Collection.new.search('flower', {isOnView: true})
|
|
255
|
+
=> => {"total"=>2066,
|
|
256
|
+
"objectIDs"=>
|
|
257
|
+
[207138,
|
|
258
|
+
3689,
|
|
259
|
+
11207,
|
|
260
|
+
252906,
|
|
261
|
+
252349,
|
|
262
|
+
--< omit >--
|
|
263
|
+
|
|
264
|
+
# show object_ids size and themselves which are artistOrCulture
|
|
265
|
+
MetMuseum::Collection.new.search('flower', {artistOrCulture: true})
|
|
266
|
+
=> {"total"=>5, "objectIDs"=>[207138, 3689, 196563, 196560, 198662]}
|
|
267
|
+
|
|
268
|
+
|
|
269
|
+
# show object_ids size and themselves with certain medium
|
|
270
|
+
MetMuseum::Collection.new.search('flower', {medium: "Paintings"})
|
|
271
|
+
=> {"total"=>706,
|
|
272
|
+
"objectIDs"=>
|
|
273
|
+
[11207,
|
|
274
|
+
436121,
|
|
275
|
+
10481,
|
|
276
|
+
435882,
|
|
277
|
+
--< omit >--
|
|
278
|
+
|
|
279
|
+
|
|
280
|
+
# show object_ids size and themselves which are hasImages
|
|
281
|
+
MetMuseum::Collection.new.search('flower', {hasImages: true})
|
|
282
|
+
=> {"total"=>18731,
|
|
283
|
+
"objectIDs"=>
|
|
284
|
+
[207138,
|
|
285
|
+
3689,
|
|
286
|
+
11207,
|
|
287
|
+
252906,
|
|
288
|
+
--< omit >--
|
|
289
|
+
|
|
290
|
+
# show object_ids size and themselves with certain geoLocation
|
|
291
|
+
MetMuseum::Collection.new.search('flower', {geoLocation: "Paris"})
|
|
292
|
+
=> {"total"=>292,
|
|
293
|
+
"objectIDs"=>
|
|
294
|
+
[195320,
|
|
295
|
+
707455,
|
|
296
|
+
193814,
|
|
297
|
+
200432,
|
|
298
|
+
--< omit >--
|
|
299
|
+
|
|
300
|
+
# show object_ids size and themselves with datarange
|
|
301
|
+
MetMuseum::Collection.new.search('flower', {dateBegin: 1700,dateEnd: 1750})
|
|
302
|
+
=> {"total"=>1444,
|
|
303
|
+
"objectIDs"=>
|
|
304
|
+
[9199,
|
|
305
|
+
3759,
|
|
306
|
+
398162,
|
|
307
|
+
666591,
|
|
308
|
+
--< omit >--
|
|
246
309
|
```
|
|
247
310
|
</div>
|
|
248
311
|
</details>
|
|
@@ -14,7 +14,7 @@ module MetMuseum
|
|
|
14
14
|
metadataDate: nil,
|
|
15
15
|
departmentIds: nil
|
|
16
16
|
}.merge(options)
|
|
17
|
-
options[:metadataDate] = check_date(options[:metadataDate])
|
|
17
|
+
options[:metadataDate] = check_date(options[:metadataDate])
|
|
18
18
|
response = Faraday.new(:url => API_ENDPOINT).get PUBLIC_URI, {:metadataDate => options[:metadataDate], :departmentIds => options[:departmentIds]}
|
|
19
19
|
return_response(response)
|
|
20
20
|
end
|
|
@@ -95,9 +95,28 @@ module MetMuseum
|
|
|
95
95
|
def search(query, options = {})
|
|
96
96
|
options = {
|
|
97
97
|
limit: 0,
|
|
98
|
-
isHighlight: false
|
|
98
|
+
isHighlight: false,
|
|
99
|
+
departmentId: nil,
|
|
100
|
+
isOnView: nil,
|
|
101
|
+
artistOrCulture: nil,
|
|
102
|
+
medium: nil,
|
|
103
|
+
hasImages: nil,
|
|
104
|
+
geoLocation: nil,
|
|
105
|
+
dateBegin: 0,
|
|
106
|
+
dateEnd: 2000
|
|
99
107
|
}.merge(options)
|
|
100
|
-
response = Faraday.new(:url => API_ENDPOINT).get SEARCH_URI, {
|
|
108
|
+
response = Faraday.new(:url => API_ENDPOINT).get SEARCH_URI, {
|
|
109
|
+
:q => query,
|
|
110
|
+
:isHighlight => options[:isHighlight],
|
|
111
|
+
:departmentId => options[:departmentId],
|
|
112
|
+
:isOnView => options[:isOnView],
|
|
113
|
+
:artistOrCulture => options[:artistOrCulture],
|
|
114
|
+
:medium => options[:medium],
|
|
115
|
+
:hasImages => options[:hasImages],
|
|
116
|
+
:geoLocation => options[:geoLocation],
|
|
117
|
+
:dateBegin => options[:dateBegin],
|
|
118
|
+
:dateEnd => options[:dateEnd]
|
|
119
|
+
}
|
|
101
120
|
origin_response = return_response(response)
|
|
102
121
|
return origin_response if options[:limit] <= 0
|
|
103
122
|
origin_response["objectIDs"][0..options[:limit] - 1].map{|id| MetMuseum::Collection.new.object(id)}
|
|
@@ -128,6 +147,7 @@ module MetMuseum
|
|
|
128
147
|
end
|
|
129
148
|
|
|
130
149
|
def check_date(date)
|
|
150
|
+
return nil if date.nil?
|
|
131
151
|
return date.to_s if date.class == Date
|
|
132
152
|
|
|
133
153
|
raise TypeError, "Write certain date"
|
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.4
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- hyuraku
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-08
|
|
11
|
+
date: 2019-10-08 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|