wx_pay 0.4.0 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/wx_pay/result.rb +3 -5
- data/lib/wx_pay/service.rb +1 -1
- data/lib/wx_pay/version.rb +1 -1
- data/test/wx_pay/result_test.rb +4 -24
- 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: b0ec7cd89cdcd715c514eff188d209372a1a0d24
|
4
|
+
data.tar.gz: 675f41d9b0b406395791238167cc8d53fcefe41b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0090bbbed4b9582e79672c9d5cab77a82790c8f311ace9c0b7ad17eca4a08878ea7942fa8ef86a8fc5e2a576d6197d95b22a328900535aeb28429798354cda54
|
7
|
+
data.tar.gz: d4f49e18e29b3164a8418fedfcecb9ca3cae255f32dd5f2b511e3db2a89adaebe06b170bc9dc477bc62acdeb04d478a77dce76cf857356a771d9baa8fc3f9948
|
data/lib/wx_pay/result.rb
CHANGED
@@ -2,16 +2,14 @@ module WxPay
|
|
2
2
|
class Result < ::Hash
|
3
3
|
SUCCESS_FLAG = 'SUCCESS'.freeze
|
4
4
|
|
5
|
-
def
|
6
|
-
|
5
|
+
def initialize(result)
|
6
|
+
super
|
7
7
|
|
8
8
|
if result['xml'].class == Hash
|
9
9
|
result['xml'].each_pair do |k, v|
|
10
|
-
|
10
|
+
self[k] = v
|
11
11
|
end
|
12
12
|
end
|
13
|
-
|
14
|
-
hash
|
15
13
|
end
|
16
14
|
|
17
15
|
def success?
|
data/lib/wx_pay/service.rb
CHANGED
data/lib/wx_pay/version.rb
CHANGED
data/test/wx_pay/result_test.rb
CHANGED
@@ -2,7 +2,7 @@ require 'test_helper'
|
|
2
2
|
|
3
3
|
class WxPay::ResultTest < MiniTest::Test
|
4
4
|
def test_success_method_with_true
|
5
|
-
r = WxPay::Result
|
5
|
+
r = WxPay::Result.new(
|
6
6
|
Hash.from_xml(
|
7
7
|
<<-XML
|
8
8
|
<xml>
|
@@ -10,39 +10,19 @@ class WxPay::ResultTest < MiniTest::Test
|
|
10
10
|
<result_code>SUCCESS</result_code>
|
11
11
|
</xml>
|
12
12
|
XML
|
13
|
-
)
|
14
|
-
]
|
13
|
+
))
|
15
14
|
|
16
15
|
assert_equal r.success?, true
|
17
16
|
end
|
18
17
|
|
19
|
-
def test_nonexistent_key
|
20
|
-
r = WxPay::Result[
|
21
|
-
Hash.from_xml(
|
22
|
-
<<-XML
|
23
|
-
<xml>
|
24
|
-
<return_code>SUCCESS</return_code>
|
25
|
-
<code_url>wx_code_url</code_url>
|
26
|
-
<result_code>SUCCESS</result_code>
|
27
|
-
</xml>
|
28
|
-
XML
|
29
|
-
)
|
30
|
-
]
|
31
|
-
|
32
|
-
assert_equal r['return_code'].nil?, false
|
33
|
-
assert_equal r['prepay_id'].nil?, true
|
34
|
-
assert_equal r.keys, ['return_code', 'code_url', 'result_code']
|
35
|
-
end
|
36
|
-
|
37
18
|
def test_success_method_with_false
|
38
|
-
r = WxPay::Result
|
19
|
+
r = WxPay::Result.new(
|
39
20
|
Hash.from_xml(
|
40
21
|
<<-XML
|
41
22
|
<xml>
|
42
23
|
</xml>
|
43
24
|
XML
|
44
|
-
)
|
45
|
-
]
|
25
|
+
))
|
46
26
|
|
47
27
|
assert_equal r.success?, false
|
48
28
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: wx_pay
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.4.
|
4
|
+
version: 0.4.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Jasl
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-12-
|
11
|
+
date: 2015-12-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|