thewalters 0.2.1 → 0.3.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 9c3d6404eaed8587006923b7871440d9204b5722
4
- data.tar.gz: 172f50a4c1f3e32ce904238113e92681cb0ff97d
3
+ metadata.gz: 4e7786ebfa1f5e96a250839a0e74ed0a59f8c8a1
4
+ data.tar.gz: 51a616cbaa2df49b5a1ea7e98bd604e650d4fcd2
5
5
  SHA512:
6
- metadata.gz: ab50fcddd98c38f33a2c217d537243cd232e048aea9f2411303b4a456767a68ba202107eb1498e835f8c9c0902df0c6680454cca7638c7b3e0de00a0f4d23912
7
- data.tar.gz: da8afe64874d3356527a6bb52f3c74be0ba9e25f16f1225c161f7f64643a1b3dcba6a12597974218cadc477d2c7e7ffbe5723b6c3fef8ee16e11ebba29ff70f0
6
+ metadata.gz: f6f0fd3c7372720de592528a0f63d59b51aa7daa01f4161e785084c3a2bdc17837cf59ef6fc619a3f49913d9ab7addae3566b207744c58203d90e4a6e5f3e165
7
+ data.tar.gz: 83f3272151918b2c7e1d463b5d3dc44a3191a954216d4af181503dc4dc1f1152e667e7213182f4e16c93eaecd6fa7232e38a7a399253b1773b0135c87ff51112
@@ -34,7 +34,6 @@ API client available for attendees of {ArtBytes 2014}[http://www.eventbrite.com/
34
34
 
35
35
  === Things that need to be done
36
36
  * Add more tests
37
- * implement objects/:id/images with a first-class image object
38
37
 
39
38
  === Do's and Don'ts
40
39
  * Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.3.0
@@ -7,3 +7,4 @@ require 'thewalters/collection'
7
7
  require 'thewalters/geography'
8
8
  require 'thewalters/exhibition'
9
9
  require 'thewalters/location'
10
+ require 'thewalters/image'
@@ -10,7 +10,7 @@ module TheWalters
10
10
 
11
11
  # Get the images for this object
12
12
  def images
13
- # TODO
13
+ TheWalters::ArtObject.get_images(self.ObjectID)
14
14
  end
15
15
 
16
16
  private
@@ -42,6 +42,13 @@ module TheWalters
42
42
  result
43
43
  end
44
44
 
45
+ def self.get_images(id)
46
+ path = [version, api_path, id, 'images'].join("/")
47
+ result = fetch(path)
48
+ result["Items"] = result["Items"].map {|o| Image.new(o) }
49
+ result
50
+ end
51
+
45
52
  def self.version; "v1" end
46
53
  def self.base_url; "http://api.thewalters.org" end
47
54
  def self.path
@@ -0,0 +1,18 @@
1
+ require 'uri'
2
+ module TheWalters
3
+ # The URLs for images are able to accept a number of parameters.
4
+ # See https://github.com/WaltersArtMuseum/walters-api/blob/master/images.md
5
+ # and https://github.com/JimBobSquarePants/ImageProcessor
6
+ class Image < Hashie::Mash
7
+
8
+ def url(params={})
9
+ escaped_params_as_string = params.to_a.map {|n,v| "#{URI.escape(n.to_s)}=#{URI.escape(v.to_s)}" }.join("&") if params.any?
10
+ [self.ImageURL, escaped_params_as_string].compact.join('?')
11
+ end
12
+
13
+ def to_s
14
+ self.url
15
+ end
16
+
17
+ end
18
+ end
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: thewalters 0.2.1 ruby lib
5
+ # stub: thewalters 0.3.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "thewalters"
9
- s.version = "0.2.1"
9
+ s.version = "0.3.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.authors = ["Jonathan Julian"]
@@ -33,6 +33,7 @@ Gem::Specification.new do |s|
33
33
  "lib/thewalters/collection.rb",
34
34
  "lib/thewalters/exhibition.rb",
35
35
  "lib/thewalters/geography.rb",
36
+ "lib/thewalters/image.rb",
36
37
  "lib/thewalters/location.rb",
37
38
  "test/helper.rb",
38
39
  "test/test_base.rb",
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: thewalters
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Jonathan Julian
@@ -131,6 +131,7 @@ files:
131
131
  - lib/thewalters/collection.rb
132
132
  - lib/thewalters/exhibition.rb
133
133
  - lib/thewalters/geography.rb
134
+ - lib/thewalters/image.rb
134
135
  - lib/thewalters/location.rb
135
136
  - test/helper.rb
136
137
  - test/test_base.rb