braintreehttp 0.4.2 → 0.4.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 2fa75403a81c2d46f560fce1c8f5f9efc9ef1a23
4
- data.tar.gz: 502225377013d459e3b5d69f80cc6bf9e4a736a9
3
+ metadata.gz: ecd98d588354892b57adab08fd12f0436f40b460
4
+ data.tar.gz: ddb47e416589e2e70e2f5abd36a8dde40697b4ba
5
5
  SHA512:
6
- metadata.gz: 6679061c1c261486202c71b445c57c95faf6e968dc9670cb6daf949d9d17458c75785dbee32991d391437d5aa97b851d37ffde7c933b4dd2f1b165232c6ca6c7
7
- data.tar.gz: 9e655d70620e4841e70ba9aafea0cd1efb8870370f6e72c9ab3084210aa08ff504647e7fbe67bea5e28456aab169a20ce8c0fbf255ea58ab192f66b49adcec69
6
+ metadata.gz: 4dc5c2feda9a452c62114fb5edfa61cce9630e131f835aeaef179eb70a0f855c3577eb513bd97c098dd506a2949124c9c0f7a90484a42712f2f6057da06f3dea
7
+ data.tar.gz: 5d564e3a9cc44a65d6ee0c03352cc31eff36c9a1db7cee99b0ce2216b633318eaf3c48af336deba864c323bc012ea80149fd8b8ba8a2f6896fb6263647139642
@@ -71,7 +71,7 @@ module BraintreeHttp
71
71
  if deserialized.is_a?(String) || deserialized.is_a?(Array)
72
72
  result = deserialized
73
73
  else
74
- result = _parse_hash(deserialized)
74
+ result = _parse_values(deserialized)
75
75
  end
76
76
  else
77
77
  result = nil
@@ -90,15 +90,21 @@ module BraintreeHttp
90
90
  end
91
91
  end
92
92
 
93
- def _parse_hash(hash)
94
- obj = OpenStruct.new()
93
+ def _parse_values(values)
94
+ obj = nil
95
95
 
96
- hash.each do |k, v|
97
- if v.is_a?(Hash)
98
- obj[k] = _parse_hash(v)
99
- else
100
- obj[k] = v
96
+ if values.is_a?(Array)
97
+ obj = []
98
+ values.each do |v|
99
+ obj << _parse_values(v)
100
+ end
101
+ elsif values.is_a?(Hash)
102
+ obj = OpenStruct.new()
103
+ values.each do |k, v|
104
+ obj[k] = _parse_values(v)
101
105
  end
106
+ else
107
+ obj = values
102
108
  end
103
109
 
104
110
  obj
@@ -1 +1 @@
1
- VERSION = "0.4.2"
1
+ VERSION = "0.4.3"
@@ -236,7 +236,9 @@ describe HttpClient do
236
236
  :some_hash => {
237
237
  :some_int => 1
238
238
  },
239
- :some_array => [1, 2, 3]
239
+ :some_array => [[{
240
+ :array_key => 'array-value'
241
+ }]]
240
242
  }
241
243
  }
242
244
 
@@ -252,7 +254,7 @@ describe HttpClient do
252
254
  expect(resp.result.key).to eq('value')
253
255
  expect(resp.result.nested_key.string).to eq('stringvalue')
254
256
  expect(resp.result.nested_key.some_hash.some_int).to eq(1)
255
- expect(resp.result.nested_key.some_array).to eq([1, 2, 3])
257
+ expect(resp.result.nested_key.some_array[0][0].array_key).to eq('array-value')
256
258
  end
257
259
 
258
260
  it "does not error if no file or body present on a request class" do
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: braintreehttp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.4.2
4
+ version: 0.4.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Braintree