live_paper 0.0.31 → 0.0.32
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +1 -1
- data/lib/live_paper/version.rb +1 -1
- data/lib/live_paper/wm_trigger.rb +2 -2
- data/spec/live_paper/trigger_spec.rb +6 -3
- data/spec/test_assets/Bear.jpg +0 -0
- metadata +4 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fcecf58dac7040fe27c0853853f7125c2a0fbf0a
|
4
|
+
data.tar.gz: be2a76fa20d093f03cd050af0a6a53c1e249b48b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2eb042a037a18cfbdf09dc739320dc72e69dc1edbb6330a9ad6cbfdee79301f477f9ec4dd89eeccbd499215367e18f86d7c109f7a2382e3473360ec459d77004
|
7
|
+
data.tar.gz: c66086f3ccaae104be3fcccef70e6aae4089fae36218c1ccda4bf0883ecdd6680cef419ff03bd67a9b5d7ecf974d0f21736ffe16fd0989222f88496a990e0251
|
data/README.md
CHANGED
@@ -149,7 +149,7 @@ You can list existing resources with the list operation.
|
|
149
149
|
t=WmTrigger.create(name: 'watermark')
|
150
150
|
p=Payoff.create(name: 'name', type: Payoff::TYPE[:WEB], url: dest)
|
151
151
|
l=Link.create(payoff_id: p.id, trigger_id: t.id, name: "link")
|
152
|
-
t.download_watermark(image, {strength: 10,
|
152
|
+
t.download_watermark(image, {strength: 10, wpi: 75, ppi: 72})
|
153
153
|
```
|
154
154
|
|
155
155
|
Alternatively, you can upload an image from your local system by providing the path to the jpg file
|
data/lib/live_paper/version.rb
CHANGED
@@ -16,7 +16,7 @@ module LivePaper
|
|
16
16
|
end
|
17
17
|
|
18
18
|
def download_watermark(image_url, options = {})
|
19
|
-
|
19
|
+
wpi = options[:wpi] || WATERMARK_RESOLUTION
|
20
20
|
strength = options[:strength] || WATERMARK_STRENGTH
|
21
21
|
ppi = options[:ppi]
|
22
22
|
if ppi.blank?
|
@@ -28,7 +28,7 @@ module LivePaper
|
|
28
28
|
ppi = DEFAULT_IMAGE_RESOLUTION
|
29
29
|
end
|
30
30
|
|
31
|
-
url = "#{self.wm_url}?imageURL=#{CGI.escape(image_url)}&
|
31
|
+
url = "#{self.wm_url}?imageURL=#{CGI.escape(image_url)}&wpi=#{wpi}&ppi=#{ppi}&strength=#{strength}"
|
32
32
|
begin
|
33
33
|
response = WmTrigger.rest_request( url, :get, accept: "image/jpg" )
|
34
34
|
response.body.empty? ? nil : response.body
|
@@ -161,14 +161,17 @@ end
|
|
161
161
|
end
|
162
162
|
|
163
163
|
describe '#download_watermark' do
|
164
|
-
let(:image_url) { 'http://
|
164
|
+
let(:image_url) { 'http://lpp.com/image/mine.jpg' }
|
165
165
|
let(:encoded_image_url) { CGI.escape(image_url) }
|
166
|
-
let(:
|
166
|
+
let(:wpi) { LivePaper::WmTrigger::WATERMARK_RESOLUTION }
|
167
167
|
let(:strength) { LivePaper::WmTrigger::WATERMARK_STRENGTH }
|
168
168
|
let(:ppi) { LivePaper::WmTrigger::DEFAULT_IMAGE_RESOLUTION }
|
169
169
|
|
170
170
|
before do
|
171
|
-
stub_request(:get, "https://fileapi/id/image?imageURL=#{encoded_image_url}&
|
171
|
+
stub_request(:get, "https://fileapi/id/image?imageURL=#{encoded_image_url}&wpi=#{wpi}&ppi=#{ppi}&strength=#{strength}").to_return(:body => lpp_watermark_response, :status => 200)
|
172
|
+
image_file_path = File.expand_path(File.join(File.dirname(__FILE__), '..', 'test_assets', 'Bear.jpg'))
|
173
|
+
image_bytes = File.binread(image_file_path)
|
174
|
+
stub_request(:get, "#{image_url}?access_token=#{$lpp_access_token}").to_return(:body => image_bytes, :status => 200)
|
172
175
|
@trigger = LivePaper::WmTrigger.new data
|
173
176
|
@trigger.wm_url='https://fileapi/id/image'
|
174
177
|
end
|
Binary file
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: live_paper
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.32
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Mike Whitmarsh
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2015-11-
|
12
|
+
date: 2015-11-16 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
@@ -169,6 +169,7 @@ files:
|
|
169
169
|
- spec/live_paper/trigger_spec.rb
|
170
170
|
- spec/spec_helper.rb
|
171
171
|
- spec/spec_helpers/lpp_client.rb
|
172
|
+
- spec/test_assets/Bear.jpg
|
172
173
|
homepage: https://github.com/IPGPTP/live_paper_rubygem
|
173
174
|
licenses:
|
174
175
|
- MIT
|
@@ -201,3 +202,4 @@ test_files:
|
|
201
202
|
- spec/live_paper/trigger_spec.rb
|
202
203
|
- spec/spec_helper.rb
|
203
204
|
- spec/spec_helpers/lpp_client.rb
|
205
|
+
- spec/test_assets/Bear.jpg
|