live_paper 0.0.13 → 0.0.14

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d263eee26996dd3f13c1da9e6a248febe38254e
4
- data.tar.gz: fb769ff8007deab3c6fc2be5ebae3f883993d8fd
3
+ metadata.gz: 55487ee90d033af97fe99a9bee4d5c94795c47a5
4
+ data.tar.gz: 69687e92cfae6cb80b658e332213624ab86dc264
5
5
  SHA512:
6
- metadata.gz: 2125d2363ff676e2de5b7b1d2a0e08b4f718883a6f4f6238ed974500b56c566ca422ed1461e6e238629fb81ef020282f4568a46ee6aeb4c4efc87a9cddd9dd50
7
- data.tar.gz: 6df54c047f502e725096e876a964b6ec528a127544b059cd1fd5e7576e7aff1809aa6ecd305694e4c138902c8f3591d07b74cf42bd479ed75017adae2dc16b01
6
+ metadata.gz: b683e8714f1d051c52df36ebc70c4ca83e5b8698eb507fef2de071a81f8fa0846520e238dee464884f2667b99c2a5c07eaf8fe5f881176171b6268deb9e77cac
7
+ data.tar.gz: 68854880dcfe91eda7b7b6eebc10fa3ce27673ad02609e54530b51060946ff2e3fda213bfe75f13ef8a997b286ade2c86382c2eedccf24d717b455c8144f521d
data/README.md CHANGED
@@ -23,7 +23,7 @@ Or install it yourself as:
23
23
 
24
24
  In order to generate access credentials, register here: https://www.linkcreationstudio.com
25
25
 
26
- ## Usage
26
+ ## Quick-Start Usage
27
27
 
28
28
  ### Authenticate
29
29
 
@@ -58,6 +58,91 @@ File.open("watermark.jpg", "w:UTF-8") { |f| f.write(wm_bytes.force_encoding("UTF
58
58
 
59
59
  > Note: Version 1 of the API only supports returning image bytes. Version 2 may host publicly accessible images.
60
60
 
61
+ ## Usage
62
+
63
+ The gem supports full CRUD operations on the underlying objects. If you do not need to update or
64
+ delete previously created objects, see the quick-start section above.
65
+
66
+ ### Underlying Objects
67
+
68
+ **Triggers** represent the object you want to put on a page: a short url, QR code, or watermarked image.
69
+ **Payoffs** are destinations, either the url of a webpage, or an interactive mobile experience.
70
+ **Links** join a Trigger to a Payoff.
71
+
72
+ ### CRUD Example
73
+
74
+ ```ruby
75
+ lp = LivePaper.auth({id: "your client id", secret: "your client secret"})
76
+
77
+ t=ShortTrigger.create(name: 'short trigger')
78
+ p=Payoff.create(name: 'name', type: Payoff::TYPE[:WEB], url: "http://www.hp.com")
79
+ l=Link.create(payoff_id: p.id, trigger_id: t.id, name: "link")
80
+ @link_id=l.id
81
+ @payoff_id=p.id
82
+ @trigger_id=t.id
83
+ t.short_url # returns url of the form http://hpgo.co/abc123
84
+ ```
85
+
86
+ After creating, you will need to persist the link, payoff, and trigger IDs in some form of
87
+ permanent storage to later access the resources. The IDs are strings.
88
+
89
+ If you want to change the destination:
90
+
91
+ ```ruby
92
+ lp = LivePaper.auth({id: "your client id", secret: "your client secret"})
93
+
94
+ p=Payoff.get(@payoff_id)
95
+ p.url="http://shopping.hp.com"
96
+ p.update
97
+ ```
98
+
99
+ Still later, if you wanted to delete the resources:
100
+
101
+ ```ruby
102
+ lp = LivePaper.auth({id: "your client id", secret: "your client secret"})
103
+
104
+ # delete link first, to avoid resource conflict
105
+ l=Link.get(@link_id)
106
+ l.delete
107
+
108
+ t=Trigger.get(@trigger_id)
109
+ t.delete
110
+
111
+ p=Payoff.get(@payoff_id)
112
+ p.delete
113
+ ```
114
+
115
+ You can list existing resources with the list operation.
116
+
117
+ ```ruby
118
+ lp = LivePaper.auth({id: "your client id", secret: "your client secret"})
119
+
120
+ @links=Link.list # returns array of Link objects
121
+
122
+ @payoffs=Payoff.list # returns array of Payoff objects
123
+ ```
124
+
125
+ ### QR Code Example
126
+
127
+ ```ruby
128
+ t=QrTrigger.create(name: 'QR code trigger')
129
+ p=Payoff.create(name: 'name', type: Payoff::TYPE[:WEB], url: "http://www.hp.com")
130
+ l=Link.create(payoff_id: p.id, trigger_id: t.id, name: "link")
131
+ t.download_qrcode # returns QR image bytes
132
+ ```
133
+
134
+ ### Watermarked Image Example
135
+
136
+ ```ruby
137
+ image = Image.upload "http://url/to_your_image"
138
+
139
+ t=WmTrigger.create(name: 'watermark', watermark: {strength: 10, resolution: 75, imageURL: image})
140
+ p=Payoff.create(name: 'name', type: Payoff::TYPE[:WEB], url: dest)
141
+ l=Link.create(payoff_id: p.id, trigger_id: t.id, name: "link")
142
+ t.download_watermark
143
+ ```
144
+
145
+
61
146
  ## Contributing
62
147
 
63
148
  1. Fork it ( https://github.com/IPGPTP/live_paper/fork )
@@ -49,7 +49,6 @@ module LivePaper
49
49
  end
50
50
 
51
51
  def update
52
- puts 'update called'
53
52
  response_code = 'Object Invalid'
54
53
  if self.id
55
54
  BaseObject.request_handling_auth("#{self.class.api_url}/#{id}", 'PUT') do |request|
@@ -59,7 +58,6 @@ module LivePaper
59
58
  allow_codes: [200, 400, 404, 409])
60
59
  response_code = case response.code.to_i
61
60
  when 200
62
- puts "update response 200"
63
61
  parse(response.body)
64
62
  'OK'
65
63
  when 400
@@ -163,4 +161,4 @@ module LivePaper
163
161
  raise NotImplementedError
164
162
  end
165
163
  end
166
- end
164
+ end
@@ -1,3 +1,3 @@
1
1
  module LivePaper
2
- VERSION = "0.0.13"
2
+ VERSION = "0.0.14"
3
3
  end
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.13
4
+ version: 0.0.14
5
5
  platform: ruby
6
6
  authors:
7
7
  - Mike Whitmarsh
@@ -9,76 +9,76 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2014-11-08 00:00:00.000000000 Z
12
+ date: 2014-11-11 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rest-client
16
16
  requirement: !ruby/object:Gem::Requirement
17
17
  requirements:
18
- - - '>='
18
+ - - ">="
19
19
  - !ruby/object:Gem::Version
20
20
  version: '0'
21
21
  type: :runtime
22
22
  prerelease: false
23
23
  version_requirements: !ruby/object:Gem::Requirement
24
24
  requirements:
25
- - - '>='
25
+ - - ">="
26
26
  - !ruby/object:Gem::Version
27
27
  version: '0'
28
28
  - !ruby/object:Gem::Dependency
29
29
  name: bundler
30
30
  requirement: !ruby/object:Gem::Requirement
31
31
  requirements:
32
- - - ~>
32
+ - - "~>"
33
33
  - !ruby/object:Gem::Version
34
34
  version: '1.6'
35
35
  type: :development
36
36
  prerelease: false
37
37
  version_requirements: !ruby/object:Gem::Requirement
38
38
  requirements:
39
- - - ~>
39
+ - - "~>"
40
40
  - !ruby/object:Gem::Version
41
41
  version: '1.6'
42
42
  - !ruby/object:Gem::Dependency
43
43
  name: rake
44
44
  requirement: !ruby/object:Gem::Requirement
45
45
  requirements:
46
- - - '>='
46
+ - - ">="
47
47
  - !ruby/object:Gem::Version
48
48
  version: '0'
49
49
  type: :development
50
50
  prerelease: false
51
51
  version_requirements: !ruby/object:Gem::Requirement
52
52
  requirements:
53
- - - '>='
53
+ - - ">="
54
54
  - !ruby/object:Gem::Version
55
55
  version: '0'
56
56
  - !ruby/object:Gem::Dependency
57
57
  name: rspec
58
58
  requirement: !ruby/object:Gem::Requirement
59
59
  requirements:
60
- - - '>='
60
+ - - ">="
61
61
  - !ruby/object:Gem::Version
62
62
  version: '0'
63
63
  type: :development
64
64
  prerelease: false
65
65
  version_requirements: !ruby/object:Gem::Requirement
66
66
  requirements:
67
- - - '>='
67
+ - - ">="
68
68
  - !ruby/object:Gem::Version
69
69
  version: '0'
70
70
  - !ruby/object:Gem::Dependency
71
71
  name: webmock
72
72
  requirement: !ruby/object:Gem::Requirement
73
73
  requirements:
74
- - - '>='
74
+ - - ">="
75
75
  - !ruby/object:Gem::Version
76
76
  version: '0'
77
77
  type: :development
78
78
  prerelease: false
79
79
  version_requirements: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - '>='
81
+ - - ">="
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0'
84
84
  description: Ruby interface to use the Live Paper service by HP for creating watermarked
@@ -88,7 +88,7 @@ executables: []
88
88
  extensions: []
89
89
  extra_rdoc_files: []
90
90
  files:
91
- - .gitignore
91
+ - ".gitignore"
92
92
  - Gemfile
93
93
  - LICENSE.txt
94
94
  - README.md
@@ -123,12 +123,12 @@ require_paths:
123
123
  - lib
124
124
  required_ruby_version: !ruby/object:Gem::Requirement
125
125
  requirements:
126
- - - '>='
126
+ - - ">="
127
127
  - !ruby/object:Gem::Version
128
128
  version: '0'
129
129
  required_rubygems_version: !ruby/object:Gem::Requirement
130
130
  requirements:
131
- - - '>='
131
+ - - ">="
132
132
  - !ruby/object:Gem::Version
133
133
  version: '0'
134
134
  requirements: []