paypoint-blue 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +1 -1
- data/lib/paypoint/blue/hosted.rb +68 -0
- data/lib/paypoint/blue/version.rb +1 -1
- metadata +2 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35fda4129bc353db11b8304b32d6d73ea9c21ed1
|
4
|
+
data.tar.gz: 93c06940ab960c891536e4d8d826c319a77ef04e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3810b61fd3f56e8bbd97a62d4e010717de25c723d6646dcee20b0cc2d260f5be7548914f658b470da29c19df9cf136a3c5db8a1325c05e76ea2fa1902e530b73
|
7
|
+
data.tar.gz: 8754b8f9b060eca327b42cedc08d892e7d24fdc044de0889c6304a89c3ccc9ea477a7bbd4c8b101c1f435c6c091cb8c616ae7a8f96c5d1138632f672f34cf565
|
data/.rubocop.yml
CHANGED
data/lib/paypoint/blue/hosted.rb
CHANGED
@@ -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
|
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.
|
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:
|
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:
|