tonglian-ruby-sdk 0.3.0 → 0.3.2

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 +4 -3
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 7f4d54ded35c1a345b7c1523f59e561e70d08d6bad618e2c83a14d33ab532065
4
- data.tar.gz: d37d2482450c7a156674fe5ec2b71e5b69eb415ee949aaea55392068113357c1
3
+ metadata.gz: e1f015a90097c8606b7e562c0e36c9b11790a67e09dff8907588490ad5f51860
4
+ data.tar.gz: 4fd341b8c531888fa2654c6fcc00fc48ab8cc69a7dce603debf4657b2c68d762
5
5
  SHA512:
6
- metadata.gz: 8d3afc6f5ad630dae3dfca5346a196493c7ef3ed217a862dc2946e766515434e8bef43bc22d4b21339d57f9df122f2e939f50af5ca4167e2ee0fbabe5f584557
7
- data.tar.gz: f82d4d303edf28781dfa7f86bc0df7ead862f6dcb14dda96bfa00e775128f8088346ff8be1aa14a364e0c84dbded75be3eaf6ac60ea4acd91c9bd9673db803c7
6
+ metadata.gz: cce709c6a7e11e6663ec9ff1d0775ac6916b1e013715ebd3b2c333cd7bf57eed313e0b2b2b043101678a052459a58eef2332c6b7367dd354391eddaca54f52ef
7
+ data.tar.gz: 62a3c6981b09430a152b408cb5e26a8f096f6f40eb182f6b47f93cd6d7809da2fc74470387cf828872fda6ed0bf0ae4d4e22974ee9f43d78c937c9d2cd92ab1c
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,5 +1,7 @@
1
1
  # to avoid error when loading PKCS12 private key file
2
- ENV['OPENSSL_CONF'] = './add-openssl-provider.conf'
2
+ current_dir = File.dirname(__FILE__)
3
+ provider_conf = File.join(current_dir, 'add-openssl-provider.conf')
4
+ ENV['OPENSSL_CONF'] ||= provider_conf
3
5
 
4
6
  require 'openssl'
5
7
  require 'cgi'
@@ -84,7 +86,6 @@ module TonglianRubySdk
84
86
 
85
87
  def private_key
86
88
  return @private_key if @private_key
87
-
88
89
  private_file = File.open(@private_path)
89
90
  @private_key = OpenSSL::PKCS12.new(private_file, @private_passwd).key.export
90
91
  end
@@ -125,7 +126,7 @@ module TonglianRubySdk
125
126
  obj.keys.sort.each { |k| result[k] = sort_object(obj[k]) }
126
127
  elsif obj.is_a? Array
127
128
  result = []
128
- obj.sort.each { |k| result.push(k) }
129
+ obj.sort.each { |i| result.push(sort_object(i)) }
129
130
  else
130
131
  result = obj
131
132
  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.0
4
+ version: 0.3.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yi Zhang