met_museum 1.0.0 → 1.1.0
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 +4 -14
- data/lib/met_museum/collection.rb +16 -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: 1a6ff7996fca8e8a4d71cbd008cc165f7a34b54437b033846621212b62fd32d7
|
4
|
+
data.tar.gz: e33a584975d9be2be1e784b2d6fa0337fa77484f45fa1ad601944340a71fa81a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9cf96db161ff8ebc0f0c7b6915b33794d06e2842bd4f259cc9021ddc60fed1bb6635609df62eca430c144d564bd298fef44487ba6b995f3cfaf992b972b6c9f5
|
7
|
+
data.tar.gz: '029652a62061d9acc487832efe653f1c0879358c7b9d39217918738319777b120f3be74bb57e0cdbc4f4d00ca5edefc44fece695d233c71a89be89ab83258683'
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -26,14 +26,11 @@ Or install it yourself as:
|
|
26
26
|
require 'met_museum'
|
27
27
|
```
|
28
28
|
The description of the method is as follows
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
</summary>
|
33
|
-
<pre>
|
29
|
+
|
30
|
+
|
31
|
+
MetMuseum::Collection.objects
|
34
32
|
```
|
35
33
|
collection = MetMuseum::Collection.new()
|
36
|
-
|
37
34
|
collection.objects
|
38
35
|
=> {"total"=>490607,
|
39
36
|
"objectIDs"=>
|
@@ -41,10 +38,6 @@ collection.objects
|
|
41
38
|
2,
|
42
39
|
3,
|
43
40
|
4,
|
44
|
-
5,
|
45
|
-
6,
|
46
|
-
7,
|
47
|
-
8,
|
48
41
|
--< omit >--
|
49
42
|
820613]}
|
50
43
|
|
@@ -59,9 +52,7 @@ collection.objects('2018-10-10')
|
|
59
52
|
--< omit >--
|
60
53
|
820613]}
|
61
54
|
```
|
62
|
-
|
63
|
-
</details>
|
64
|
-
<hr>
|
55
|
+
|
65
56
|
<details>
|
66
57
|
<summary>
|
67
58
|
MetMuseum::Collection.object
|
@@ -69,7 +60,6 @@ collection.objects('2018-10-10')
|
|
69
60
|
<pre>
|
70
61
|
```
|
71
62
|
collection = MetMuseum::Collection.new()
|
72
|
-
|
73
63
|
collection.object(1000)
|
74
64
|
=> {"objectID"=>1000,
|
75
65
|
"isHighlight"=>false,
|
@@ -11,6 +11,7 @@ module MetMuseum
|
|
11
11
|
|
12
12
|
API_ENDPOINT = "https://collectionapi.metmuseum.org".freeze
|
13
13
|
PUBLIC_URI = "/public/collection/v1/objects".freeze
|
14
|
+
SEARCH_URI = "/public/collection/v1/search".freeze
|
14
15
|
|
15
16
|
HTTP_OK_CODE = 200.freeze
|
16
17
|
|
@@ -28,7 +29,7 @@ module MetMuseum
|
|
28
29
|
def objects(metadataDate = nil)
|
29
30
|
conn = Faraday.new(:url => API_ENDPOINT)
|
30
31
|
response = conn.get PUBLIC_URI, {:metadataDate => metadataDate}
|
31
|
-
Oj.load(response.body) if response_successful?(response)
|
32
|
+
return Oj.load(response.body) if response_successful?(response)
|
32
33
|
|
33
34
|
raise error_class(response), "Code: #{response.status}, response: #{response.body}"
|
34
35
|
end
|
@@ -84,10 +85,22 @@ module MetMuseum
|
|
84
85
|
# @return [Hash<metadataDate, String>] Date metadata was last updated
|
85
86
|
# @return [Hash<repository, String>]
|
86
87
|
# @return [Hash<objectURL, String>] URL to object's page on metmuseum.org
|
87
|
-
# @return [Hash<
|
88
|
+
# @return [Hash<tags, Array<String>>] An array of subject keyword tags associated with the object
|
88
89
|
def object(objectID)
|
89
90
|
response = Faraday.get "#{API_ENDPOINT}#{PUBLIC_URI}/#{objectID}"
|
90
|
-
Oj.load(response.body)if response_successful?(response)
|
91
|
+
return Oj.load(response.body)if response_successful?(response)
|
92
|
+
|
93
|
+
raise error_class(response), "Code: #{response.status}, response: #{response.body}"
|
94
|
+
end
|
95
|
+
|
96
|
+
# returns a listing of all Object IDs for objects that contain the search query within the object’s data
|
97
|
+
# @param [String] q Returns a listing of all Object IDs for objects that contain the search query within the object’s data
|
98
|
+
# @return [Integer] total The total number of publicly-available objects
|
99
|
+
# @return [Array<Integer>] objectIDs An array containing the object ID of publicly-available object
|
100
|
+
def search(q)
|
101
|
+
conn = Faraday.new(:url => API_ENDPOINT)
|
102
|
+
response = conn.get SEARCH_URI, {:q => q}
|
103
|
+
return Oj.load(response.body)if response_successful?(response)
|
91
104
|
|
92
105
|
raise error_class(response), "Code: #{response.status}, response: #{response.body}"
|
93
106
|
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.
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- hyuraku
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-02-
|
11
|
+
date: 2019-02-10 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|