voucherify 0.5.0 → 0.5.1
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 +4 -4
- data/README.md +36 -3
- data/lib/voucherify.rb +1 -0
- data/lib/voucherify/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 331f6a24ae1e9b9a777a6918b266238fe742f88f
|
4
|
+
data.tar.gz: b3ce1cfd31685e08e0e1167c71bd9882708ec6c5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 2a4b14ca70950f4e9cac4480185bdaebb605c9e706b179a03fb3f5d9220716c6afda7d24486474366d51ad0d8ffc827b59a63b65869d02c099bd54480ed72b9f
|
7
|
+
data.tar.gz: a272767515360acc0748c813380ec44f119e32afeb1932c92355e8194dd19a7e28419684509b832ec50fe3f6f67c84f6bbcdb1b8a70b8a338c801816b0f05420
|
data/README.md
CHANGED
@@ -88,6 +88,7 @@ Result:
|
|
88
88
|
"code": "9mYBpIk",
|
89
89
|
"campaign": null,
|
90
90
|
"category": "API Test",
|
91
|
+
"type": "DISCOUNT_VOUCHER",
|
91
92
|
"discount": {
|
92
93
|
"type": "AMOUNT",
|
93
94
|
"amount_off": 400
|
@@ -107,15 +108,16 @@ Result:
|
|
107
108
|
"code": "AzTsIH",
|
108
109
|
"campaign": null,
|
109
110
|
"category": "API Test",
|
110
|
-
"
|
111
|
-
|
112
|
-
|
111
|
+
"type": "GIFT_VOUCHER",
|
112
|
+
"gift": {
|
113
|
+
"amount": 5000
|
113
114
|
},
|
114
115
|
"start_date": "2016-03-01T10:00:00Z",
|
115
116
|
"expiration_date": null,
|
116
117
|
"redemption": {
|
117
118
|
"quantity": 1,
|
118
119
|
"redeemed_quantity": 0,
|
120
|
+
"redeemed_amount": 0,
|
119
121
|
"redemption_entries": []
|
120
122
|
},
|
121
123
|
"active": true,
|
@@ -137,6 +139,7 @@ Result:
|
|
137
139
|
{
|
138
140
|
"code": "v1GiJYuuS",
|
139
141
|
"campaign": "vip",
|
142
|
+
"type": "DISCOUNT_VOUCHER",
|
140
143
|
"discount": {
|
141
144
|
"percent_off": 10.0,
|
142
145
|
"type": "PERCENT"
|
@@ -257,6 +260,7 @@ Result (voucher details after redemption):
|
|
257
260
|
"voucher": {
|
258
261
|
"code": "v1GiJYuuS",
|
259
262
|
"campaign": "vip",
|
263
|
+
"type": "DISCOUNT_VOUCHER",
|
260
264
|
"discount": {
|
261
265
|
"percent_off": 10.0,
|
262
266
|
"type": "PERCENT"
|
@@ -316,6 +320,7 @@ Result:
|
|
316
320
|
"voucher": {
|
317
321
|
"code": "v1GiJYuuS",
|
318
322
|
"campaign": "vip",
|
323
|
+
"type": "DISCOUNT_VOUCHER",
|
319
324
|
"discount": {
|
320
325
|
"percent_off": 10.0,
|
321
326
|
"type": "PERCENT"
|
@@ -374,6 +379,32 @@ voucherify.redeem({
|
|
374
379
|
})
|
375
380
|
```
|
376
381
|
|
382
|
+
##### 4. With customer id
|
383
|
+
|
384
|
+
If you already created a customer profile in Voucherify's database, whether it was implicitly by providing it to the `redeem` function or explicitly by invoking the [`customer.create`](#create-customer) method, you can identify your customer in following redemptions by a generated id (starting with `cust_`).
|
385
|
+
|
386
|
+
```ruby
|
387
|
+
voucherify.redeem({
|
388
|
+
"voucher" => "v1GiJYuuS",
|
389
|
+
"customer" => {
|
390
|
+
"id" => "cust_C9qJ3xKgZFqkpMw7b21MF2ow"
|
391
|
+
})
|
392
|
+
```
|
393
|
+
|
394
|
+
##### 5. With order amount
|
395
|
+
|
396
|
+
Redeeming a gift voucher requires to pass an amount that you wish to withdraw from the voucher.
|
397
|
+
Order amount have to be expressed in cents, as an integer. For example $22.50 should be provided as 2250:
|
398
|
+
|
399
|
+
```ruby
|
400
|
+
voucherify.redeem({
|
401
|
+
"voucher" => "91Ft4U",
|
402
|
+
"order" => {
|
403
|
+
"amount" => 2250
|
404
|
+
})
|
405
|
+
```
|
406
|
+
|
407
|
+
|
377
408
|
#### Listing redemptions
|
378
409
|
|
379
410
|
Use `voucherify.redemptions(filter)` to get a filtered list of redemptions.
|
@@ -412,6 +443,7 @@ code = nil # for an automatically generated string
|
|
412
443
|
# single-use voucher with 10% off discount that is valid throughout the whole 2016
|
413
444
|
opts = {
|
414
445
|
category: "New Customers",
|
446
|
+
type: "DISCOUNT_VOUCHER",
|
415
447
|
discount: {
|
416
448
|
percent_off: 10.0,
|
417
449
|
type: "PERCENT"
|
@@ -432,6 +464,7 @@ Result (voucher details):
|
|
432
464
|
"code": "9Yi5g",
|
433
465
|
"campaign": null,
|
434
466
|
"category": "New Customers",
|
467
|
+
"type": "DISCOUNT_VOUCHER",
|
435
468
|
"discount": {
|
436
469
|
"type": "PERCENT",
|
437
470
|
"percent_off": 10.0
|
data/lib/voucherify.rb
CHANGED
data/lib/voucherify/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: voucherify
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.5.
|
4
|
+
version: 0.5.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pawelrychlik
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-
|
11
|
+
date: 2016-07-01 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|