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.
@@ -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?(val)
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
@@ -17,7 +17,7 @@ require 'amazon_flex_pay/api'
17
17
  require 'amazon_flex_pay/pipelines'
18
18
 
19
19
  module AmazonFlexPay
20
- VERSION = '0.9.8'
20
+ VERSION = '0.9.9'
21
21
  API_VERSION = '2011-09-20'
22
22
  PIPELINE_VERSION = '2009-01-09'
23
23
 
@@ -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(:amount => {:currency_code => 'UNKOWN'}) end
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: 43
4
+ hash: 41
5
5
  prerelease:
6
6
  segments:
7
7
  - 0
8
8
  - 9
9
- - 8
10
- version: 0.9.8
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-02 00:00:00 -05:00
18
+ date: 2012-03-22 00:00:00 -04:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency