ravelin 0.1.5 → 0.1.6
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/ravelin/event.rb +16 -1
- data/lib/ravelin/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: 4b248ecddc8dd466d77736a5b37960ebd6312f30
|
4
|
+
data.tar.gz: 3fbde0a73dcb74135b4722c42568e9136978283b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 80709c4159f06bd611eaa7400c538b35b1e9fda246fa5cd67b5b6e5e6b6e910513dd7953a20d833ad3eac9d811ddda3104e95fc90f5094c710ad5dd83b24a622
|
7
|
+
data.tar.gz: 9d838d99ec670371d6405be97abc6b846b2fb506ebbd78a81339b8f7803919931a318b091c04eabec6c29b7d88ebda8261e87037a5a017d3134f6a8403a93ec6
|
data/lib/ravelin/event.rb
CHANGED
@@ -52,7 +52,10 @@ module Ravelin
|
|
52
52
|
when :'paymentmethod/voucher'
|
53
53
|
validate_payload_inclusion_of :'voucher_redemption'
|
54
54
|
when :pretransaction, :transaction
|
55
|
-
|
55
|
+
validate_payload_must_include_one_of(
|
56
|
+
:payment_method_id, :payment_method
|
57
|
+
)
|
58
|
+
validate_payload_inclusion_of :order_id
|
56
59
|
when :login
|
57
60
|
validate_payload_inclusion_of :customer_id, :temp_customer_id
|
58
61
|
when :checkout
|
@@ -77,6 +80,18 @@ module Ravelin
|
|
77
80
|
end
|
78
81
|
end
|
79
82
|
|
83
|
+
def validate_payload_must_include_one_of(*mutually_exclusive_keys)
|
84
|
+
intersection = mutually_exclusive_keys & self.payload.keys
|
85
|
+
|
86
|
+
if intersection.size > 1
|
87
|
+
raise ArgumentError
|
88
|
+
.new(%Q{parameters are mutally exclusive: #{mutually_exclusive_keys.join(', ')}})
|
89
|
+
elsif intersection.size == 0
|
90
|
+
raise ArgumentError
|
91
|
+
.new(%Q{payload must include one of: #{mutually_exclusive_keys.join(', ')}})
|
92
|
+
end
|
93
|
+
end
|
94
|
+
|
80
95
|
def payload_customer_reference_present?
|
81
96
|
self.payload.keys.any? {|k| %i(customer_id temp_customer_id).include? k }
|
82
97
|
end
|
data/lib/ravelin/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ravelin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.6
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sam Levy
|
@@ -11,7 +11,7 @@ authors:
|
|
11
11
|
autorequire:
|
12
12
|
bindir: exe
|
13
13
|
cert_chain: []
|
14
|
-
date:
|
14
|
+
date: 2017-03-07 00:00:00.000000000 Z
|
15
15
|
dependencies:
|
16
16
|
- !ruby/object:Gem::Dependency
|
17
17
|
name: faraday
|