met_museum 1.2.0 → 1.2.1
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/Gemfile.lock +1 -1
- data/README.md +81 -8
- data/lib/met_museum/collection.rb +6 -6
- 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: 7d58c6abf7f6b6ec0be35cf0d040d2fc792b94813ea1d29c24e53a2779b3e9ed
|
|
4
|
+
data.tar.gz: 328c2bec219470476da6835add05935feba2a699354baf7eb3f4289c41066e47
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 2f79e9a9a7b1a4b30b15d797630a1432be61ee75a5ed3c387524426151c5081762719a258568398ec451793aaeee4b6503971aa4600c918614e2c899d808ed1d
|
|
7
|
+
data.tar.gz: 58be9f19bf3252c924af639ec5e9deacbcc14d4d21dd1cdc373f7994cacf213c4776b18abf9af876cb2cb8b0a90056ef7172b412f08a0b35b72d8624a2b25346
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
<img src="https://img.shields.io/travis/hyuraku/met_museum.svg"> <img src="https://img.shields.io/github/license/hyuraku/met_museum.svg">
|
|
2
|
-
<img src="https://img.shields.io/gem/v/met_museum.svg"> <img src="http://inch-ci.org/github/hyuraku/met_museum.svg">
|
|
2
|
+
<img src="https://img.shields.io/gem/v/met_museum.svg"> <img src="http://inch-ci.org/github/hyuraku/met_museum.svg">
|
|
3
3
|
# MetMuseum
|
|
4
4
|
|
|
5
5
|
The Metropolitan Museum of Art Collection API Ruby wrapper
|
|
@@ -24,13 +24,19 @@ Or install it yourself as:
|
|
|
24
24
|
|
|
25
25
|
## Usage
|
|
26
26
|
|
|
27
|
-
```
|
|
27
|
+
```rb
|
|
28
28
|
require 'met_museum'
|
|
29
29
|
```
|
|
30
|
+
|
|
30
31
|
The description of the method is as follows
|
|
31
32
|
|
|
33
|
+
<details>
|
|
34
|
+
<summary>
|
|
32
35
|
MetMuseum::Collection.objects
|
|
33
|
-
|
|
36
|
+
</summary>
|
|
37
|
+
<div>
|
|
38
|
+
|
|
39
|
+
```rb
|
|
34
40
|
collection = MetMuseum::Collection.new()
|
|
35
41
|
collection.objects
|
|
36
42
|
=> {"total"=>490607,
|
|
@@ -75,15 +81,20 @@ collection.objects(DateTime.new(2018,10,10))
|
|
|
75
81
|
--< omit >--
|
|
76
82
|
820613]}
|
|
77
83
|
```
|
|
84
|
+
</div>
|
|
85
|
+
</details>
|
|
86
|
+
|
|
87
|
+
|
|
78
88
|
|
|
79
89
|
<details>
|
|
80
90
|
<summary>
|
|
81
91
|
MetMuseum::Collection.object
|
|
82
92
|
</summary>
|
|
83
|
-
<
|
|
84
|
-
|
|
93
|
+
<div>
|
|
94
|
+
|
|
95
|
+
```rb
|
|
85
96
|
collection = MetMuseum::Collection.new()
|
|
86
|
-
collection.object(1000)
|
|
97
|
+
collection.object(1000)
|
|
87
98
|
=> {"objectID"=>1000,
|
|
88
99
|
"isHighlight"=>false,
|
|
89
100
|
"accessionNumber"=>"10.149.99",
|
|
@@ -134,11 +145,17 @@ collection.object(1000)
|
|
|
134
145
|
"objectURL"=>"https://www.metmuseum.org/art/collection/search/1000"}
|
|
135
146
|
"tags"=>["Coat of Arms", "Dishes"]}
|
|
136
147
|
```
|
|
137
|
-
</
|
|
148
|
+
</div>
|
|
138
149
|
</details>
|
|
139
150
|
|
|
151
|
+
<details class="sss">
|
|
152
|
+
<summary>
|
|
140
153
|
MetMuseum::Collection.search
|
|
141
|
-
|
|
154
|
+
</summary>
|
|
155
|
+
<div>
|
|
156
|
+
|
|
157
|
+
```rb
|
|
158
|
+
# show object_ids size and themselves
|
|
142
159
|
collection.search('ocean')
|
|
143
160
|
=> {"total"=>189,
|
|
144
161
|
"objectIDs"=>
|
|
@@ -149,7 +166,63 @@ collection.search('ocean')
|
|
|
149
166
|
8315,
|
|
150
167
|
8317,
|
|
151
168
|
--< omit >--
|
|
169
|
+
|
|
170
|
+
# show specified number of objects
|
|
171
|
+
MetMuseum::Collection.search('akasaka', 1)
|
|
172
|
+
=> [{"objectID"=>37231,
|
|
173
|
+
"isHighlight"=>false,
|
|
174
|
+
"accessionNumber"=>"JP787",
|
|
175
|
+
"isPublicDomain"=>true,
|
|
176
|
+
"primaryImage"=>"https://images.metmuseum.org/CRDImages/as/original/DP123261.jpg",
|
|
177
|
+
"primaryImageSmall"=>"https://images.metmuseum.org/CRDImages/as/web-large/DP123261.jpg",
|
|
178
|
+
"additionalImages"=>[],
|
|
179
|
+
"constituents"=>[{"role"=>"Artist", "name"=>"Utagawa Hiroshige"}],
|
|
180
|
+
"department"=>"Asian Art",
|
|
181
|
+
"objectName"=>"Print",
|
|
182
|
+
"title"=>"Akasaka",
|
|
183
|
+
"culture"=>"Japan",
|
|
184
|
+
"period"=>"Edo period (1615–1868)",
|
|
185
|
+
"dynasty"=>"",
|
|
186
|
+
"reign"=>"",
|
|
187
|
+
"portfolio"=>"",
|
|
188
|
+
"artistRole"=>"",
|
|
189
|
+
"artistPrefix"=>"",
|
|
190
|
+
"artistDisplayName"=>"",
|
|
191
|
+
"artistDisplayBio"=>"",
|
|
192
|
+
"artistSuffix"=>"",
|
|
193
|
+
"artistAlphaSort"=>"",
|
|
194
|
+
"artistNationality"=>"",
|
|
195
|
+
"artistBeginDate"=>"",
|
|
196
|
+
"artistEndDate"=>"",
|
|
197
|
+
"objectDate"=>"ca. 1840",
|
|
198
|
+
"objectBeginDate"=>1830,
|
|
199
|
+
"objectEndDate"=>1850,
|
|
200
|
+
"medium"=>"Polychrome woodblock print; ink and color on paper",
|
|
201
|
+
"dimensions"=>"Overall: 8 3/4 x 13 3/4in. (22.2 x 34.9cm)",
|
|
202
|
+
"creditLine"=>"The Francis Lathrop Collection, Purchase, Frederick C. Hewitt Fund, 1911",
|
|
203
|
+
"geographyType"=>"",
|
|
204
|
+
"city"=>"",
|
|
205
|
+
"state"=>"",
|
|
206
|
+
"county"=>"",
|
|
207
|
+
"country"=>"",
|
|
208
|
+
"region"=>"",
|
|
209
|
+
"subregion"=>"",
|
|
210
|
+
"locale"=>"",
|
|
211
|
+
"locus"=>"",
|
|
212
|
+
"excavation"=>"",
|
|
213
|
+
"river"=>"",
|
|
214
|
+
"classification"=>"Prints",
|
|
215
|
+
"rightsAndReproduction"=>"",
|
|
216
|
+
"linkResource"=>"",
|
|
217
|
+
"metadataDate"=>"2019-05-11T05:36:53.803Z",
|
|
218
|
+
"repository"=>"Metropolitan Museum of Art, New York, NY",
|
|
219
|
+
"objectURL"=>"https://www.metmuseum.org/art/collection/search/37231",
|
|
220
|
+
"tags"=>["Buildings", "Men", "Women"]}]
|
|
152
221
|
```
|
|
222
|
+
</div>
|
|
223
|
+
</details>
|
|
224
|
+
|
|
225
|
+
***
|
|
153
226
|
|
|
154
227
|
## Contributing
|
|
155
228
|
|
|
@@ -72,16 +72,16 @@ module MetMuseum
|
|
|
72
72
|
end
|
|
73
73
|
|
|
74
74
|
# returns a listing of all Object IDs for objects that contain the search query within the object’s data
|
|
75
|
-
# @param [String] query
|
|
75
|
+
# @param [String] query search term e.g. sunflowers
|
|
76
|
+
# @param [Interger] limit number of objects zthat contain the search query within the object’s data
|
|
76
77
|
# @return [Integer] total The total number of publicly-available objects
|
|
77
78
|
# @return [Array<Integer>] objectIDs An array containing the object ID of publicly-available object
|
|
78
|
-
|
|
79
|
+
# @return [Array<Object>] objects An array containing the objects that contain the search query within the object’s data
|
|
80
|
+
def search(query, limit = 0)
|
|
79
81
|
response = Faraday.new(:url => API_ENDPOINT).get SEARCH_URI, {:q => query}
|
|
80
|
-
#error if show_number <= 0
|
|
81
82
|
origin_response = return_response(response)
|
|
82
|
-
return origin_response if
|
|
83
|
-
|
|
84
|
-
origin_response["objectIDs"][0..show_number - 1].map{|id| object(id)}
|
|
83
|
+
return origin_response if limit <= 0
|
|
84
|
+
origin_response["objectIDs"][0..limit - 1].map{|id| object(id)}
|
|
85
85
|
end
|
|
86
86
|
|
|
87
87
|
private
|
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.2.
|
|
4
|
+
version: 1.2.1
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- hyuraku
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: exe
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2019-
|
|
11
|
+
date: 2019-05-11 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: bundler
|