killbill-paypal-express 1.0.9 → 1.0.10

Sign up to get free protection for your applications and to get access to all the features.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.9
1
+ 1.0.10
@@ -31,6 +31,34 @@ class Object
31
31
  end
32
32
 
33
33
  class Hash
34
+ # Return a new hash with all keys converted to symbols, as long as
35
+ # they respond to +to_sym+. This includes the keys from the root hash
36
+ # and from all nested hashes.
37
+ #
38
+ # hash = { 'person' => { 'name' => 'Rob', 'age' => '28' } }
39
+ #
40
+ # hash.deep_symbolize_keys
41
+ # # => { person: { name: "Rob", age: "28" } }
42
+ def deep_symbolize_keys
43
+ deep_transform_keys { |key| key.to_sym rescue key }
44
+ end
45
+
46
+ # Return a new hash with all keys converted by the block operation.
47
+ # This includes the keys from the root hash and from all
48
+ # nested hashes.
49
+ #
50
+ # hash = { person: { name: 'Rob', age: '28' } }
51
+ #
52
+ # hash.deep_transform_keys{ |key| key.to_s.upcase }
53
+ # # => { "PERSON" => { "NAME" => "Rob", "AGE" => "28" } }
54
+ def deep_transform_keys(&block)
55
+ result = {}
56
+ each do |key, value|
57
+ result[yield(key)] = value.is_a?(Hash) ? value.deep_transform_keys(&block) : value
58
+ end
59
+ result
60
+ end
61
+
34
62
  # By default, only instances of Hash itself are extractable.
35
63
  # Subclasses of Hash may implement this method and return
36
64
  # true to declare themselves as extractable. If a Hash
@@ -123,4 +151,4 @@ class Module
123
151
  mattr_reader(*syms)
124
152
  mattr_writer(*syms)
125
153
  end
126
- end
154
+ end
@@ -22,7 +22,7 @@ post '/plugins/killbill-paypal-express/1.0/setup-checkout', :provides => 'json'
22
22
  response = plugin.initiate_express_checkout data['kb_account_id'],
23
23
  data['amount_in_cents'] || 0,
24
24
  data['currency'] || 'USD',
25
- data['options'] || {}
25
+ (data['options'] || {}).deep_symbolize_keys
26
26
  unless response.success?
27
27
  status 500
28
28
  response.message
@@ -50,4 +50,4 @@ module Killbill::PaypalExpress
50
50
  Killbill::PaypalExpress.logger
51
51
  end
52
52
  end
53
- end
53
+ end
data/pom.xml CHANGED
@@ -25,7 +25,7 @@
25
25
  <groupId>com.ning.killbill.ruby</groupId>
26
26
  <artifactId>paypal-express-plugin</artifactId>
27
27
  <packaging>pom</packaging>
28
- <version>1.0.9</version>
28
+ <version>1.0.10</version>
29
29
  <name>paypal-express-plugin</name>
30
30
  <url>http://github.com/killbill/killbill-paypal-express-plugin</url>
31
31
  <description>Plugin for accessing paypal as a payment gateway</description>
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: killbill-paypal-express
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.9
4
+ version: 1.0.10
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: