met_museum 1.2.1 → 1.3.0

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: 7d58c6abf7f6b6ec0be35cf0d040d2fc792b94813ea1d29c24e53a2779b3e9ed
4
- data.tar.gz: 328c2bec219470476da6835add05935feba2a699354baf7eb3f4289c41066e47
3
+ metadata.gz: 94ea790efb01c63a733aac63c10e2ec0f241d99d3a73a76bccaccca915ec2dbe
4
+ data.tar.gz: 2b2fcbbbc15a75ddd725b0dab4e51410467e3556498d7371836de92e94ac7fe1
5
5
  SHA512:
6
- metadata.gz: 2f79e9a9a7b1a4b30b15d797630a1432be61ee75a5ed3c387524426151c5081762719a258568398ec451793aaeee4b6503971aa4600c918614e2c899d808ed1d
7
- data.tar.gz: 58be9f19bf3252c924af639ec5e9deacbcc14d4d21dd1cdc373f7994cacf213c4776b18abf9af876cb2cb8b0a90056ef7172b412f08a0b35b72d8624a2b25346
6
+ metadata.gz: 436da70bddff5aa4773e93900e44b981f2bed267630418061a6becb6bab410ed1c5e3baa31571ad46af4417022c9346f5219e7cf9fc43372757610efea5801d9
7
+ data.tar.gz: 5952a9255c9f17f803d4a53745bddbfef654e302b51bb7087efeaedce4270e9ad6248574635381703f06e31bd5bb3d2517b90a0be1ebd06dc6d118687ca4b8e0
@@ -3,7 +3,11 @@ sudo: false
3
3
  language: ruby
4
4
  cache: bundler
5
5
  rvm:
6
+ - 2.6.0
6
7
  - 2.5.0
7
8
  - 2.4.2
8
9
  script:
9
10
  - bundle exec rspec spec/
11
+ before_install:
12
+ - gem install -v 2.0.1 bundler
13
+ - bundle update --bundler
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- met_museum (1.2.1)
4
+ met_museum (1.3.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
data/README.md CHANGED
@@ -39,28 +39,17 @@ MetMuseum::Collection.objects
39
39
  ```rb
40
40
  collection = MetMuseum::Collection.new()
41
41
  collection.objects
42
- => {"total"=>490607,
42
+ => {"total"=>494788,
43
43
  "objectIDs"=>
44
44
  [1,
45
45
  2,
46
46
  3,
47
47
  4,
48
48
  --< omit >--
49
- 820613]}
50
-
51
- collection.objects('2018-10-10')
52
- =>{"total"=>88232,
53
- "objectIDs"=>
54
- [33,
55
- 35,
56
- 36,
57
- 74,
58
- 75,
59
- --< omit >--
60
- 820613]}
49
+ 826602]}
61
50
 
62
51
  collection.objects(Date.new(2018,10,10))
63
- =>{"total"=>88232,
52
+ =>{"total"=>355400,
64
53
  "objectIDs"=>
65
54
  [33,
66
55
  35,
@@ -68,18 +57,28 @@ collection.objects('2018-10-10')
68
57
  74,
69
58
  75,
70
59
  --< omit >--
71
- 820613]}
60
+ 826307]}
72
61
 
73
- collection.objects(DateTime.new(2018,10,10))
74
- =>{"total"=>88232,
62
+ collection.objects(nil,1)
63
+ => {"total"=>18572,
75
64
  "objectIDs"=>
76
- [33,
77
- 35,
78
- 36,
79
- 74,
80
- 75,
81
- --< omit >--
82
- 820613]}
65
+ [1,
66
+ 2,
67
+ 3,
68
+ 4,
69
+ --< omit >--
70
+ 821352]}
71
+
72
+ collection.objects(Date.new(2018,10,10),1)
73
+ => {"total"=>15439,
74
+ "objectIDs"=>
75
+ [7,
76
+ 8,
77
+ 33,
78
+ 34,
79
+ --< omit >--
80
+ 816271]}
81
+
83
82
  ```
84
83
  </div>
85
84
  </details>
@@ -6,11 +6,12 @@ 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
+ # @params [Integer] departmentIds Returns any objects in a specific department
9
10
  # @return [Hash<total, Integer>] The total number of publicly-available objects
10
11
  # @return [Hash<objectIDs, Array<Integer>>] An array containing the object ID of publicly-available object
11
- def objects(metadataDate = nil)
12
+ def objects(metadataDate = nil, departmentIds = nil)
12
13
  metadataDate = check_date(metadataDate) unless metadataDate.nil?
13
- response = Faraday.new(:url => API_ENDPOINT).get PUBLIC_URI, {:metadataDate => metadataDate}
14
+ response = Faraday.new(:url => API_ENDPOINT).get PUBLIC_URI, {:metadataDate => metadataDate, :departmentIds => departmentIds}
14
15
  return_response(response)
15
16
  end
16
17
 
@@ -71,6 +72,15 @@ module MetMuseum
71
72
  return_response(response)
72
73
  end
73
74
 
75
+ # returns a listing of all departments
76
+ # @return [Array] departments An array containing the JSON objects that contain each department's departmentId and display name. The departmentId is to be used as a query parameter on the `/objects` endpoint
77
+ # @return [Integer] departments Department ID as an integer. The departmentId is to be used as a query parameter on the `/objects` endpoint
78
+ # @return [String] departments Display name for a department
79
+ def department
80
+ response = Faraday.get "#{API_ENDPOINT}#{DEPARTMENTS_URI}"
81
+ return_response(response)
82
+ end
83
+
74
84
  # returns a listing of all Object IDs for objects that contain the search query within the object’s data
75
85
  # @param [String] query search term e.g. sunflowers
76
86
  # @param [Interger] limit number of objects zthat contain the search query within the object’s data
@@ -2,4 +2,5 @@ module MetMuseum
2
2
  API_ENDPOINT = "https://collectionapi.metmuseum.org".freeze
3
3
  PUBLIC_URI = "/public/collection/v1/objects".freeze
4
4
  SEARCH_URI = "/public/collection/v1/search".freeze
5
+ DEPARTMENTS_URI = "/public/collection/v1/departments".freeze
5
6
  end
@@ -1,3 +1,3 @@
1
1
  module MetMuseum
2
- VERSION = "1.2.1"
2
+ VERSION = "1.3.0"
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.1
4
+ version: 1.3.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-05-11 00:00:00.000000000 Z
11
+ date: 2019-05-21 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler