tonglian-ruby-sdk 0.3.1 → 0.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (4) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +35 -0
  3. data/lib/tonglian-ruby-sdk.rb +5 -2
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 34e702fea8cfb17cedcc44ca1c3cef1c047b43c35d96904b3e1dd07c5e8ada72
4
- data.tar.gz: b432d9015bf5dba98ef5921f42b7e742d2440c42487d4919cce2d7cec24c67f0
3
+ metadata.gz: 8aa46899e9a58b9458b26b4ebf9431e62edc486754e157d008b0c10874bddd28
4
+ data.tar.gz: 757473df369bf8acdc13393447ca605b83c89589bf05c23485e6a7fd0a7f6d49
5
5
  SHA512:
6
- metadata.gz: b2e90a848ff85e07a0689df84c5eb07a6cf01426b7a6b23d4414cd51011306afc509b39557f1d321726a569abeb4453af05035e14ca0f99dfc6d85c58499d069
7
- data.tar.gz: 520cc51c2a2a1933d377e16ec83cdbae62e756a2dc33d7defa744c244b0d061acfd7f3645e88fd2351c694cb3cbe38be0a448abe6254b2ec9aef0cc17ff75993
6
+ metadata.gz: c7230b9b8cda0b5e263fc7741307c70ff3ad6b0c4f41a7065c0be3be3e0ec41f3e8a9c043b98cd0d3ebbcafef925c45347fb90525d898a2f0d0e62cd08503e33
7
+ data.tar.gz: 7fac9de10daa506113ad542890ed810af1d5d27bdf7ab482910da9ec3a4b2b253c97fbe9b2b45abdbbada7e9f774ae7218e341e61b4452558568950d7ed4c29d
data/README.md CHANGED
@@ -1,2 +1,37 @@
1
1
  # tonglian-ruby-sdk
2
2
  Ruby SDK for Tonglian Payment Gateway
3
+
4
+ ## Installation
5
+ 1. Put the following line into the Gemfile of your project
6
+ ```
7
+ gem 'tonglian-ruby-sdk'
8
+ ```
9
+
10
+ 2. Install the gems in Gemfile
11
+ ```
12
+ $ bundle install
13
+ ```
14
+
15
+ ## Usage
16
+ Initialize a TonglianRubySdk client instance
17
+ ```
18
+ api_end_point = 'http://test.allinpay.com/op/gateway'
19
+ app_id = 'xxxxxxxxxxxxxxxx'
20
+ private_path = 'path-to-private-key-file'
21
+ private_password = 'password-to-decrypt-private-key-file'
22
+ public_path = 'path-to-tonglian-public-key-file'
23
+
24
+ client = TonglianRubySdk::Client.new(api_end_point, app_id, private_path, private_password, public_path)
25
+ ```
26
+
27
+ Sent an API request to Tonglian gateway
28
+ ```
29
+ method = 'allinpay.yunst.memberService.createMember'
30
+ params = {
31
+ 'bizUserId' => 'client-users-id-xxxxxx',
32
+ "memberType" => 3,
33
+ "source" => 1
34
+ }
35
+
36
+ client.request(method, params)
37
+ ```
@@ -1,7 +1,7 @@
1
1
  # to avoid error when loading PKCS12 private key file
2
2
  current_dir = File.dirname(__FILE__)
3
3
  provider_conf = File.join(current_dir, 'add-openssl-provider.conf')
4
- ENV['OPENSSL_CONF'] = provider_conf
4
+ ENV['OPENSSL_CONF'] ||= provider_conf
5
5
 
6
6
  require 'openssl'
7
7
  require 'cgi'
@@ -125,8 +125,11 @@ module TonglianRubySdk
125
125
  result = {}
126
126
  obj.keys.sort.each { |k| result[k] = sort_object(obj[k]) }
127
127
  elsif obj.is_a? Array
128
+ # If obj is array, it doesn't need to sort.
129
+ # But still need to sort the items if they're hashes.
130
+ # And this process should recursively go to the bottom
128
131
  result = []
129
- obj.sort.each { |k| result.push(k) }
132
+ obj.each { |i| result.push(sort_object(i)) }
130
133
  else
131
134
  result = obj
132
135
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: tonglian-ruby-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.1
4
+ version: 0.3.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yi Zhang