scene7-wrapper 0.2.1 → 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.2.1
1
+ 0.3.0
data/lib/scene7/crop.rb CHANGED
@@ -7,7 +7,7 @@ module Scene7
7
7
  end
8
8
 
9
9
  def self.format_url_params(params)
10
- "scl=#{params[:scale_factor]}&crop=#{params[:x].round},#{params[:y].round},#{params[:width].round},#{params[:height].round}"
10
+ "scl=#{params[:scale_factor]}&crop=#{params[:x].round},#{params[:y].round},#{params[:width].round},#{params[:height].round}&qlt=#{params[:quality] || 95}"
11
11
  end
12
12
 
13
13
  def self.convert_params_from_scale_first(orig_params)
@@ -18,6 +18,7 @@ module Scene7
18
18
  params[:width] = orig_params[:width].to_f / scale_factor
19
19
  params[:x] = orig_params[:x].to_f / scale_factor
20
20
  params[:y] = orig_params[:y].to_f / scale_factor
21
+ params[:quality] = orig_params[:quality] if orig_params[:quality]
21
22
  end
22
23
  end
23
24
  end
@@ -5,11 +5,11 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{scene7-wrapper}
8
- s.version = "0.2.1"
8
+ s.version = "0.3.0"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Brian Rose", "Jim Whiteman"]
12
- s.date = %q{2011-04-07}
12
+ s.date = %q{2011-04-11}
13
13
  s.description = %q{A Scene7 wrapper for Rails 3.x apps.}
14
14
  s.email = %q{brian.rose@factorylabs.com}
15
15
  s.extra_rdoc_files = [
@@ -63,7 +63,7 @@ Gem::Specification.new do |s|
63
63
  s.homepage = %q{http://github.com/factorylabs/scene7-wrapper}
64
64
  s.licenses = ["MIT"]
65
65
  s.require_paths = ["lib"]
66
- s.rubygems_version = %q{1.5.0}
66
+ s.rubygems_version = %q{1.6.2}
67
67
  s.summary = %q{A Scene7 wrapper for Rails 3.x apps.}
68
68
 
69
69
  if s.respond_to? :specification_version then
@@ -12,8 +12,23 @@ describe Scene7::Crop do
12
12
  :width => 250.2
13
13
  } }
14
14
 
15
- it 'includes the scale and scale factor' do
16
- subject.format_url_params(params).should == "scl=0.5&crop=50,100,250,150"
15
+ it 'includes the scale and scale factor and defaults the quality to 95' do
16
+ subject.format_url_params(params).should == "scl=0.5&crop=50,100,250,150&qlt=95"
17
+ end
18
+
19
+ context "when quality is specified" do
20
+ let(:params) { {
21
+ :scale_factor => 0.5,
22
+ :x => 50.0,
23
+ :y => 100.1,
24
+ :height => 149.8,
25
+ :width => 250.2,
26
+ :quality => 70
27
+ } }
28
+
29
+ it "includes the appropriate quality" do
30
+ subject.format_url_params(params).should == "scl=0.5&crop=50,100,250,150&qlt=70"
31
+ end
17
32
  end
18
33
  end
19
34
 
@@ -28,7 +43,22 @@ describe Scene7::Crop do
28
43
 
29
44
  describe ".convert_from_scale_first_and_format" do
30
45
  it "converts, then formats" do
31
- subject.convert_from_scale_first_and_format(params).should == "scl=0.5&crop=50,125,225,150"
46
+ subject.convert_from_scale_first_and_format(params).should == "scl=0.5&crop=50,125,225,150&qlt=95"
47
+ end
48
+
49
+ context "with quality specified" do
50
+ let(:params) { {
51
+ :scale_factor => '2.0',
52
+ :x => '100',
53
+ :y => '250',
54
+ :height => '300',
55
+ :width => '450',
56
+ :quality => '70'
57
+ } }
58
+
59
+ it "converts, then formats" do
60
+ subject.convert_from_scale_first_and_format(params).should == "scl=0.5&crop=50,125,225,150&qlt=70"
61
+ end
32
62
  end
33
63
  end
34
64
 
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: scene7-wrapper
3
3
  version: !ruby/object:Gem::Version
4
- hash: 21
4
+ hash: 19
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
- - 2
9
- - 1
10
- version: 0.2.1
8
+ - 3
9
+ - 0
10
+ version: 0.3.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Brian Rose
@@ -16,12 +16,12 @@ autorequire:
16
16
  bindir: bin
17
17
  cert_chain: []
18
18
 
19
- date: 2011-04-07 00:00:00 -06:00
19
+ date: 2011-04-11 00:00:00 -06:00
20
20
  default_executable:
21
21
  dependencies:
22
22
  - !ruby/object:Gem::Dependency
23
- name: savon
24
- version_requirements: &id001 !ruby/object:Gem::Requirement
23
+ type: :runtime
24
+ requirement: &id001 !ruby/object:Gem::Requirement
25
25
  none: false
26
26
  requirements:
27
27
  - - ">="
@@ -30,12 +30,12 @@ dependencies:
30
30
  segments:
31
31
  - 0
32
32
  version: "0"
33
+ name: savon
34
+ version_requirements: *id001
33
35
  prerelease: false
34
- type: :runtime
35
- requirement: *id001
36
36
  - !ruby/object:Gem::Dependency
37
- name: httpclient
38
- version_requirements: &id002 !ruby/object:Gem::Requirement
37
+ type: :runtime
38
+ requirement: &id002 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ">="
@@ -44,12 +44,12 @@ dependencies:
44
44
  segments:
45
45
  - 0
46
46
  version: "0"
47
+ name: httpclient
48
+ version_requirements: *id002
47
49
  prerelease: false
48
- type: :runtime
49
- requirement: *id002
50
50
  - !ruby/object:Gem::Dependency
51
- name: activesupport
52
- version_requirements: &id003 !ruby/object:Gem::Requirement
51
+ type: :runtime
52
+ requirement: &id003 !ruby/object:Gem::Requirement
53
53
  none: false
54
54
  requirements:
55
55
  - - ">="
@@ -58,12 +58,12 @@ dependencies:
58
58
  segments:
59
59
  - 0
60
60
  version: "0"
61
+ name: activesupport
62
+ version_requirements: *id003
61
63
  prerelease: false
62
- type: :runtime
63
- requirement: *id003
64
64
  - !ruby/object:Gem::Dependency
65
- name: i18n
66
- version_requirements: &id004 !ruby/object:Gem::Requirement
65
+ type: :runtime
66
+ requirement: &id004 !ruby/object:Gem::Requirement
67
67
  none: false
68
68
  requirements:
69
69
  - - ">="
@@ -72,12 +72,12 @@ dependencies:
72
72
  segments:
73
73
  - 0
74
74
  version: "0"
75
+ name: i18n
76
+ version_requirements: *id004
75
77
  prerelease: false
76
- type: :runtime
77
- requirement: *id004
78
78
  - !ruby/object:Gem::Dependency
79
- name: shoulda
80
- version_requirements: &id005 !ruby/object:Gem::Requirement
79
+ type: :development
80
+ requirement: &id005 !ruby/object:Gem::Requirement
81
81
  none: false
82
82
  requirements:
83
83
  - - ">="
@@ -86,12 +86,12 @@ dependencies:
86
86
  segments:
87
87
  - 0
88
88
  version: "0"
89
+ name: shoulda
90
+ version_requirements: *id005
89
91
  prerelease: false
90
- type: :development
91
- requirement: *id005
92
92
  - !ruby/object:Gem::Dependency
93
- name: bundler
94
- version_requirements: &id006 !ruby/object:Gem::Requirement
93
+ type: :development
94
+ requirement: &id006 !ruby/object:Gem::Requirement
95
95
  none: false
96
96
  requirements:
97
97
  - - ~>
@@ -102,12 +102,12 @@ dependencies:
102
102
  - 0
103
103
  - 0
104
104
  version: 1.0.0
105
+ name: bundler
106
+ version_requirements: *id006
105
107
  prerelease: false
106
- type: :development
107
- requirement: *id006
108
108
  - !ruby/object:Gem::Dependency
109
- name: jeweler
110
- version_requirements: &id007 !ruby/object:Gem::Requirement
109
+ type: :development
110
+ requirement: &id007 !ruby/object:Gem::Requirement
111
111
  none: false
112
112
  requirements:
113
113
  - - ~>
@@ -118,12 +118,12 @@ dependencies:
118
118
  - 5
119
119
  - 2
120
120
  version: 1.5.2
121
+ name: jeweler
122
+ version_requirements: *id007
121
123
  prerelease: false
122
- type: :development
123
- requirement: *id007
124
124
  - !ruby/object:Gem::Dependency
125
- name: rspec
126
- version_requirements: &id008 !ruby/object:Gem::Requirement
125
+ type: :development
126
+ requirement: &id008 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ">="
@@ -132,12 +132,12 @@ dependencies:
132
132
  segments:
133
133
  - 0
134
134
  version: "0"
135
+ name: rspec
136
+ version_requirements: *id008
135
137
  prerelease: false
136
- type: :development
137
- requirement: *id008
138
138
  - !ruby/object:Gem::Dependency
139
- name: savon_spec
140
- version_requirements: &id009 !ruby/object:Gem::Requirement
139
+ type: :development
140
+ requirement: &id009 !ruby/object:Gem::Requirement
141
141
  none: false
142
142
  requirements:
143
143
  - - ">="
@@ -146,12 +146,12 @@ dependencies:
146
146
  segments:
147
147
  - 0
148
148
  version: "0"
149
+ name: savon_spec
150
+ version_requirements: *id009
149
151
  prerelease: false
150
- type: :development
151
- requirement: *id009
152
152
  - !ruby/object:Gem::Dependency
153
- name: mocha
154
- version_requirements: &id010 !ruby/object:Gem::Requirement
153
+ type: :development
154
+ requirement: &id010 !ruby/object:Gem::Requirement
155
155
  none: false
156
156
  requirements:
157
157
  - - ">="
@@ -160,12 +160,12 @@ dependencies:
160
160
  segments:
161
161
  - 0
162
162
  version: "0"
163
+ name: mocha
164
+ version_requirements: *id010
163
165
  prerelease: false
164
- type: :development
165
- requirement: *id010
166
166
  - !ruby/object:Gem::Dependency
167
- name: ruby-debug
168
- version_requirements: &id011 !ruby/object:Gem::Requirement
167
+ type: :development
168
+ requirement: &id011 !ruby/object:Gem::Requirement
169
169
  none: false
170
170
  requirements:
171
171
  - - ">="
@@ -174,12 +174,12 @@ dependencies:
174
174
  segments:
175
175
  - 0
176
176
  version: "0"
177
+ name: ruby-debug
178
+ version_requirements: *id011
177
179
  prerelease: false
178
- type: :development
179
- requirement: *id011
180
180
  - !ruby/object:Gem::Dependency
181
- name: timecop
182
- version_requirements: &id012 !ruby/object:Gem::Requirement
181
+ type: :development
182
+ requirement: &id012 !ruby/object:Gem::Requirement
183
183
  none: false
184
184
  requirements:
185
185
  - - ">="
@@ -188,9 +188,9 @@ dependencies:
188
188
  segments:
189
189
  - 0
190
190
  version: "0"
191
+ name: timecop
192
+ version_requirements: *id012
191
193
  prerelease: false
192
- type: :development
193
- requirement: *id012
194
194
  description: A Scene7 wrapper for Rails 3.x apps.
195
195
  email: brian.rose@factorylabs.com
196
196
  executables: []
@@ -273,7 +273,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
273
273
  requirements: []
274
274
 
275
275
  rubyforge_project:
276
- rubygems_version: 1.5.0
276
+ rubygems_version: 1.6.2
277
277
  signing_key:
278
278
  specification_version: 3
279
279
  summary: A Scene7 wrapper for Rails 3.x apps.