voucherify 3.0.0 → 4.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/README.md +1 -0
- data/lib/voucherify.rb +1 -0
- data/lib/voucherify/client.rb +4 -0
- data/lib/voucherify/service/campaigns.rb +5 -5
- data/lib/voucherify/service/consents.rb +17 -0
- data/lib/voucherify/service/customers.rb +8 -4
- data/lib/voucherify/service/distributions.rb +3 -3
- data/lib/voucherify/service/loyalties.rb +19 -19
- data/lib/voucherify/service/orders.rb +2 -2
- data/lib/voucherify/service/products.rb +8 -8
- data/lib/voucherify/service/promotions.rb +5 -5
- data/lib/voucherify/service/redemptions.rb +5 -5
- data/lib/voucherify/service/rewards.rb +7 -7
- data/lib/voucherify/service/segments.rb +2 -2
- data/lib/voucherify/service/validation_rules.rb +9 -9
- data/lib/voucherify/service/validations.rb +1 -1
- data/lib/voucherify/service/vouchers.rb +7 -7
- data/lib/voucherify/version.rb +1 -1
- data/voucherify.gemspec +3 -3
- metadata +9 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
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/.travis.yml
CHANGED
data/README.md
CHANGED
@@ -757,6 +757,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
757
757
|
Bug reports and pull requests are welcome on GitHub at https://github.com/rspective/voucherify-ruby-sdk.
|
758
758
|
|
759
759
|
## Changelog
|
760
|
+
- **2021-06-14** - `4.0.0` - Bumped required ruby version, bumped dependencies, added `Consents` API support, remove deprecated `URI.escape`.
|
760
761
|
- **2020-03-09** - `3.0.0` - Bumped required ruby version, bumped dependencies, added `list` method in Customers module.
|
761
762
|
- **2019-06-19** - `2.4.0` - Added support for custom API endpoint, that allows to connect to projects created in specific Voucherify region.
|
762
763
|
- **2019-05-09** - `2.3.0` - Added `create_publication` method in Distributions module.
|
data/lib/voucherify.rb
CHANGED
@@ -15,6 +15,7 @@ require 'voucherify/service/segments'
|
|
15
15
|
require 'voucherify/service/validation_rules'
|
16
16
|
require 'voucherify/service/validations'
|
17
17
|
require 'voucherify/service/vouchers'
|
18
|
+
require 'voucherify/service/consents'
|
18
19
|
require 'voucherify/utils'
|
19
20
|
|
20
21
|
module Voucherify
|
data/lib/voucherify/client.rb
CHANGED
@@ -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
|
@@ -18,15 +18,19 @@ module Voucherify
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def get(customer_id)
|
21
|
-
@client.get("/customers/#{
|
21
|
+
@client.get("/customers/#{ERB::Util.url_encode(customer_id)}")
|
22
22
|
end
|
23
23
|
|
24
24
|
def update(customer)
|
25
|
-
@client.put("/customers/#{
|
25
|
+
@client.put("/customers/#{ERB::Util.url_encode(customer['id'] || customer[:id])}", customer.to_json)
|
26
26
|
end
|
27
27
|
|
28
28
|
def delete(customer_id)
|
29
|
-
@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)
|
30
34
|
end
|
31
35
|
end
|
32
36
|
end
|
@@ -25,11 +25,11 @@ 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 = {})
|
@@ -39,7 +39,7 @@ module Voucherify
|
|
39
39
|
def create_publication(params)
|
40
40
|
@client.post('/publications', params.to_json)
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
end
|
44
44
|
end
|
45
45
|
end
|
@@ -30,15 +30,15 @@ module Voucherify
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def update(loyalty_id, loyalty)
|
33
|
-
@client.put("/loyalties/#{
|
33
|
+
@client.put("/loyalties/#{ERB::Util.url_encode(loyalty_id)}", loyalty.to_json)
|
34
34
|
end
|
35
35
|
|
36
36
|
def get(loyalty_id)
|
37
|
-
@client.get("/loyalties/#{
|
37
|
+
@client.get("/loyalties/#{ERB::Util.url_encode(loyalty_id)}")
|
38
38
|
end
|
39
39
|
|
40
40
|
def delete(loyalty_id, query = {})
|
41
|
-
@client.delete("/loyalties/#{
|
41
|
+
@client.delete("/loyalties/#{ERB::Util.url_encode(loyalty_id)}", query)
|
42
42
|
nil
|
43
43
|
end
|
44
44
|
end
|
@@ -51,7 +51,7 @@ module Voucherify
|
|
51
51
|
end
|
52
52
|
|
53
53
|
def list(loyalty_id, query = {})
|
54
|
-
@client.get("/loyalties/#{
|
54
|
+
@client.get("/loyalties/#{ERB::Util.url_encode(loyalty_id)}/earning-rules", query)
|
55
55
|
end
|
56
56
|
|
57
57
|
def create(loyalty_id, earning_rules)
|
@@ -59,15 +59,15 @@ module Voucherify
|
|
59
59
|
if earning_rules.is_a? Hash
|
60
60
|
payload = [ earning_rules ]
|
61
61
|
end
|
62
|
-
@client.post("/loyalties/#{
|
62
|
+
@client.post("/loyalties/#{ERB::Util.url_encode(loyalty_id)}/earning-rules", payload.to_json)
|
63
63
|
end
|
64
64
|
|
65
65
|
def update(loyalty_id, earning_rule_id, earning_rule)
|
66
|
-
@client.put("/loyalties/#{
|
66
|
+
@client.put("/loyalties/#{ERB::Util.url_encode(loyalty_id)}/earning-rules/#{ERB::Util.url_encode(earning_rule_id)}", earning_rule.to_json)
|
67
67
|
end
|
68
68
|
|
69
69
|
def delete(loyalty_id, earning_rule_id)
|
70
|
-
@client.delete("/loyalties/#{
|
70
|
+
@client.delete("/loyalties/#{ERB::Util.url_encode(loyalty_id)}/earning-rules/#{ERB::Util.url_encode(earning_rule_id)}")
|
71
71
|
nil
|
72
72
|
end
|
73
73
|
end
|
@@ -80,7 +80,7 @@ module Voucherify
|
|
80
80
|
end
|
81
81
|
|
82
82
|
def list(loyalty_id, query = {})
|
83
|
-
@client.get("/loyalties/#{
|
83
|
+
@client.get("/loyalties/#{ERB::Util.url_encode(loyalty_id)}/rewards", query)
|
84
84
|
end
|
85
85
|
|
86
86
|
def create(loyalty_id, assignments)
|
@@ -88,15 +88,15 @@ module Voucherify
|
|
88
88
|
if assignments.is_a? Hash
|
89
89
|
payload = [ assignments ]
|
90
90
|
end
|
91
|
-
@client.post("/loyalties/#{
|
91
|
+
@client.post("/loyalties/#{ERB::Util.url_encode(loyalty_id)}/rewards", payload.to_json)
|
92
92
|
end
|
93
93
|
|
94
94
|
def update(loyalty_id, assignment_id, assignment)
|
95
|
-
@client.put("/loyalties/#{
|
95
|
+
@client.put("/loyalties/#{ERB::Util.url_encode(loyalty_id)}/rewards/#{ERB::Util.url_encode(assignment_id)}", assignment.to_json)
|
96
96
|
end
|
97
97
|
|
98
98
|
def delete(loyalty_id, assignment_id)
|
99
|
-
@client.delete("/loyalties/#{
|
99
|
+
@client.delete("/loyalties/#{ERB::Util.url_encode(loyalty_id)}/rewards/#{ERB::Util.url_encode(assignment_id)}")
|
100
100
|
nil
|
101
101
|
end
|
102
102
|
end
|
@@ -108,24 +108,24 @@ module Voucherify
|
|
108
108
|
@client = client
|
109
109
|
end
|
110
110
|
|
111
|
-
def list(loyalty_id, query = {})
|
112
|
-
@client.get("/loyalties/#{
|
111
|
+
def list(loyalty_id, query = {})
|
112
|
+
@client.get("/loyalties/#{ERB::Util.url_encode(loyalty_id)}/members", query)
|
113
113
|
end
|
114
114
|
|
115
|
-
def add(loyalty_id, member)
|
116
|
-
@client.post("/loyalties/#{
|
115
|
+
def add(loyalty_id, member)
|
116
|
+
@client.post("/loyalties/#{ERB::Util.url_encode(loyalty_id)}/members", member.to_json)
|
117
117
|
end
|
118
118
|
|
119
|
-
def get(loyalty_id, member_id)
|
120
|
-
@client.get("/loyalties/#{
|
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
121
|
end
|
122
122
|
|
123
123
|
def add_balance(loyalty_id, member_id, payload)
|
124
|
-
@client.post("/loyalties/#{
|
124
|
+
@client.post("/loyalties/#{ERB::Util.url_encode(loyalty_id)}/members/#{ERB::Util.url_encode(member_id)}/balance", payload.to_json)
|
125
125
|
end
|
126
126
|
|
127
127
|
def redeem_reward(loyalty_id, member_id, payload)
|
128
|
-
@client.post("/loyalties/#{
|
128
|
+
@client.post("/loyalties/#{ERB::Util.url_encode(loyalty_id)}/members/#{ERB::Util.url_encode(member_id)}/redemption", payload.to_json)
|
129
129
|
end
|
130
130
|
end
|
131
131
|
|
@@ -14,11 +14,11 @@ module Voucherify
|
|
14
14
|
end
|
15
15
|
|
16
16
|
def get(order_id)
|
17
|
-
@client.get("/orders/#{
|
17
|
+
@client.get("/orders/#{ERB::Util.url_encode(order_id)}")
|
18
18
|
end
|
19
19
|
|
20
20
|
def update(order_id, order)
|
21
|
-
@client.put("/orders/#{
|
21
|
+
@client.put("/orders/#{ERB::Util.url_encode(order_id)}", order.to_json)
|
22
22
|
end
|
23
23
|
|
24
24
|
def list(query = {})
|
@@ -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,23 +30,23 @@ 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
52
|
|
@@ -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,11 +31,11 @@ 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
|
@@ -18,11 +18,11 @@ module Voucherify
|
|
18
18
|
end
|
19
19
|
|
20
20
|
def get(reward_id)
|
21
|
-
@client.get("/rewards/#{
|
21
|
+
@client.get("/rewards/#{ERB::Util.url_encode(reward_id)}")
|
22
22
|
end
|
23
23
|
|
24
24
|
def update(reward_id, reward)
|
25
|
-
@client.put("/rewards/#{
|
25
|
+
@client.put("/rewards/#{ERB::Util.url_encode(reward_id)}", reward.to_json)
|
26
26
|
end
|
27
27
|
|
28
28
|
def list(query = {})
|
@@ -30,7 +30,7 @@ module Voucherify
|
|
30
30
|
end
|
31
31
|
|
32
32
|
def delete(reward_id)
|
33
|
-
@client.delete("/rewards/#{
|
33
|
+
@client.delete("/rewards/#{ERB::Util.url_encode(reward_id)}")
|
34
34
|
nil
|
35
35
|
end
|
36
36
|
end
|
@@ -43,19 +43,19 @@ module Voucherify
|
|
43
43
|
end
|
44
44
|
|
45
45
|
def list(reward_id, query = {})
|
46
|
-
@client.get("/rewards/#{
|
46
|
+
@client.get("/rewards/#{ERB::Util.url_encode(reward_id)}/assignments", query)
|
47
47
|
end
|
48
48
|
|
49
49
|
def create(reward_id, assignment)
|
50
|
-
@client.post("/rewards/#{
|
50
|
+
@client.post("/rewards/#{ERB::Util.url_encode(reward_id)}/assignments", assignment.to_json)
|
51
51
|
end
|
52
52
|
|
53
53
|
def update(reward_id, assignment_id, assignment)
|
54
|
-
@client.put("/rewards/#{
|
54
|
+
@client.put("/rewards/#{ERB::Util.url_encode(reward_id)}/assignments/#{ERB::Util.url_encode(assignment_id)}", assignment.to_json)
|
55
55
|
end
|
56
56
|
|
57
57
|
def delete(reward_id, assignment_id)
|
58
|
-
@client.delete("/rewards/#{
|
58
|
+
@client.delete("/rewards/#{ERB::Util.url_encode(reward_id)}/assignments/#{ERB::Util.url_encode(assignment_id)}")
|
59
59
|
nil
|
60
60
|
end
|
61
61
|
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
|
@@ -22,27 +22,27 @@ module Voucherify
|
|
22
22
|
end
|
23
23
|
|
24
24
|
def get(id)
|
25
|
-
@client.get("/validation-rules/#{
|
25
|
+
@client.get("/validation-rules/#{ERB::Util.url_encode(id)}")
|
26
26
|
end
|
27
27
|
|
28
28
|
def update(validation_rules)
|
29
|
-
@client.put("/validation-rules/#{
|
29
|
+
@client.put("/validation-rules/#{ERB::Util.url_encode(validation_rules['id'] || validation_rules[:id])}", validation_rules.to_json)
|
30
30
|
end
|
31
31
|
|
32
32
|
def delete(id)
|
33
|
-
@client.delete("/validation-rules/#{
|
33
|
+
@client.delete("/validation-rules/#{ERB::Util.url_encode(id)}")
|
34
34
|
end
|
35
35
|
|
36
36
|
def createAssignment(id, assignment)
|
37
|
-
@client.post("/validation-rules/#{
|
37
|
+
@client.post("/validation-rules/#{ERB::Util.url_encode(id)}/assignments", assignment.to_json)
|
38
38
|
end
|
39
39
|
|
40
40
|
def deleteAssignment(rule_id, assignment_id)
|
41
|
-
@client.delete("/validation-rules/#{
|
41
|
+
@client.delete("/validation-rules/#{ERB::Util.url_encode(rule_id)}/assignments/#{ERB::Util.url_encode(assignment_id)}")
|
42
42
|
end
|
43
43
|
|
44
44
|
def listAssignments(id, query)
|
45
|
-
@client.get("/validation-rules/#{
|
45
|
+
@client.get("/validation-rules/#{ERB::Util.url_encode(id)}/assignments", query)
|
46
46
|
end
|
47
47
|
end
|
48
48
|
|
@@ -54,15 +54,15 @@ module Voucherify
|
|
54
54
|
end
|
55
55
|
|
56
56
|
def create(rule_id, assignment)
|
57
|
-
@client.post("/validation-rules/#{
|
57
|
+
@client.post("/validation-rules/#{ERB::Util.url_encode(rule_id)}/assignments", assignment.to_json)
|
58
58
|
end
|
59
59
|
|
60
60
|
def delete(rule_id, assignment_id)
|
61
|
-
@client.delete("/validation-rules/#{
|
61
|
+
@client.delete("/validation-rules/#{ERB::Util.url_encode(rule_id)}/assignments/#{ERB::Util.url_encode(assignment_id)}")
|
62
62
|
end
|
63
63
|
|
64
64
|
def list(rule_id, query)
|
65
|
-
@client.get("/validation-rules/#{
|
65
|
+
@client.get("/validation-rules/#{ERB::Util.url_encode(rule_id)}/assignments", query)
|
66
66
|
end
|
67
67
|
end
|
68
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 = {})
|
@@ -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', '~> 13.0.
|
22
|
-
spec.add_development_dependency 'rspec', '~> 3.0'
|
21
|
+
spec.add_development_dependency 'rake', '~> 13.0.3'
|
22
|
+
spec.add_development_dependency 'rspec', '~> 3.9.0'
|
23
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
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,28 +16,28 @@ dependencies:
|
|
16
16
|
requirements:
|
17
17
|
- - "~>"
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version: 13.0.
|
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: 13.0.
|
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
|
@@ -58,14 +58,14 @@ dependencies:
|
|
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,6 +88,7 @@ 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
|