met_museum 1.2.0 → 1.2.1

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: f3166d79682a65468f1125eae072b225fe074956a14d46f519f614d005c546e0
4
- data.tar.gz: ff4e0edf78eb5f1ee51ce033853e24b5df8d79f309ebf331cd2be3fd4f4446fe
3
+ metadata.gz: 7d58c6abf7f6b6ec0be35cf0d040d2fc792b94813ea1d29c24e53a2779b3e9ed
4
+ data.tar.gz: 328c2bec219470476da6835add05935feba2a699354baf7eb3f4289c41066e47
5
5
  SHA512:
6
- metadata.gz: b3c5648e505cb4643486345315323677f782e0a27476ba2645f3db9728d2bd0c5ed64179ac3588173cd40126f69711d620e0d50469c29e144b2f11d46107ada0
7
- data.tar.gz: d211eed392861e8e897d6d3e1abe7893ba162f4402345e10d266414c485af879dbebdaa9d2be98ed6a2705342311f344e901dffcb77cdafca9b1afd16abe1455
6
+ metadata.gz: 2f79e9a9a7b1a4b30b15d797630a1432be61ee75a5ed3c387524426151c5081762719a258568398ec451793aaeee4b6503971aa4600c918614e2c899d808ed1d
7
+ data.tar.gz: 58be9f19bf3252c924af639ec5e9deacbcc14d4d21dd1cdc373f7994cacf213c4776b18abf9af876cb2cb8b0a90056ef7172b412f08a0b35b72d8624a2b25346
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- met_museum (1.2.0)
4
+ met_museum (1.2.1)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
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
- <pre>
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
- </pre>
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 Returns a listing of all Object IDs for objects that contain the search query within the object’s data
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
- def search(query, show_number = 0)
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 show_number.to_i <= 0 && show_number != 'all'
83
- show_number = origin_response['total'].to_i if show_number == 'all'
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
@@ -1,3 +1,3 @@
1
1
  module MetMuseum
2
- VERSION = "1.2.0"
2
+ VERSION = "1.2.1"
3
3
  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.2.0
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-04-30 00:00:00.000000000 Z
11
+ date: 2019-05-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler