voucherify 1.6.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/.gitignore +2 -0
- data/README.md +28 -2
- data/lib/voucherify/client.rb +4 -4
- data/lib/voucherify/service/validation_rules.rb +17 -1
- data/lib/voucherify/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: f8ac6d52818e46207444a2952c1964fcc5a45a53ec0096861ef12eda70ef2885
|
4
|
+
data.tar.gz: a6c2938be5738f7fcfc8c230d4327f08f1a9c83c75f896efd8b82a28d0955e34
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b426e5e0bf1fe56777d035f6ee30333f9cda97da05199352375e1e90f02f9ac066d49a8168fbfe8d3def6575765d570d5d69c8723b24dbd47a0f011baa2b36c3
|
7
|
+
data.tar.gz: 7fff7556ee805f0cae6268fc115a6a58e9def21132658b3c4d425b56419e0f959f3aa1f32b29f1eb8dfc393745d4fb45c8839b3bd48259ee96aeccbbe315c71c
|
data/.gitignore
CHANGED
data/README.md
CHANGED
@@ -412,9 +412,14 @@ Methods are provided within `voucherify.validation_rules.*` namespace.
|
|
412
412
|
|
413
413
|
- [Create Validation Rules](#create-validation-rules)
|
414
414
|
- [Get Validation Rules](#get-validation-rules)
|
415
|
+
- [List Validation Rules](#list-validation-rules)
|
415
416
|
- [Update Validation Rules](#update-validation-rules)
|
416
417
|
- [Delete Validation Rules](#delete-validation-rules)
|
417
418
|
|
419
|
+
- [Create Validation Rule Assignment](#create-validation-rule-assignment)
|
420
|
+
- [List Validation Rule Assignments](#list-validation-rule-assignments)
|
421
|
+
- [Delete Validation Rule Assignment](#delete-validation-rule-assignment)
|
422
|
+
|
418
423
|
#### [Create Validation Rules]
|
419
424
|
```ruby
|
420
425
|
voucherify.validation_rules.create(rules);
|
@@ -423,6 +428,10 @@ voucherify.validation_rules.create(rules);
|
|
423
428
|
```ruby
|
424
429
|
voucherify.validation_rules.get(id);
|
425
430
|
```
|
431
|
+
#### [List Validation Rules]
|
432
|
+
```ruby
|
433
|
+
voucherify.validation_rules.list(query);
|
434
|
+
```
|
426
435
|
#### [Update Validation Rules]
|
427
436
|
```ruby
|
428
437
|
voucherify.validation_rules.update(rules);
|
@@ -432,6 +441,18 @@ voucherify.validation_rules.update(rules);
|
|
432
441
|
voucherify.validation_rules.delete(id);
|
433
442
|
```
|
434
443
|
|
444
|
+
#### [Create Validation Rule Assignment]
|
445
|
+
```ruby
|
446
|
+
voucherify.validation_rules.createAssignment(rule_id, assignment);
|
447
|
+
```
|
448
|
+
#### [List Validation Rule Assignments]
|
449
|
+
```ruby
|
450
|
+
voucherify.validation_rules.listAssignments(rule_id, query);
|
451
|
+
```
|
452
|
+
#### [Delete Validation Rule Assignment]
|
453
|
+
```ruby
|
454
|
+
voucherify.validation_rules.deleteAssignment(rule_id, assignment_id);
|
455
|
+
```
|
435
456
|
---
|
436
457
|
|
437
458
|
### Segments API
|
@@ -556,6 +577,7 @@ To install this gem onto your local machine, run `bundle exec rake install`. To
|
|
556
577
|
Bug reports and pull requests are welcome on GitHub at https://github.com/rspective/voucherify-ruby-sdk.
|
557
578
|
|
558
579
|
## Changelog
|
580
|
+
- **2018-12-27** - `2.0.0` - Business validation rules.
|
559
581
|
- **2018-09-05** - `1.6.1` - Request timeout settings
|
560
582
|
- **2017-11-16** - `1.6.0` - Expose promotion API, Redemptions and Validations namespace update
|
561
583
|
- **2017-11-16** - `1.5.0` - Expose events API
|
@@ -564,8 +586,8 @@ Bug reports and pull requests are welcome on GitHub at https://github.com/rspect
|
|
564
586
|
- **2017-01-04** - `1.2.0` - added [import vouchers](#import-vouchers) method.
|
565
587
|
- **2016-12-29** - `1.1.0` - introduced [campaigns api](#campaigns-api) and [products api](#products-api).
|
566
588
|
- **2016-12-15** - `1.0.0` - introduced namespaces, unified method names, updated README. Migration from versions 0.x required [migration from version 0.x](#migration-from-0x)
|
567
|
-
- **2016-12-02** - `0.8.2` - support gift vouchers in utils, fix price and discount calculations for amount discounts
|
568
|
-
- **2016-10-03** - `0.8.1` - publish update
|
589
|
+
- **2016-12-02** - `0.8.2` - support gift vouchers in utils, fix price and discount calculations for amount discounts
|
590
|
+
- **2016-10-03** - `0.8.1` - publish update
|
569
591
|
- **2016-08-02** - `0.8.0` - validate voucher
|
570
592
|
- **2016-07-18** - `0.7.0` - voucher udpate
|
571
593
|
- **2016-07-05** - `0.6.0` - new utils module
|
@@ -640,8 +662,12 @@ The gem is available as open source under the terms of the [MIT License](http://
|
|
640
662
|
|
641
663
|
[Create Validation Rules]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-validation-rules
|
642
664
|
[Get Validation Rules]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#get-validation-rules
|
665
|
+
[List Validation Rules]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#list-validation-rules
|
643
666
|
[Update Validation Rules]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#update-validation-rules
|
644
667
|
[Delete Validation Rules]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#delete-validation-rules
|
668
|
+
[Create Validation Rule Assignment]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-validation-rules-assignment
|
669
|
+
[Delete Validation Rule Assignment]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#delete-validation-rules-assignment
|
670
|
+
[List Validation Rule Assignments]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#list-validation-rules
|
645
671
|
|
646
672
|
[Create Segment]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#create-segment
|
647
673
|
[Get Segment]: https://docs.voucherify.io/reference?utm_source=github&utm_medium=sdk&utm_campaign=acq#get-segment
|
data/lib/voucherify/client.rb
CHANGED
@@ -14,7 +14,7 @@ module Voucherify
|
|
14
14
|
'X-App-Id' => @options[:applicationId] || @options['applicationId'],
|
15
15
|
'X-App-Token' => @options[:clientSecretKey] || @options['clientSecretKey'],
|
16
16
|
'X-Voucherify-Channel' => 'Ruby-SDK',
|
17
|
-
'X-Voucherify-API-Version' => @options[:apiVersion] || @options['apiVersion'],
|
17
|
+
'X-Voucherify-API-Version' => @options[:apiVersion] || @options['apiVersion'] || 'v2018-08-01',
|
18
18
|
:accept => :json,
|
19
19
|
}.reject{ |k,v| v.nil? }
|
20
20
|
@timeout = @options[:timeout] || @options['timeout']
|
@@ -108,13 +108,13 @@ module Voucherify
|
|
108
108
|
end
|
109
109
|
end
|
110
110
|
end
|
111
|
-
|
111
|
+
|
112
112
|
class VoucherifyError < RuntimeError
|
113
113
|
attr_reader :response
|
114
114
|
attr_reader :code
|
115
115
|
attr_reader :details
|
116
116
|
attr_reader :key
|
117
|
-
|
117
|
+
|
118
118
|
def initialize (restClientError)
|
119
119
|
if restClientError.is_a? RestClient::Exceptions::Timeout
|
120
120
|
@response = restClientError
|
@@ -131,4 +131,4 @@ module Voucherify
|
|
131
131
|
end
|
132
132
|
end
|
133
133
|
|
134
|
-
end
|
134
|
+
end
|
@@ -13,6 +13,10 @@ module Voucherify
|
|
13
13
|
@client.post('/validation-rules', validation_rules.to_json)
|
14
14
|
end
|
15
15
|
|
16
|
+
def list(query)
|
17
|
+
@client.get('/validation-rules', query)
|
18
|
+
end
|
19
|
+
|
16
20
|
def get(id)
|
17
21
|
@client.get("/validation-rules/#{URI.encode(id)}")
|
18
22
|
end
|
@@ -24,6 +28,18 @@ module Voucherify
|
|
24
28
|
def delete(id)
|
25
29
|
@client.delete("/validation-rules/#{URI.encode(id)}")
|
26
30
|
end
|
31
|
+
|
32
|
+
def createAssignment(id, assignment)
|
33
|
+
@client.post("/validation-rules/#{URI.encode(id)}/assignments", assignment.to_json)
|
34
|
+
end
|
35
|
+
|
36
|
+
def deleteAssignment(rule_id, assignment_id)
|
37
|
+
@client.delete("/validation-rules/#{URI.encode(rule_id)}/assignments/#{URI.encode(assignment_id)}")
|
38
|
+
end
|
39
|
+
|
40
|
+
def listAssignments(id, query)
|
41
|
+
@client.get("/validation-rules/#{URI.encode(id)}/assignments", query)
|
42
|
+
end
|
27
43
|
end
|
28
44
|
end
|
29
|
-
end
|
45
|
+
end
|
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:
|
4
|
+
version: 2.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: 2018-
|
11
|
+
date: 2018-12-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
version: '0'
|
137
137
|
requirements: []
|
138
138
|
rubyforge_project:
|
139
|
-
rubygems_version: 2.
|
139
|
+
rubygems_version: 2.7.6
|
140
140
|
signing_key:
|
141
141
|
specification_version: 4
|
142
142
|
summary: Ruby SDK for Voucherify. More info on http://www.voucherify.io
|