paypoint-blue 0.6.0 → 0.7.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 153e9ecd01ade6890bf456a002c4bbfa5caef74f
4
- data.tar.gz: 693db491d2aa3db825f10a2c81e2551e0da57137
3
+ metadata.gz: 35fda4129bc353db11b8304b32d6d73ea9c21ed1
4
+ data.tar.gz: 93c06940ab960c891536e4d8d826c319a77ef04e
5
5
  SHA512:
6
- metadata.gz: 753f1ea2f28efcda32dbe6e6508640669774790794226850863f5d916aeae7b7c9ac4ce6f74883d6b70566be9f674e0f0957d0f8f142ae96623a2d84bf07fc2b
7
- data.tar.gz: aa1d5c4f2babeed4c25c05d9842db37dc3183401882563c88d07532a5fecda5a24c4acaeb7226c9b46ae8d0c8992d90fb452c28386a44485fbdd893bd719366b
6
+ metadata.gz: 3810b61fd3f56e8bbd97a62d4e010717de25c723d6646dcee20b0cc2d260f5be7548914f658b470da29c19df9cf136a3c5db8a1325c05e76ea2fa1902e530b73
7
+ data.tar.gz: 8754b8f9b060eca327b42cedc08d892e7d24fdc044de0889c6304a89c3ccc9ea477a7bbd4c8b101c1f435c6c091cb8c616ae7a8f96c5d1138632f672f34cf565
data/.rubocop.yml CHANGED
@@ -38,7 +38,7 @@ Style/StringLiteralsInInterpolation:
38
38
  Style/SymbolArray:
39
39
  Enabled: false
40
40
 
41
- Style/TrailingComma:
41
+ Style/TrailingCommaInLiteral:
42
42
  EnforcedStyleForMultiline: comma
43
43
 
44
44
  Style/ClassAndModuleChildren:
@@ -132,4 +132,72 @@ class PayPoint::Blue::Hosted < PayPoint::Blue::Base
132
132
  payload = build_payload payload, defaults: %i(skin)
133
133
  client.post "sessions/#{inst_id}/cards", build_payload(payload)
134
134
  end
135
+
136
+ # Retrieve list of available skins
137
+ #
138
+ # @api_url https://paymentdeveloperdocs.com/customise-_look_and_feel/manage-hosted-cashier-skins/
139
+ #
140
+ # @return the API response
141
+ def skins
142
+ client.get "skins/#{inst_id}/list"
143
+ end
144
+
145
+ # Download a skin
146
+ #
147
+ # @api_url https://paymentdeveloperdocs.com/customise-_look_and_feel/manage-hosted-cashier-skins/
148
+ #
149
+ # @param [String] skin_id the id of the skin
150
+ # @param [String] path the path to download the skin (optional)
151
+ #
152
+ # @return a zip file
153
+ def download_skin(skin_id, path = nil)
154
+ path ||= "."
155
+ response = client.get "skins/#{skin_id}"
156
+ File.open("#{File.expand_path(path)}/#{skin_id}.zip", "wb") do |file|
157
+ file.write(Base64.decode64(response))
158
+ end
159
+ end
160
+
161
+ # Upload a new skin
162
+ #
163
+ # @api_url https://paymentdeveloperdocs.com/customise-_look_and_feel/manage-hosted-cashier-skins/
164
+ #
165
+ # @param [String] file the zip file with path
166
+ # @param [Hash] params request parameters placed in the url,
167
+ # name: the name of the skin (required)
168
+ # description: description for the skin (optional)
169
+ #
170
+ # @return the API response
171
+ def upload_skin(file, name:, **params)
172
+ client.post do |request|
173
+ request.url "skins/#{inst_id}/create", params.merge(name: name)
174
+ request.headers["Content-Type"] = "application/zip"
175
+ request.body = File.read(file)
176
+ end
177
+ end
178
+
179
+ # Replace a skin
180
+ #
181
+ # Update the skin by uploading a new zip file.
182
+ # The method may also be used to update only the name and description of
183
+ # an existing skin.
184
+ #
185
+ # @api_url https://paymentdeveloperdocs.com/customise-_look_and_feel/manage-hosted-cashier-skins/
186
+ #
187
+ # @param [String] skin_id the id of the skin
188
+ # @param [Hash] arguments of the skin to update
189
+ # file: the zip file with path (optional)
190
+ # name: new name for the skin (optional)
191
+ # description: description for the skin (optional)
192
+ #
193
+ # @return the API response
194
+ def replace_skin(skin_id, file: nil, **params)
195
+ client.put do |request|
196
+ request.url "skins/#{skin_id}", params
197
+ if file
198
+ request.headers["Content-Type"] = "application/zip"
199
+ request.body = File.read(file)
200
+ end
201
+ end
202
+ end
135
203
  end
@@ -1,5 +1,5 @@
1
1
  module PayPoint
2
2
  module Blue # rubocop:disable Documentation
3
- VERSION = "0.6.0"
3
+ VERSION = "0.7.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: paypoint-blue
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Laszlo Bacsi
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2015-09-15 00:00:00.000000000 Z
11
+ date: 2016-10-18 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -208,4 +208,3 @@ signing_key:
208
208
  specification_version: 4
209
209
  summary: API client for PayPoint Blue
210
210
  test_files: []
211
- has_rdoc: