bigcartel 0.2.2 → 0.2.3

Sign up to get free protection for your applications and to get access to all the features.
data/lib/bigcartel.rb CHANGED
@@ -132,14 +132,15 @@ module BigCartel
132
132
  class Image < Base
133
133
  attr_reader :height, :width, :url, :thumb, :medium, :large
134
134
  def initialize(data={})
135
- url_parts = data['url'].scan(/(https?:\/\/.*\/product_images\/\d*\/)(.*).(jpg|png|gif|jpeg)/i)
135
+ filename = File.basename( data['url'])
136
+ picture_id = data['url'].match(/\/(\d+)\//)[1]
136
137
 
137
138
  @height = data['height']
138
139
  @width = data['width']
139
140
  @url = data['url']
140
- @thumb = "#{url_parts[0][0]}75.#{url_parts[0][2]}"
141
- @medium = "#{url_parts[0][0]}175.#{url_parts[0][2]}"
142
- @large = "#{url_parts[0][0]}300.#{url_parts[0][2]}"
141
+ @thumb = "http://images.cdn.bigcartel.com/bigcartel/product_images/#{picture_id}/max_h-75+max_w-75/#{filename}"
142
+ @medium = "http://images.cdn.bigcartel.com/bigcartel/product_images/#{picture_id}/max_h-155+max_w-150/#{filename}"
143
+ @large = "http://images.cdn.bigcartel.com/bigcartel/product_images/#{picture_id}/max_h-300+max_w-300/#{filename}"
143
144
  end
144
145
  end
145
146
 
@@ -1,3 +1,3 @@
1
1
  module BigCartel
2
- VERSION = "0.2.2"
2
+ VERSION = "0.2.3"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: bigcartel
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.2
4
+ version: 0.2.3
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,12 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2013-01-13 00:00:00.000000000 -06:00
13
- default_executable:
12
+ date: 2013-07-29 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: rspec
17
- requirement: &2153334880 !ruby/object:Gem::Requirement
16
+ requirement: !ruby/object:Gem::Requirement
18
17
  none: false
19
18
  requirements:
20
19
  - - ~>
@@ -22,10 +21,15 @@ dependencies:
22
21
  version: '2.3'
23
22
  type: :development
24
23
  prerelease: false
25
- version_requirements: *2153334880
24
+ version_requirements: !ruby/object:Gem::Requirement
25
+ none: false
26
+ requirements:
27
+ - - ~>
28
+ - !ruby/object:Gem::Version
29
+ version: '2.3'
26
30
  - !ruby/object:Gem::Dependency
27
31
  name: httparty
28
- requirement: &2153334380 !ruby/object:Gem::Requirement
32
+ requirement: !ruby/object:Gem::Requirement
29
33
  none: false
30
34
  requirements:
31
35
  - - ~>
@@ -33,7 +37,12 @@ dependencies:
33
37
  version: 0.7.3
34
38
  type: :runtime
35
39
  prerelease: false
36
- version_requirements: *2153334380
40
+ version_requirements: !ruby/object:Gem::Requirement
41
+ none: false
42
+ requirements:
43
+ - - ~>
44
+ - !ruby/object:Gem::Version
45
+ version: 0.7.3
37
46
  description: A Ruby wrapper for the Big Cartel External REST API
38
47
  email:
39
48
  - matt@tonkapark.com
@@ -50,7 +59,6 @@ files:
50
59
  - lib/bigcartel/version.rb
51
60
  - spec/bigcartel_spec.rb
52
61
  - spec/helper.rb
53
- has_rdoc: true
54
62
  homepage: ''
55
63
  licenses: []
56
64
  post_install_message:
@@ -71,7 +79,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
71
79
  version: '0'
72
80
  requirements: []
73
81
  rubyforge_project: bigcartel
74
- rubygems_version: 1.6.2
82
+ rubygems_version: 1.8.25
75
83
  signing_key:
76
84
  specification_version: 3
77
85
  summary: Ruby wrapper for the Big Cartel API