fuiou 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 39f9fe07a187ad5b56257dec8cd148cb12df1d46bf60bd00a223103bd83fe25b
4
- data.tar.gz: d52fc1de0c697d3482604e172d39b7655fff65e52407b9f1d68f7db9327f4e47
3
+ metadata.gz: 72dfa9486a1fa6c267c40fc3d59a99d56c83b11a2583100e8cdb20844da84550
4
+ data.tar.gz: 6a4b2fde41c36b61b76eba7179e985d35d2891aa7f62a5fec11c772513039a90
5
5
  SHA512:
6
- metadata.gz: f9c6cb4e695237134c5f599704036960bda0463b24b7d0c4356b3c8b9c630323b8e561d9774aa3e94b8d8a555fbfee4558025049cdf6fddeda52d99d8bab7947
7
- data.tar.gz: 458b731db237cb0e01ba47203e6e40e3becebc0694a24dd3e996f2dc984ada98c24e7b6a85ab1b6af16fe6a82dc200cadc70baec9205e99b891cff5c83d6917c
6
+ metadata.gz: 3854f45fe089348f71272c9dce4d4b1d09cbe67b35fca2f5c00b74d1f8bc52a8c662342c452bd3ca4c086e778c0a660ce02655c75655b99a404d517093b6e575
7
+ data.tar.gz: 7ca9b032194e67832c9cfd3fb7f2db740162256cd2e45c2bf58029f3fef7c2f5a7d0b0e34df045aa6e5aeb07be0a35e6b4bd05069ae2de5d0aeaaf3ef560028b
data/lib/fuiou/service.rb CHANGED
@@ -28,6 +28,8 @@ module Fuiou
28
28
  invoke_remote(FUIOU_30_URL, { req: payload })
29
29
  end
30
30
 
31
+ private
32
+
31
33
  def invoke_remote(url, payload, options = {})
32
34
  resp = RestClient.post(
33
35
  url,
@@ -40,16 +42,14 @@ module Fuiou
40
42
  Hash.from_xml(CGI.unescape(resp.body))["xml"]
41
43
  end
42
44
 
43
- private
44
-
45
45
  def xmlify_payload(params)
46
46
  rsa_string = params.sort.map{|k,v| "#{k}=#{v}&" unless k.start_with?("sign") || k.start_with?("reserved")}.join
47
- rsa_string = rsa_string.delete_suffix("&") if rsa_string.end_with?("&")
47
+ rsa_string = rsa_string.chop if rsa_string.end_with?("&")
48
48
 
49
49
  sign = Fuiou::Sign.rsa_sign(rsa_string)
50
50
 
51
- xml = "<?xml version=\"1.0\" encoding=\"GBK\" standalone=\"yes\"?><xml>#{params.except(:sign).sort.map { |k, v| "<#{k}>#{v}</#{k}>" }.join}<sign>#{sign}</sign></xml>"
52
- (xml.force_encoding(ENCODE_TYPE_GBK)).force_encoding(ENCODE_TYPE_GBK)
51
+ xml = "<?xml version=\"1.0\" encoding=\"GBK\" standalone=\"yes\"?><xml>#{params.sort.map { |k, v| "<#{k}>#{v}</#{k}>" }.join}<sign>#{sign}</sign></xml>"
52
+ (xml.encode(ENCODE_TYPE_GBK)).encode(ENCODE_TYPE_GBK)
53
53
  end
54
54
 
55
55
  def check_required_options(options, names)
data/lib/fuiou/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Fuiou
4
- VERSION = "0.1.0".freeze
4
+ VERSION = "0.1.1".freeze
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fuiou
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - wen