7digital 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
@@ -41,8 +41,6 @@ module Sevendigital
41
41
  http_client, http_request = create_http_request(api_request)
42
42
  @client.log(:verbose) { "ApiOperator: Making HTTP Request..." }
43
43
  http_client.request(http_request).tap do |http_response|
44
- puts @client.inspect
45
- puts http_response.inspect
46
44
  @client.log(:verbose) { "ApiOperator: Response Headers: #{http_response.header.to_yaml}" }
47
45
  end
48
46
  end
@@ -21,7 +21,6 @@ module Sevendigital
21
21
 
22
22
 
23
23
  def response_out_of_date?(api_response, current_time=nil)
24
- puts @client.inspect
25
24
  (api_response.nil? || header_invalid?(api_response.headers) || cache_expired?(api_response.headers, current_time)).tap do |expired|
26
25
  @client.log(:verbose) { "ApiOperatorCached: Cache response out of date" if expired }
27
26
  end
@@ -28,7 +28,6 @@ module Sevendigital
28
28
  response_node = xml_doc.at_xpath("./response")
29
29
  response_status = nil
30
30
  response_status = get_optional_attribute(response_node, "status") if response_node
31
- puts xml.inspect
32
31
  if response_status == 'ok' then
33
32
  response.error_code = 0
34
33
  else
@@ -36,9 +36,6 @@ module Sevendigital
36
36
  end
37
37
 
38
38
  def nested_list_from_xml_doc(list_node, list_element_name = default_list_element_name, element_name = default_element_name)
39
- puts list_element_name
40
- puts element_name
41
- puts list_node.inspect
42
39
  make_sure_eating_nokogiri_node(list_node)
43
40
  list = []
44
41
  list_node.xpath("./#{list_element_name}/#{element_name}").each { |node| list << from_xml_doc(node)}
@@ -11,7 +11,6 @@ module Sevendigital
11
11
  end
12
12
 
13
13
  def content_xml
14
- puts @content
15
14
  @content_xml ||= Nokogiri::XML(@content)
16
15
  end
17
16
 
@@ -52,6 +52,11 @@ class Artist < SevendigitalObject
52
52
  #@return [Array<Artist>] similar
53
53
  sevendigital_extended_property :tags
54
54
 
55
+ def image(image_size = nil)
56
+ return @image.gsub(/_\d+\.jpg/, "_#{image_size}.jpg") if image_size
57
+ @image
58
+ end
59
+
55
60
  #populates all available details on artist by calling *artist/details* API method
56
61
  #@return [Artist]
57
62
  def get_details(options={})
@@ -17,6 +17,11 @@ module Sevendigital
17
17
  @price = release_with_details.instance_variable_get("@price")
18
18
  release_with_details
19
19
  end
20
+
21
+ def image(image_size = nil)
22
+ return @image.gsub(/_\d+\.jpg/, "_#{image_size}.jpg") if image_size
23
+ @image
24
+ end
20
25
 
21
26
  def get_tracks(options={})
22
27
  @api_client.release.get_tracks(@id, options)
@@ -1,5 +1,5 @@
1
1
  module Sevendigital
2
2
  # The version of the gem
3
3
  NAME = "7digital"
4
- VERSION = '0.1.0'
4
+ VERSION = '0.1.1'
5
5
  end
@@ -56,8 +56,7 @@ describe "ClientConfiguration" do
56
56
 
57
57
  it "should use environment specific configuration file with environment specific settings" do
58
58
  conf_file = File.join(File.dirname(__FILE__),"data", "configuration_env_override.yml")
59
- puts conf_file
60
-
59
+
61
60
  rails = OpenStruct.new
62
61
  rails.env = "development"
63
62
  Object.const_set(:Rails, rails)
@@ -48,7 +48,6 @@ describe "Client" do
48
48
  request.parameters[:releaseId].should == 456
49
49
  request.parameters[:country].should == "CU"
50
50
  request.parameters[:page].should == 1
51
- puts request.parameters.inspect
52
51
  request.parameters.keys.size.should == 4 # page_size == null
53
52
 
54
53
  end
@@ -122,7 +122,15 @@ describe "Artist" do
122
122
 
123
123
  end
124
124
 
125
+ it "image should return link to image with specified image size" do
126
+ release = fake_release_with_details
127
+ release.image(333).should == "http://cdn.7static.com/static/img/artistimages/00/000/000/0000000001_333.jpg"
128
+ end
125
129
 
130
+ it "image should return link to image with returned image size" do
131
+ release = fake_release_with_details
132
+ release.image.should == "http://cdn.7static.com/static/img/artistimages/00/000/000/0000000001_300.jpg"
133
+ end
126
134
 
127
135
  def fake_track_list
128
136
  tracks = Array.new
@@ -148,7 +156,7 @@ describe "Artist" do
148
156
  def fake_artist_with_details
149
157
  artist = Sevendigital::Artist.new(@client)
150
158
  artist.sort_name = "The, The"
151
- artist.image = "image"
159
+ artist.image = "http://cdn.7static.com/static/img/artistimages/00/000/000/0000000001_300.jpg"
152
160
  artist.url = "url"
153
161
  artist
154
162
  end
@@ -85,8 +85,19 @@ describe "Release" do
85
85
  }
86
86
  @release.get_tags(expected_options)
87
87
 
88
+ end
89
+
90
+ it "image should return link to image with specified image size" do
91
+ release = fake_release_with_details
92
+ release.image(333).should == "http://cdn.7static.com/static/img/sleeveart/00/008/097/0000809794_333.jpg"
93
+ end
94
+
95
+ it "image should return link to image with returned image size" do
96
+ release = fake_release_with_details
97
+ release.image(333).should == "http://cdn.7static.com/static/img/sleeveart/00/008/097/0000809794_100.jpg"
88
98
  end
89
99
 
100
+
90
101
  def fake_releases_list
91
102
  releases = Array.new
92
103
  releases << Sevendigital::Release.new(@client)
@@ -106,7 +117,7 @@ describe "Release" do
106
117
  release.version = "(release version)"
107
118
  release.type = :album
108
119
  release.artist = Sevendigital::Artist.new(@client)
109
- release.image = "image"
120
+ release.image = "http://cdn.7static.com/static/img/sleeveart/00/008/097/0000809794_100.jpg"
110
121
  release.url = "url"
111
122
  release.release_date = DateTime.new(2010, 1, 1)
112
123
  release.added_date = DateTime.new(2000, 1, 1)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: 7digital
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-09-19 00:00:00.000000000 Z
12
+ date: 2012-10-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: oauth
@@ -302,7 +302,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
302
302
  version: '0'
303
303
  requirements: []
304
304
  rubyforge_project:
305
- rubygems_version: 1.8.23
305
+ rubygems_version: 1.8.24
306
306
  signing_key:
307
307
  specification_version: 3
308
308
  summary: A ruby wrapper for 7digital API