amazon_flex_pay 0.9.8 → 0.9.9
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/amazon_flex_pay/model.rb +4 -1
- data/lib/amazon_flex_pay.rb +1 -1
- data/test/amazon_flex_pay_test.rb +12 -1
- metadata +4 -4
@@ -58,7 +58,7 @@ module AmazonFlexPay
|
|
58
58
|
|
59
59
|
def #{attr}=(val)
|
60
60
|
options = AmazonFlexPay::Enumerations::#{source.to_s.camelcase}
|
61
|
-
unless options.include?(
|
61
|
+
unless [val].flatten.all?{ |v| options.include?(v) }
|
62
62
|
raise ArgumentError.new("\#{val} is not an allowed option (\#{options.join(', ')})")
|
63
63
|
end
|
64
64
|
@#{attr} = val
|
@@ -123,6 +123,9 @@ module AmazonFlexPay
|
|
123
123
|
when TrueClass, FalseClass
|
124
124
|
val.to_s.capitalize
|
125
125
|
|
126
|
+
when Array
|
127
|
+
val.join(',')
|
128
|
+
|
126
129
|
else
|
127
130
|
val.to_s
|
128
131
|
end
|
data/lib/amazon_flex_pay.rb
CHANGED
@@ -45,6 +45,7 @@ class AmazonFlexPayTest < AmazonFlexPay::Test
|
|
45
45
|
attribute :foo
|
46
46
|
attribute :amount, :type => :amount
|
47
47
|
attribute :stuffs, :collection => :amount
|
48
|
+
attribute :method, :enumeration => :payment_method
|
48
49
|
|
49
50
|
class Response < AmazonFlexPay::API::BaseRequest::BaseResponse; end
|
50
51
|
end
|
@@ -103,7 +104,17 @@ class AmazonFlexPayTest < AmazonFlexPay::Test
|
|
103
104
|
end
|
104
105
|
|
105
106
|
should "not allow unknown values for enumerated attributes" do
|
106
|
-
assert_raises ArgumentError do TestRequest.new(:
|
107
|
+
assert_raises ArgumentError do TestRequest.new(:method => 'UNKOWN') end
|
108
|
+
end
|
109
|
+
|
110
|
+
should "allow value sets for enumerated attributes" do
|
111
|
+
assert_nothing_raised do
|
112
|
+
TestRequest.new(:method => ['CC', 'ACH'])
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
should "convert value sets into comma-separated lists" do
|
117
|
+
assert_equal 'a,b', TestRequest.new(:foo => ['a', 'b']).to_hash['Foo']
|
107
118
|
end
|
108
119
|
|
109
120
|
# pipeline basics
|
metadata
CHANGED
@@ -1,13 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: amazon_flex_pay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
hash:
|
4
|
+
hash: 41
|
5
5
|
prerelease:
|
6
6
|
segments:
|
7
7
|
- 0
|
8
8
|
- 9
|
9
|
-
-
|
10
|
-
version: 0.9.
|
9
|
+
- 9
|
10
|
+
version: 0.9.9
|
11
11
|
platform: ruby
|
12
12
|
authors:
|
13
13
|
- Lance Ivy
|
@@ -15,7 +15,7 @@ autorequire:
|
|
15
15
|
bindir: bin
|
16
16
|
cert_chain: []
|
17
17
|
|
18
|
-
date: 2012-03-
|
18
|
+
date: 2012-03-22 00:00:00 -04:00
|
19
19
|
default_executable:
|
20
20
|
dependencies:
|
21
21
|
- !ruby/object:Gem::Dependency
|