voucherify 2.1.1 → 4.0.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 +5 -5
- data/.gitignore +1 -0
- data/.travis.yml +1 -1
- data/README.md +225 -4
- data/lib/voucherify.rb +5 -1
- data/lib/voucherify/client.rb +17 -1
- data/lib/voucherify/service/campaigns.rb +5 -5
- data/lib/voucherify/service/consents.rb +17 -0
- data/lib/voucherify/service/customers.rb +13 -5
- data/lib/voucherify/service/distributions.rb +8 -4
- data/lib/voucherify/service/loyalties.rb +133 -0
- data/lib/voucherify/service/orders.rb +29 -0
- data/lib/voucherify/service/products.rb +8 -8
- data/lib/voucherify/service/promotions.rb +9 -5
- data/lib/voucherify/service/redemptions.rb +6 -6
- data/lib/voucherify/service/rewards.rb +63 -0
- data/lib/voucherify/service/segments.rb +2 -2
- data/lib/voucherify/service/validation_rules.rb +30 -6
- data/lib/voucherify/service/validations.rb +2 -2
- data/lib/voucherify/service/vouchers.rb +7 -7
- data/lib/voucherify/version.rb +1 -1
- data/voucherify.gemspec +5 -5
- metadata +16 -13
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: c678dc889e798e587fa154be5986162843a121b45d319073f5412a4928c30880
|
4
|
+
data.tar.gz: 0bb3ef7753ce2fc0e57a8b650c4489e3d974342f381b5dd177a6c098e9ae983f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fa1417056871b3c6aa3f1dfd8e494579a78c3b550f74eb0cd349b5223c496655330a69cb60dfc1c214410f5b114d8f43ff149e17794a274b2eddec7d46b2b0bf
|
7
|
+
data.tar.gz: 477e66648852cf962914b3ca660d7f848e4ad3f69c8e44fed7d195ca7bd82076ec6b156be09f4400cb1cb25263d1c4422314db2ff02dfd70ded888a26d777e7c
|
data/.gitignore
CHANGED
data/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -50,6 +50,12 @@ API:
|
|
50
50
|
|
|
51
51
|
<a href="#events-api">Events</a>
|
52
52
|
|
|
53
|
+
<a href="#orders-api">Orders</a>
|
54
|
+
|
|
55
|
+
<a href="#loyalties-api">Loyalties</a>
|
56
|
+
|
|
57
|
+
<a href="#rewards-api">Rewards</a>
|
58
|
+
|
|
53
59
|
<a href="#utils">Utils</a>
|
54
60
|
</p>
|
55
61
|
|
@@ -57,6 +63,8 @@ API:
|
|
57
63
|
|
58
64
|
## Setup
|
59
65
|
|
66
|
+
### Voucherify gem starting from 3.x requires ruby version >= 2.2
|
67
|
+
|
60
68
|
Add this line to your application's Gemfile:
|
61
69
|
|
62
70
|
```ruby
|
@@ -101,6 +109,18 @@ voucherify = Voucherify::Client.new({
|
|
101
109
|
})
|
102
110
|
```
|
103
111
|
|
112
|
+
### API Endpoint
|
113
|
+
|
114
|
+
Optionally, you can add `apiUrl` to the client options if you want to use Voucherify running in a specific region.
|
115
|
+
|
116
|
+
```ruby
|
117
|
+
voucherify = Voucherify::Client.new({
|
118
|
+
:applicationId => 'YOUR-APPLICATION-ID',
|
119
|
+
:clientSecretKey => 'YOUR-CLIENT-SECRET-KEY',
|
120
|
+
:apiUrl => 'https://<region>.api.voucherify.io'
|
121
|
+
})
|
122
|
+
```
|
123
|
+
|
104
124
|
## API
|
105
125
|
|
106
126
|
This SDK is fully consistent with restful API Voucherify provides.
|
@@ -192,6 +212,8 @@ Methods are provided within `voucherify.distributions.*` namespace.
|
|
192
212
|
- [Create Export](#create-export)
|
193
213
|
- [Get Export](#get-export)
|
194
214
|
- [Delete Export](#delete-export)
|
215
|
+
- [List Publications](#list-publications)
|
216
|
+
- [Create Publication](#create-publication)
|
195
217
|
|
196
218
|
#### [Publish Vouchers]
|
197
219
|
```ruby
|
@@ -209,7 +231,14 @@ voucherify.distributions.get_export(export_id)
|
|
209
231
|
```ruby
|
210
232
|
voucherify.distributions.delete_export(export_id)
|
211
233
|
```
|
212
|
-
|
234
|
+
#### [List Publications]
|
235
|
+
```ruby
|
236
|
+
voucherify.distributions.list_publications(params)
|
237
|
+
```
|
238
|
+
#### [Create Publication]
|
239
|
+
```ruby
|
240
|
+
voucherify.distributions.create_publication(publication)
|
241
|
+
```
|
213
242
|
---
|
214
243
|
|
215
244
|
### Validations API
|
@@ -325,11 +354,18 @@ voucherify.promotions.tiers.delete(promotions_tier_id)
|
|
325
354
|
### Customers API
|
326
355
|
Methods are provided within `voucherify.customers.*` namespace.
|
327
356
|
|
357
|
+
- [List Customers](#list-customers)
|
328
358
|
- [Create Customer](#create-customer)
|
329
359
|
- [Get Customer](#get-customer)
|
330
360
|
- [Update Customer](#update-customer)
|
331
361
|
- [Delete Customer](#delete-customer)
|
332
362
|
|
363
|
+
#### [List Customers]
|
364
|
+
```ruby
|
365
|
+
voucherify.customers.list(options)
|
366
|
+
```
|
367
|
+
Check [options](https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#list-customers).
|
368
|
+
|
333
369
|
#### [Create Customer]
|
334
370
|
```ruby
|
335
371
|
voucherify.customers.create(customer)
|
@@ -443,15 +479,15 @@ voucherify.validation_rules.delete(id);
|
|
443
479
|
|
444
480
|
#### [Create Validation Rule Assignment]
|
445
481
|
```ruby
|
446
|
-
voucherify.validation_rules.
|
482
|
+
voucherify.validation_rules.assignments.create(rule_id, assignment);
|
447
483
|
```
|
448
484
|
#### [List Validation Rule Assignments]
|
449
485
|
```ruby
|
450
|
-
voucherify.validation_rules.
|
486
|
+
voucherify.validation_rules.assignments.list(rule_id, query);
|
451
487
|
```
|
452
488
|
#### [Delete Validation Rule Assignment]
|
453
489
|
```ruby
|
454
|
-
voucherify.validation_rules.
|
490
|
+
voucherify.validation_rules.assignments.delete(rule_id, assignment_id);
|
455
491
|
```
|
456
492
|
---
|
457
493
|
|
@@ -477,6 +513,147 @@ voucherify.segments.delete(id);
|
|
477
513
|
|
478
514
|
---
|
479
515
|
|
516
|
+
### Orders API
|
517
|
+
|
518
|
+
#### [Create Order]
|
519
|
+
```ruby
|
520
|
+
voucherify.orders.create(order);
|
521
|
+
```
|
522
|
+
#### [Get Order]
|
523
|
+
```ruby
|
524
|
+
voucherify.orders.get(id);
|
525
|
+
```
|
526
|
+
#### [Update Order]
|
527
|
+
```ruby
|
528
|
+
voucherify.orders.update(id, order);
|
529
|
+
```
|
530
|
+
#### [List orders]
|
531
|
+
```ruby
|
532
|
+
voucherify.orders.list(params);
|
533
|
+
```
|
534
|
+
|
535
|
+
---
|
536
|
+
|
537
|
+
### Rewards API
|
538
|
+
|
539
|
+
#### [Create Rewards]
|
540
|
+
```ruby
|
541
|
+
voucherify.rewards.create(reward);
|
542
|
+
```
|
543
|
+
#### [Get Reward]
|
544
|
+
```ruby
|
545
|
+
voucherify.rewards.get(id);
|
546
|
+
```
|
547
|
+
#### [Update Reward]
|
548
|
+
```ruby
|
549
|
+
voucherify.rewards.update(id, reward);
|
550
|
+
```
|
551
|
+
#### [List Rewards]
|
552
|
+
```ruby
|
553
|
+
voucherify.rewards.list(params);
|
554
|
+
```
|
555
|
+
#### [Delete Reward]
|
556
|
+
```ruby
|
557
|
+
voucherify.rewards.delete(id);
|
558
|
+
```
|
559
|
+
|
560
|
+
#### [List Reward Assignments]
|
561
|
+
```ruby
|
562
|
+
voucherify.rewards.assignments.list(reward_id, query);
|
563
|
+
```
|
564
|
+
#### [Create Reward Assignment]
|
565
|
+
```ruby
|
566
|
+
voucherify.rewards.assignments.create(reward_id, assignment);
|
567
|
+
```
|
568
|
+
#### [Update Reward Assignment]
|
569
|
+
```ruby
|
570
|
+
voucherify.rewards.assignments.update(reward_id, assignment_id, assignment);
|
571
|
+
```
|
572
|
+
#### [Delete Reward Assignment]
|
573
|
+
```ruby
|
574
|
+
voucherify.rewards.assignments.delete(reward_id, assignment_id);
|
575
|
+
```
|
576
|
+
---
|
577
|
+
|
578
|
+
### Loyalties API
|
579
|
+
|
580
|
+
#### [List Loyalties]
|
581
|
+
```ruby
|
582
|
+
voucherify.loyalties.list(query);
|
583
|
+
```
|
584
|
+
#### [Create Loyalty]
|
585
|
+
```ruby
|
586
|
+
voucherify.loyalties.create(loyalty);
|
587
|
+
```
|
588
|
+
#### [Get Loyalty]
|
589
|
+
```ruby
|
590
|
+
voucherify.loyalties.get(id);
|
591
|
+
```
|
592
|
+
#### [Update Loyalty]
|
593
|
+
```ruby
|
594
|
+
voucherify.loyalties.update(id, loyalty);
|
595
|
+
```
|
596
|
+
#### [Delete Loyalty]
|
597
|
+
```ruby
|
598
|
+
voucherify.loyalties.delete(id);
|
599
|
+
```
|
600
|
+
|
601
|
+
#### [List Loyalty Reward Assignments]
|
602
|
+
```ruby
|
603
|
+
voucherify.loyalties.assignments.list(loyalty_id, query);
|
604
|
+
```
|
605
|
+
#### [Create Loyalty Reward Assignment]
|
606
|
+
```ruby
|
607
|
+
voucherify.loyalties.assignments.create(loyalty_id, assignment);
|
608
|
+
```
|
609
|
+
#### [Update Loyalty Reward Assignment]
|
610
|
+
```ruby
|
611
|
+
voucherify.loyalties.assignments.update(loyalty_id, assignment_id, assignment);
|
612
|
+
```
|
613
|
+
#### [Delete Loyalty Reward Assignment]
|
614
|
+
```ruby
|
615
|
+
voucherify.loyalties.assignments.delete(loyalty_id, assignment_id);
|
616
|
+
```
|
617
|
+
|
618
|
+
#### [List Loyalty Earning Rules]
|
619
|
+
```ruby
|
620
|
+
voucherify.loyalties.earning_rules.list(loyalty_id, query);
|
621
|
+
```
|
622
|
+
#### [Create Loyalty Earning Rule]
|
623
|
+
```ruby
|
624
|
+
voucherify.loyalties.earning_rules.create(loyalty_id, earning_rule);
|
625
|
+
```
|
626
|
+
#### [Update Loyalty Earning Rule]
|
627
|
+
```ruby
|
628
|
+
voucherify.loyalties.earning_rules.update(loyalty_id, earning_rule_id, earning_rule);
|
629
|
+
```
|
630
|
+
#### [Delete Loyalty Earning Rule]
|
631
|
+
```ruby
|
632
|
+
voucherify.loyalties.earning_rules.delete(loyalty_id, earning_rule_id);
|
633
|
+
```
|
634
|
+
|
635
|
+
#### [List Loyalty Members]
|
636
|
+
```ruby
|
637
|
+
voucherify.loyalties.members.list(loyalty_id, query);
|
638
|
+
```
|
639
|
+
#### [Add Loyalty Member]
|
640
|
+
```ruby
|
641
|
+
voucherify.loyalties.members.add(loyalty_id, member);
|
642
|
+
```
|
643
|
+
#### [Get Loyalty Member]
|
644
|
+
```ruby
|
645
|
+
voucherify.loyalties.members.get(loyalty_id, member_id);
|
646
|
+
```
|
647
|
+
#### [Add Loyalty Card Balance]
|
648
|
+
```ruby
|
649
|
+
voucherify.loyalties.members.add_balance(loyalty_id, member_id, add_balance);
|
650
|
+
```
|
651
|
+
#### [Redeem Loyalty Reward]
|
652
|
+
```ruby
|
653
|
+
voucherify.loyalties.members.redeem_reward(loyalty_id, member_id, redeem_reward);
|
654
|
+
```
|
655
|
+
---
|
656
|
+
|
480
657
|
### Events API
|
481
658
|
Methods are provided within `voucherify.events.*` namespace.
|
482
659
|
|
@@ -580,6 +757,11 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
580
757
|
Bug reports and pull requests are welcome on GitHub at https://github.com/rspective/voucherify-ruby-sdk.
|
581
758
|
|
582
759
|
## Changelog
|
760
|
+
- **2021-06-14** - `4.0.0` - Bumped required ruby version, bumped dependencies, added `Consents` API support, remove deprecated `URI.escape`.
|
761
|
+
- **2020-03-09** - `3.0.0` - Bumped required ruby version, bumped dependencies, added `list` method in Customers module.
|
762
|
+
- **2019-06-19** - `2.4.0` - Added support for custom API endpoint, that allows to connect to projects created in specific Voucherify region.
|
763
|
+
- **2019-05-09** - `2.3.0` - Added `create_publication` method in Distributions module.
|
764
|
+
- **2019-04-23** - `2.2.0` - Loyalties API, Rewards API, Orders API.
|
583
765
|
- **2019-02-19** - `2.1.1` - Treat `referral` as optional in custom events. Added new method for custom event tracking.
|
584
766
|
- **2019-02-19** - `2.1.0` - Handle `referral` in custom events tracking.
|
585
767
|
- **2018-12-27** - `2.0.0` - Business validation rules.
|
@@ -632,6 +814,8 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
632
814
|
[Create Export]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-export
|
633
815
|
[Get Export]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#get-export
|
634
816
|
[Delete Export]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#delete-export
|
817
|
+
[List Publications]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#list-publications
|
818
|
+
[Create Publication]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-publication
|
635
819
|
|
636
820
|
[Validate Voucher]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#validate-voucher
|
637
821
|
|
@@ -680,3 +864,40 @@ The gem is available as open source under the terms of the [MIT License](https:/
|
|
680
864
|
|
681
865
|
[Events]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#the-custom-event-object
|
682
866
|
[Create event]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-custom-event
|
867
|
+
|
868
|
+
[Create Order]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-order
|
869
|
+
[Get Order]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#get-order
|
870
|
+
[Update Order]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#update-order
|
871
|
+
[List orders]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#list-orders
|
872
|
+
|
873
|
+
[Create Rewards]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-reward
|
874
|
+
[Get Reward]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#get-reward
|
875
|
+
[Update Reward]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#update-reward
|
876
|
+
[List Rewards]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#list-rewards
|
877
|
+
[Delete Reward]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#delete-reward
|
878
|
+
[List Reward Assignments]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#list-reward-assignments
|
879
|
+
[Create Reward Assignment]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-reward-assgnment
|
880
|
+
[Update Reward Assignment]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#update-reward-assignment
|
881
|
+
[Delete Reward Assignment]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#delete-reward-assignment
|
882
|
+
|
883
|
+
[List Loyalties]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#list-loyalty-programs
|
884
|
+
[Create Loyalty]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-loyalty-program
|
885
|
+
[Get Loyalty]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#get-loyalty-program
|
886
|
+
[Update Loyalty]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#update-loyalty-program
|
887
|
+
[Delete Loyalty]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#delete-loyalty-program
|
888
|
+
|
889
|
+
[List Loyalty Reward Assignments]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#list-reward-assignments-1
|
890
|
+
[Create Loyalty Reward Assignment]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-reward-assignment-1
|
891
|
+
[Update Loyalty Reward Assignment]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#update-reward-assignment-1
|
892
|
+
[Delete Loyalty Reward Assignment]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#delete-reward-assignment-1
|
893
|
+
|
894
|
+
[List Loyalty Earning Rules]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#list-earning-rules
|
895
|
+
[Create Loyalty Earning Rule]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-earning-rule
|
896
|
+
[Update Loyalty Earning Rule]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#update-earning-rule
|
897
|
+
[Delete Loyalty Earning Rule]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#delete-earning-rule
|
898
|
+
|
899
|
+
[List Loyalty Members]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#list-members
|
900
|
+
[Add Loyalty Member]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-member
|
901
|
+
[Get Loyalty Member]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#get-member
|
902
|
+
[Add Loyalty Card Balance]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#add-loyalty-card-balance
|
903
|
+
[Redeem Loyalty Reward]:https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#redeem-loyalty-card
|
data/lib/voucherify.rb
CHANGED
@@ -4,15 +4,19 @@ require 'voucherify/service/campaigns'
|
|
4
4
|
require 'voucherify/service/customers'
|
5
5
|
require 'voucherify/service/distributions'
|
6
6
|
require 'voucherify/service/events'
|
7
|
+
require 'voucherify/service/loyalties'
|
8
|
+
require 'voucherify/service/orders'
|
7
9
|
require 'voucherify/service/products'
|
8
10
|
require 'voucherify/service/redemptions'
|
9
11
|
require 'voucherify/service/promotions'
|
12
|
+
require 'voucherify/service/rewards'
|
10
13
|
require 'voucherify/service/segments'
|
11
14
|
require 'voucherify/service/segments'
|
12
15
|
require 'voucherify/service/validation_rules'
|
13
16
|
require 'voucherify/service/validations'
|
14
17
|
require 'voucherify/service/vouchers'
|
18
|
+
require 'voucherify/service/consents'
|
15
19
|
require 'voucherify/utils'
|
16
20
|
|
17
21
|
module Voucherify
|
18
|
-
end
|
22
|
+
end
|
data/lib/voucherify/client.rb
CHANGED
@@ -9,7 +9,7 @@ module Voucherify
|
|
9
9
|
|
10
10
|
def initialize (options)
|
11
11
|
@options = options
|
12
|
-
@backend_url = 'https://api.voucherify.io/v1'
|
12
|
+
@backend_url = (@options[:apiUrl] || @options['apiUrl'] || 'https://api.voucherify.io') + '/v1'
|
13
13
|
@headers = {
|
14
14
|
'X-App-Id' => @options[:applicationId] || @options['applicationId'],
|
15
15
|
'X-App-Token' => @options[:clientSecretKey] || @options['clientSecretKey'],
|
@@ -64,6 +64,22 @@ module Voucherify
|
|
64
64
|
Voucherify::Service::Promotions.new(self)
|
65
65
|
end
|
66
66
|
|
67
|
+
def orders
|
68
|
+
Voucherify::Service::Orders.new(self)
|
69
|
+
end
|
70
|
+
|
71
|
+
def rewards
|
72
|
+
Voucherify::Service::Rewards.new(self)
|
73
|
+
end
|
74
|
+
|
75
|
+
def loyalties
|
76
|
+
Voucherify::Service::Loyalties.new(self)
|
77
|
+
end
|
78
|
+
|
79
|
+
def consents
|
80
|
+
Voucherify::Service::Consents.new(self)
|
81
|
+
end
|
82
|
+
|
67
83
|
def get(path, params = {})
|
68
84
|
begin
|
69
85
|
url = @backend_url + path
|
@@ -14,25 +14,25 @@ module Voucherify
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def get(campaign_name)
|
17
|
-
@client.get("/campaigns/#{
|
17
|
+
@client.get("/campaigns/#{ERB::Util.url_encode(campaign_name)}")
|
18
18
|
end
|
19
19
|
|
20
20
|
def delete(campaign_name, params = {})
|
21
|
-
@client.delete("/campaigns/#{
|
21
|
+
@client.delete("/campaigns/#{ERB::Util.url_encode(campaign_name)}", {:force => (!!(params['force'] || params[:force])).to_s})
|
22
22
|
nil
|
23
23
|
end
|
24
24
|
|
25
25
|
def add_voucher(campaign_name, params = {})
|
26
26
|
code = params['code'] || params[:code]
|
27
|
-
url = "/campaigns/#{
|
28
|
-
url += "/#{
|
27
|
+
url = "/campaigns/#{ERB::Util.url_encode(campaign_name)}/vouchers"
|
28
|
+
url += "/#{ERB::Util.url_encode(code)}" if code
|
29
29
|
params.delete 'code'
|
30
30
|
params.delete :code
|
31
31
|
@client.post(url, params.to_json)
|
32
32
|
end
|
33
33
|
|
34
34
|
def import_vouchers(campaign_name, vouchers)
|
35
|
-
@client.post("/campaigns/#{
|
35
|
+
@client.post("/campaigns/#{ERB::Util.url_encode(campaign_name)}/import", vouchers.to_json)
|
36
36
|
end
|
37
37
|
end
|
38
38
|
end
|
@@ -1,4 +1,4 @@
|
|
1
|
-
require '
|
1
|
+
require 'erb'
|
2
2
|
|
3
3
|
module Voucherify
|
4
4
|
module Service
|
@@ -9,21 +9,29 @@ module Voucherify
|
|
9
9
|
@client = client
|
10
10
|
end
|
11
11
|
|
12
|
+
def list(params = {})
|
13
|
+
@client.get('/customers', params)
|
14
|
+
end
|
15
|
+
|
12
16
|
def create(customer)
|
13
17
|
@client.post('/customers', customer.to_json)
|
14
18
|
end
|
15
19
|
|
16
20
|
def get(customer_id)
|
17
|
-
@client.get("/customers/#{
|
21
|
+
@client.get("/customers/#{ERB::Util.url_encode(customer_id)}")
|
18
22
|
end
|
19
23
|
|
20
24
|
def update(customer)
|
21
|
-
@client.put("/customers/#{
|
25
|
+
@client.put("/customers/#{ERB::Util.url_encode(customer['id'] || customer[:id])}", customer.to_json)
|
22
26
|
end
|
23
27
|
|
24
28
|
def delete(customer_id)
|
25
|
-
@client.delete("/customers/#{
|
29
|
+
@client.delete("/customers/#{ERB::Util.url_encode(customer_id)}")
|
30
|
+
end
|
31
|
+
|
32
|
+
def update_consents(customer_id, consents)
|
33
|
+
@client.put("/customers/#{ERB::Util.url_encode(customer_id)}/consents", consents.to_json)
|
26
34
|
end
|
27
35
|
end
|
28
36
|
end
|
29
|
-
end
|
37
|
+
end
|
@@ -25,17 +25,21 @@ module Voucherify
|
|
25
25
|
end
|
26
26
|
|
27
27
|
def get_export(id)
|
28
|
-
@client.get("/exports/#{
|
28
|
+
@client.get("/exports/#{ERB::Util.url_encode(id)}")
|
29
29
|
end
|
30
30
|
|
31
31
|
def delete_export(id)
|
32
|
-
@client.delete("/exports/#{
|
32
|
+
@client.delete("/exports/#{ERB::Util.url_encode(id)}")
|
33
33
|
end
|
34
34
|
|
35
35
|
def list_publications(params = {})
|
36
36
|
@client.get('/publications', params)
|
37
37
|
end
|
38
|
-
|
38
|
+
|
39
|
+
def create_publication(params)
|
40
|
+
@client.post('/publications', params.to_json)
|
41
|
+
end
|
42
|
+
|
39
43
|
end
|
40
44
|
end
|
41
|
-
end
|
45
|
+
end
|
@@ -0,0 +1,133 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
module Voucherify
|
4
|
+
module Service
|
5
|
+
class Loyalties
|
6
|
+
attr_reader :client
|
7
|
+
|
8
|
+
def initialize(client)
|
9
|
+
@client = client
|
10
|
+
end
|
11
|
+
|
12
|
+
def earning_rules
|
13
|
+
Voucherify::Service::LoyaltyEarningRules.new(@client)
|
14
|
+
end
|
15
|
+
|
16
|
+
def reward_assignments
|
17
|
+
Voucherify::Service::LoyaltyRewards.new(@client)
|
18
|
+
end
|
19
|
+
|
20
|
+
def members
|
21
|
+
Voucherify::Service::LoyaltyMembers.new(@client)
|
22
|
+
end
|
23
|
+
|
24
|
+
def list(query = {})
|
25
|
+
@client.get('/loyalties', query)
|
26
|
+
end
|
27
|
+
|
28
|
+
def create(loyalty)
|
29
|
+
@client.post("/loyalties", loyalty.to_json)
|
30
|
+
end
|
31
|
+
|
32
|
+
def update(loyalty_id, loyalty)
|
33
|
+
@client.put("/loyalties/#{ERB::Util.url_encode(loyalty_id)}", loyalty.to_json)
|
34
|
+
end
|
35
|
+
|
36
|
+
def get(loyalty_id)
|
37
|
+
@client.get("/loyalties/#{ERB::Util.url_encode(loyalty_id)}")
|
38
|
+
end
|
39
|
+
|
40
|
+
def delete(loyalty_id, query = {})
|
41
|
+
@client.delete("/loyalties/#{ERB::Util.url_encode(loyalty_id)}", query)
|
42
|
+
nil
|
43
|
+
end
|
44
|
+
end
|
45
|
+
|
46
|
+
class LoyaltyEarningRules
|
47
|
+
attr_reader :client
|
48
|
+
|
49
|
+
def initialize(client)
|
50
|
+
@client = client
|
51
|
+
end
|
52
|
+
|
53
|
+
def list(loyalty_id, query = {})
|
54
|
+
@client.get("/loyalties/#{ERB::Util.url_encode(loyalty_id)}/earning-rules", query)
|
55
|
+
end
|
56
|
+
|
57
|
+
def create(loyalty_id, earning_rules)
|
58
|
+
payload = earning_rules
|
59
|
+
if earning_rules.is_a? Hash
|
60
|
+
payload = [ earning_rules ]
|
61
|
+
end
|
62
|
+
@client.post("/loyalties/#{ERB::Util.url_encode(loyalty_id)}/earning-rules", payload.to_json)
|
63
|
+
end
|
64
|
+
|
65
|
+
def update(loyalty_id, earning_rule_id, earning_rule)
|
66
|
+
@client.put("/loyalties/#{ERB::Util.url_encode(loyalty_id)}/earning-rules/#{ERB::Util.url_encode(earning_rule_id)}", earning_rule.to_json)
|
67
|
+
end
|
68
|
+
|
69
|
+
def delete(loyalty_id, earning_rule_id)
|
70
|
+
@client.delete("/loyalties/#{ERB::Util.url_encode(loyalty_id)}/earning-rules/#{ERB::Util.url_encode(earning_rule_id)}")
|
71
|
+
nil
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
class LoyaltyRewards
|
76
|
+
attr_reader :client
|
77
|
+
|
78
|
+
def initialize(client)
|
79
|
+
@client = client
|
80
|
+
end
|
81
|
+
|
82
|
+
def list(loyalty_id, query = {})
|
83
|
+
@client.get("/loyalties/#{ERB::Util.url_encode(loyalty_id)}/rewards", query)
|
84
|
+
end
|
85
|
+
|
86
|
+
def create(loyalty_id, assignments)
|
87
|
+
payload = assignments
|
88
|
+
if assignments.is_a? Hash
|
89
|
+
payload = [ assignments ]
|
90
|
+
end
|
91
|
+
@client.post("/loyalties/#{ERB::Util.url_encode(loyalty_id)}/rewards", payload.to_json)
|
92
|
+
end
|
93
|
+
|
94
|
+
def update(loyalty_id, assignment_id, assignment)
|
95
|
+
@client.put("/loyalties/#{ERB::Util.url_encode(loyalty_id)}/rewards/#{ERB::Util.url_encode(assignment_id)}", assignment.to_json)
|
96
|
+
end
|
97
|
+
|
98
|
+
def delete(loyalty_id, assignment_id)
|
99
|
+
@client.delete("/loyalties/#{ERB::Util.url_encode(loyalty_id)}/rewards/#{ERB::Util.url_encode(assignment_id)}")
|
100
|
+
nil
|
101
|
+
end
|
102
|
+
end
|
103
|
+
|
104
|
+
class LoyaltyMembers
|
105
|
+
attr_reader :client
|
106
|
+
|
107
|
+
def initialize(client)
|
108
|
+
@client = client
|
109
|
+
end
|
110
|
+
|
111
|
+
def list(loyalty_id, query = {})
|
112
|
+
@client.get("/loyalties/#{ERB::Util.url_encode(loyalty_id)}/members", query)
|
113
|
+
end
|
114
|
+
|
115
|
+
def add(loyalty_id, member)
|
116
|
+
@client.post("/loyalties/#{ERB::Util.url_encode(loyalty_id)}/members", member.to_json)
|
117
|
+
end
|
118
|
+
|
119
|
+
def get(loyalty_id, member_id)
|
120
|
+
@client.get("/loyalties/#{ERB::Util.url_encode(loyalty_id)}/members/#{ERB::Util.url_encode(member_id)}")
|
121
|
+
end
|
122
|
+
|
123
|
+
def add_balance(loyalty_id, member_id, payload)
|
124
|
+
@client.post("/loyalties/#{ERB::Util.url_encode(loyalty_id)}/members/#{ERB::Util.url_encode(member_id)}/balance", payload.to_json)
|
125
|
+
end
|
126
|
+
|
127
|
+
def redeem_reward(loyalty_id, member_id, payload)
|
128
|
+
@client.post("/loyalties/#{ERB::Util.url_encode(loyalty_id)}/members/#{ERB::Util.url_encode(member_id)}/redemption", payload.to_json)
|
129
|
+
end
|
130
|
+
end
|
131
|
+
|
132
|
+
end
|
133
|
+
end
|
@@ -0,0 +1,29 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
module Voucherify
|
4
|
+
module Service
|
5
|
+
class Orders
|
6
|
+
attr_reader :client
|
7
|
+
|
8
|
+
def initialize(client)
|
9
|
+
@client = client
|
10
|
+
end
|
11
|
+
|
12
|
+
def create(order)
|
13
|
+
@client.post('/orders', order.to_json)
|
14
|
+
end
|
15
|
+
|
16
|
+
def get(order_id)
|
17
|
+
@client.get("/orders/#{ERB::Util.url_encode(order_id)}")
|
18
|
+
end
|
19
|
+
|
20
|
+
def update(order_id, order)
|
21
|
+
@client.put("/orders/#{ERB::Util.url_encode(order_id)}", order.to_json)
|
22
|
+
end
|
23
|
+
|
24
|
+
def list(query = {})
|
25
|
+
@client.get("/orders", query)
|
26
|
+
end
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
@@ -14,15 +14,15 @@ module Voucherify
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def get(product_id)
|
17
|
-
@client.get("/products/#{
|
17
|
+
@client.get("/products/#{ERB::Util.url_encode(product_id)}")
|
18
18
|
end
|
19
19
|
|
20
20
|
def update(product)
|
21
|
-
@client.put("/products/#{
|
21
|
+
@client.put("/products/#{ERB::Util.url_encode(product['id'] || product[:id])}", product.to_json)
|
22
22
|
end
|
23
23
|
|
24
24
|
def delete(product_id)
|
25
|
-
@client.delete("/products/#{
|
25
|
+
@client.delete("/products/#{ERB::Util.url_encode(product_id)}")
|
26
26
|
end
|
27
27
|
|
28
28
|
def list(query = {})
|
@@ -30,23 +30,23 @@ module Voucherify
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def create_sku(product_id, sku)
|
33
|
-
@client.post("/products/#{
|
33
|
+
@client.post("/products/#{ERB::Util.url_encode(product_id)}/skus", sku.to_json)
|
34
34
|
end
|
35
35
|
|
36
36
|
def get_sku(product_id, sku_id)
|
37
|
-
@client.get("/products/#{
|
37
|
+
@client.get("/products/#{ERB::Util.url_encode(product_id)}/skus/#{ERB::Util.url_encode(sku_id)}")
|
38
38
|
end
|
39
39
|
|
40
40
|
def update_sku(product_id, sku)
|
41
|
-
@client.put("/products/#{
|
41
|
+
@client.put("/products/#{ERB::Util.url_encode(product_id)}/skus/#{ERB::Util.url_encode(sku['id'] || sku[:id])}", sku.to_json)
|
42
42
|
end
|
43
43
|
|
44
44
|
def delete_sku(product_id, sku_id)
|
45
|
-
@client.delete("/products/#{
|
45
|
+
@client.delete("/products/#{ERB::Util.url_encode(product_id)}/skus/#{ERB::Util.url_encode(sku_id)}")
|
46
46
|
end
|
47
47
|
|
48
48
|
def list_skus(product_id)
|
49
|
-
@client.get("/products/#{
|
49
|
+
@client.get("/products/#{ERB::Util.url_encode(product_id)}/skus")
|
50
50
|
end
|
51
51
|
end
|
52
52
|
end
|
@@ -30,25 +30,29 @@ module Voucherify
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def list(promotion_id)
|
33
|
-
@client.get("/promotions/#{
|
33
|
+
@client.get("/promotions/#{ERB::Util.url_encode(promotion_id)}/tiers")
|
34
34
|
end
|
35
35
|
|
36
36
|
def create(promotion_id, promotion_tier)
|
37
|
-
@client.post("/promotions/#{
|
37
|
+
@client.post("/promotions/#{ERB::Util.url_encode(promotion_id)}/tiers", promotion_tier.to_json)
|
38
38
|
end
|
39
39
|
|
40
40
|
def redeem(promotions_tier_id, redemption_context)
|
41
|
-
@client.post("/promotions/tiers/#{
|
41
|
+
@client.post("/promotions/tiers/#{ERB::Util.url_encode(promotions_tier_id)}/redemption", redemption_context.to_json)
|
42
42
|
end
|
43
43
|
|
44
44
|
def update(promotions_tier)
|
45
|
-
@client.put("/promotions/tiers/#{
|
45
|
+
@client.put("/promotions/tiers/#{ERB::Util.url_encode(promotions_tier['id'] || promotions_tier[:id])}", promotions_tier.to_json)
|
46
46
|
end
|
47
47
|
|
48
48
|
def delete(promotions_tier_id)
|
49
|
-
@client.delete("/promotions/tiers/#{
|
49
|
+
@client.delete("/promotions/tiers/#{ERB::Util.url_encode(promotions_tier_id)}")
|
50
50
|
nil
|
51
51
|
end
|
52
|
+
|
53
|
+
def list_tiers(query = {})
|
54
|
+
@client.get("/promotions/tiers", query)
|
55
|
+
end
|
52
56
|
end
|
53
57
|
end
|
54
58
|
end
|
@@ -11,9 +11,9 @@ module Voucherify
|
|
11
11
|
|
12
12
|
def redeem(code, params = {})
|
13
13
|
if code.is_a? Hash
|
14
|
-
endpoint = "/promotions/tiers/#{
|
14
|
+
endpoint = "/promotions/tiers/#{ERB::Util.url_encode(code[:id] || code['id'])}/redemption"
|
15
15
|
else
|
16
|
-
endpoint = "/vouchers/#{
|
16
|
+
endpoint = "/vouchers/#{ERB::Util.url_encode(code)}/redemption"
|
17
17
|
end
|
18
18
|
@client.post(endpoint, params.to_json)
|
19
19
|
end
|
@@ -23,7 +23,7 @@ module Voucherify
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def get_for_voucher(code)
|
26
|
-
@client.get("/vouchers/#{
|
26
|
+
@client.get("/vouchers/#{ERB::Util.url_encode(code)}/redemption")
|
27
27
|
end
|
28
28
|
|
29
29
|
def rollback(redemption_id, payload = {})
|
@@ -31,12 +31,12 @@ module Voucherify
|
|
31
31
|
params = reason ? {:reason => reason} : {}
|
32
32
|
payload.delete 'reason'
|
33
33
|
payload.delete :reason
|
34
|
-
@client.post("/redemptions/#{
|
34
|
+
@client.post("/redemptions/#{ERB::Util.url_encode(redemption_id)}/rollback", payload.to_json, params)
|
35
35
|
end
|
36
36
|
|
37
37
|
def get_redemption(redemption_id)
|
38
|
-
@client.get("/redemptions/#{
|
38
|
+
@client.get("/redemptions/#{ERB::Util.url_encode(redemption_id)}")
|
39
39
|
end
|
40
40
|
end
|
41
41
|
end
|
42
|
-
end
|
42
|
+
end
|
@@ -0,0 +1,63 @@
|
|
1
|
+
require 'uri'
|
2
|
+
|
3
|
+
module Voucherify
|
4
|
+
module Service
|
5
|
+
class Rewards
|
6
|
+
attr_reader :client
|
7
|
+
|
8
|
+
def initialize(client)
|
9
|
+
@client = client
|
10
|
+
end
|
11
|
+
|
12
|
+
def assignments
|
13
|
+
Voucherify::Service::RewardAssignments.new(@client)
|
14
|
+
end
|
15
|
+
|
16
|
+
def create(reward)
|
17
|
+
@client.post('/rewards', reward.to_json)
|
18
|
+
end
|
19
|
+
|
20
|
+
def get(reward_id)
|
21
|
+
@client.get("/rewards/#{ERB::Util.url_encode(reward_id)}")
|
22
|
+
end
|
23
|
+
|
24
|
+
def update(reward_id, reward)
|
25
|
+
@client.put("/rewards/#{ERB::Util.url_encode(reward_id)}", reward.to_json)
|
26
|
+
end
|
27
|
+
|
28
|
+
def list(query = {})
|
29
|
+
@client.get("/rewards", query)
|
30
|
+
end
|
31
|
+
|
32
|
+
def delete(reward_id)
|
33
|
+
@client.delete("/rewards/#{ERB::Util.url_encode(reward_id)}")
|
34
|
+
nil
|
35
|
+
end
|
36
|
+
end
|
37
|
+
|
38
|
+
class RewardAssignments
|
39
|
+
attr_reader :client
|
40
|
+
|
41
|
+
def initialize(client)
|
42
|
+
@client = client
|
43
|
+
end
|
44
|
+
|
45
|
+
def list(reward_id, query = {})
|
46
|
+
@client.get("/rewards/#{ERB::Util.url_encode(reward_id)}/assignments", query)
|
47
|
+
end
|
48
|
+
|
49
|
+
def create(reward_id, assignment)
|
50
|
+
@client.post("/rewards/#{ERB::Util.url_encode(reward_id)}/assignments", assignment.to_json)
|
51
|
+
end
|
52
|
+
|
53
|
+
def update(reward_id, assignment_id, assignment)
|
54
|
+
@client.put("/rewards/#{ERB::Util.url_encode(reward_id)}/assignments/#{ERB::Util.url_encode(assignment_id)}", assignment.to_json)
|
55
|
+
end
|
56
|
+
|
57
|
+
def delete(reward_id, assignment_id)
|
58
|
+
@client.delete("/rewards/#{ERB::Util.url_encode(reward_id)}/assignments/#{ERB::Util.url_encode(assignment_id)}")
|
59
|
+
nil
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
63
|
+
end
|
@@ -14,11 +14,11 @@ module Voucherify
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def get(id)
|
17
|
-
@client.get("/segments/#{
|
17
|
+
@client.get("/segments/#{ERB::Util.url_encode(id)}")
|
18
18
|
end
|
19
19
|
|
20
20
|
def delete(id)
|
21
|
-
@client.delete("/segments/#{
|
21
|
+
@client.delete("/segments/#{ERB::Util.url_encode(id)}")
|
22
22
|
end
|
23
23
|
end
|
24
24
|
end
|
@@ -9,6 +9,10 @@ module Voucherify
|
|
9
9
|
@client = client
|
10
10
|
end
|
11
11
|
|
12
|
+
def assignments
|
13
|
+
Voucherify::Service::ValidationRulesAssignments.new(@client)
|
14
|
+
end
|
15
|
+
|
12
16
|
def create(validation_rules)
|
13
17
|
@client.post('/validation-rules', validation_rules.to_json)
|
14
18
|
end
|
@@ -18,27 +22,47 @@ module Voucherify
|
|
18
22
|
end
|
19
23
|
|
20
24
|
def get(id)
|
21
|
-
@client.get("/validation-rules/#{
|
25
|
+
@client.get("/validation-rules/#{ERB::Util.url_encode(id)}")
|
22
26
|
end
|
23
27
|
|
24
28
|
def update(validation_rules)
|
25
|
-
@client.put("/validation-rules/#{
|
29
|
+
@client.put("/validation-rules/#{ERB::Util.url_encode(validation_rules['id'] || validation_rules[:id])}", validation_rules.to_json)
|
26
30
|
end
|
27
31
|
|
28
32
|
def delete(id)
|
29
|
-
@client.delete("/validation-rules/#{
|
33
|
+
@client.delete("/validation-rules/#{ERB::Util.url_encode(id)}")
|
30
34
|
end
|
31
35
|
|
32
36
|
def createAssignment(id, assignment)
|
33
|
-
@client.post("/validation-rules/#{
|
37
|
+
@client.post("/validation-rules/#{ERB::Util.url_encode(id)}/assignments", assignment.to_json)
|
34
38
|
end
|
35
39
|
|
36
40
|
def deleteAssignment(rule_id, assignment_id)
|
37
|
-
@client.delete("/validation-rules/#{
|
41
|
+
@client.delete("/validation-rules/#{ERB::Util.url_encode(rule_id)}/assignments/#{ERB::Util.url_encode(assignment_id)}")
|
38
42
|
end
|
39
43
|
|
40
44
|
def listAssignments(id, query)
|
41
|
-
@client.get("/validation-rules/#{
|
45
|
+
@client.get("/validation-rules/#{ERB::Util.url_encode(id)}/assignments", query)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
|
49
|
+
class ValidationRulesAssignments
|
50
|
+
attr_reader :client
|
51
|
+
|
52
|
+
def initialize(client)
|
53
|
+
@client = client
|
54
|
+
end
|
55
|
+
|
56
|
+
def create(rule_id, assignment)
|
57
|
+
@client.post("/validation-rules/#{ERB::Util.url_encode(rule_id)}/assignments", assignment.to_json)
|
58
|
+
end
|
59
|
+
|
60
|
+
def delete(rule_id, assignment_id)
|
61
|
+
@client.delete("/validation-rules/#{ERB::Util.url_encode(rule_id)}/assignments/#{ERB::Util.url_encode(assignment_id)}")
|
62
|
+
end
|
63
|
+
|
64
|
+
def list(rule_id, query)
|
65
|
+
@client.get("/validation-rules/#{ERB::Util.url_encode(rule_id)}/assignments", query)
|
42
66
|
end
|
43
67
|
end
|
44
68
|
end
|
@@ -10,7 +10,7 @@ module Voucherify
|
|
10
10
|
end
|
11
11
|
|
12
12
|
def validate_voucher(code, context = {})
|
13
|
-
@client.post("/vouchers/#{
|
13
|
+
@client.post("/vouchers/#{ERB::Util.url_encode(code)}/validate", context.to_json)
|
14
14
|
end
|
15
15
|
|
16
16
|
def validate(code, context = {})
|
@@ -23,4 +23,4 @@ module Voucherify
|
|
23
23
|
|
24
24
|
end
|
25
25
|
end
|
26
|
-
end
|
26
|
+
end
|
@@ -11,16 +11,16 @@ module Voucherify
|
|
11
11
|
|
12
12
|
def create(code, options = {})
|
13
13
|
url = '/vouchers'
|
14
|
-
url += '/' +
|
14
|
+
url += '/' + ERB::Util.url_encode(code) if code
|
15
15
|
@client.post(url, options.to_json)
|
16
16
|
end
|
17
17
|
|
18
18
|
def get(code)
|
19
|
-
@client.get("/vouchers/#{
|
19
|
+
@client.get("/vouchers/#{ERB::Util.url_encode(code)}")
|
20
20
|
end
|
21
21
|
|
22
22
|
def update(voucher_update)
|
23
|
-
@client.put("/vouchers/#{
|
23
|
+
@client.put("/vouchers/#{ERB::Util.url_encode(voucher_update['code'] || voucher_update[:code])}", voucher_update.to_json)
|
24
24
|
end
|
25
25
|
|
26
26
|
def list(query)
|
@@ -28,17 +28,17 @@ module Voucherify
|
|
28
28
|
end
|
29
29
|
|
30
30
|
def enable(code)
|
31
|
-
@client.post("/vouchers/#{
|
31
|
+
@client.post("/vouchers/#{ERB::Util.url_encode(code)}/enable", nil)
|
32
32
|
nil
|
33
33
|
end
|
34
34
|
|
35
35
|
def disable(code)
|
36
|
-
@client.post("/vouchers/#{
|
36
|
+
@client.post("/vouchers/#{ERB::Util.url_encode(code)}/disable", nil)
|
37
37
|
nil
|
38
38
|
end
|
39
39
|
|
40
40
|
def delete(code, params = {})
|
41
|
-
@client.delete("/vouchers/#{
|
41
|
+
@client.delete("/vouchers/#{ERB::Util.url_encode(code)}", {:force => (!!(params['force'] || params[:force])).to_s})
|
42
42
|
nil
|
43
43
|
end
|
44
44
|
|
@@ -47,7 +47,7 @@ module Voucherify
|
|
47
47
|
end
|
48
48
|
|
49
49
|
def add_balance(code, balance)
|
50
|
-
@client.post("/vouchers/#{
|
50
|
+
@client.post("/vouchers/#{ERB::Util.url_encode(code)}/balance", balance.to_json)
|
51
51
|
end
|
52
52
|
end
|
53
53
|
end
|
data/lib/voucherify/version.rb
CHANGED
data/voucherify.gemspec
CHANGED
@@ -18,11 +18,11 @@ Gem::Specification.new do |spec|
|
|
18
18
|
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
19
19
|
spec.require_paths = ['lib']
|
20
20
|
|
21
|
-
spec.add_development_dependency 'rake', '~>
|
22
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
23
|
-
spec.add_development_dependency 'webmock', '~>
|
21
|
+
spec.add_development_dependency 'rake', '~> 13.0.3'
|
22
|
+
spec.add_development_dependency 'rspec', '~> 3.9.0'
|
23
|
+
spec.add_development_dependency 'webmock', '~> 3.8.2'
|
24
24
|
|
25
|
-
spec.add_dependency 'rest-client', '~> 2.0'
|
25
|
+
spec.add_dependency 'rest-client', '~> 2.1.0'
|
26
26
|
|
27
|
-
spec.required_ruby_version = '>= 2.
|
27
|
+
spec.required_ruby_version = '>= 2.2.0'
|
28
28
|
end
|
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:
|
4
|
+
version: 4.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- pawelrychlik
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-14 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -16,56 +16,56 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 13.0.3
|
20
20
|
type: :development
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
24
|
- - "~>"
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 13.0.3
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
28
|
name: rspec
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version:
|
33
|
+
version: 3.9.0
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version:
|
40
|
+
version: 3.9.0
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: webmock
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version:
|
47
|
+
version: 3.8.2
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version:
|
54
|
+
version: 3.8.2
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rest-client
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version:
|
61
|
+
version: 2.1.0
|
62
62
|
type: :runtime
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version:
|
68
|
+
version: 2.1.0
|
69
69
|
description:
|
70
70
|
email:
|
71
71
|
- pawel.rychlik@rspective.pl
|
@@ -88,12 +88,16 @@ files:
|
|
88
88
|
- lib/voucherify.rb
|
89
89
|
- lib/voucherify/client.rb
|
90
90
|
- lib/voucherify/service/campaigns.rb
|
91
|
+
- lib/voucherify/service/consents.rb
|
91
92
|
- lib/voucherify/service/customers.rb
|
92
93
|
- lib/voucherify/service/distributions.rb
|
93
94
|
- lib/voucherify/service/events.rb
|
95
|
+
- lib/voucherify/service/loyalties.rb
|
96
|
+
- lib/voucherify/service/orders.rb
|
94
97
|
- lib/voucherify/service/products.rb
|
95
98
|
- lib/voucherify/service/promotions.rb
|
96
99
|
- lib/voucherify/service/redemptions.rb
|
100
|
+
- lib/voucherify/service/rewards.rb
|
97
101
|
- lib/voucherify/service/segments.rb
|
98
102
|
- lib/voucherify/service/validation_rules.rb
|
99
103
|
- lib/voucherify/service/validations.rb
|
@@ -114,15 +118,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
114
118
|
requirements:
|
115
119
|
- - ">="
|
116
120
|
- !ruby/object:Gem::Version
|
117
|
-
version: 2.
|
121
|
+
version: 2.2.0
|
118
122
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
119
123
|
requirements:
|
120
124
|
- - ">="
|
121
125
|
- !ruby/object:Gem::Version
|
122
126
|
version: '0'
|
123
127
|
requirements: []
|
124
|
-
|
125
|
-
rubygems_version: 2.5.1
|
128
|
+
rubygems_version: 3.0.3
|
126
129
|
signing_key:
|
127
130
|
specification_version: 4
|
128
131
|
summary: Ruby SDK for Voucherify. More info on http://www.voucherify.io
|