daicadp 0.1.1 → 0.1.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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 47742cf925ab1eff4a5446932ec1991d9a7d91b283f7977513d176b9fd9b3ade
4
- data.tar.gz: ccb426de62a31ce57e07024ebc1ada30d7706b3e3890584657f65e0ed1facd75
3
+ metadata.gz: a41689b926a3ae445a4f211d887bf8ca6d33ae3c6408107fc2830d4e4410506f
4
+ data.tar.gz: 18607da2a352ebea0c4ee3986b3bd60b29437ec389f6c984e9d9c6930a8c4eef
5
5
  SHA512:
6
- metadata.gz: daf489d11aa9793fc4e4902eedd40006fd0feb7127356c607ba12073cdf7e5c779621678f91432e915e90a214e136141bb9f0c3b94378a32c33f4383ddb3c2a9
7
- data.tar.gz: ee77cccb45e54c937dfe0ab3b4b62dd6bb38f5d4c9f0cb5d9b709a8c44a72d8c0cd803e7767207d186ab4da0af7dbe824229d87b10cb79abc7d3e5c9fe5afdfa
6
+ metadata.gz: 4e1ad3bc6b8adf4a838c8ed079fc60701131a8c82114ec4f7b833ce89234a62366d06ab8fbad5b957f18603dc50c755b70139c26ddfc83831ffb80206f2042c7
7
+ data.tar.gz: b08b59c25438ea471ccf244645121485ba51bf4ad4e4fa04afd0035972cb02c39a1a4562620bd542a9e27605f9f7b423697aff4271f821550da8ed75f9441d24
data/daicadp.gemspec CHANGED
@@ -17,7 +17,7 @@ Gem::Specification.new do |spec|
17
17
  spec.metadata["allowed_push_host"] = "https://rubygems.org"
18
18
 
19
19
  spec.add_dependency 'json'
20
- spec.add_dependency 'net/http'
20
+ spec.add_dependency 'net-http'
21
21
  spec.add_dependency 'openssl'
22
22
  # Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
23
23
  # to allow pushing to a single host or delete this section to allow pushing to any host.
@@ -1,8 +1,8 @@
1
1
  require 'openssl'
2
2
 
3
- module Daicadp
4
- module Helper
5
- def sign(data, secret, type = 'sha256')
6
- digest = OpenSSL::Digest.new(type)
7
- OpenSSL::HMAC.hexdigest(digest, secret, data)
8
- end
3
+ module Daicadp::Helper
4
+ def self.sign(data, secret, type = 'sha256')
5
+ digest = OpenSSL::Digest.new(type)
6
+ OpenSSL::HMAC.hexdigest(digest, secret, data)
7
+ end
8
+ end
@@ -1,3 +1,3 @@
1
1
  module Daicadp
2
- VERSION = "0.1.1"
2
+ VERSION = "0.1.3"
3
3
  end
data/lib/daicadp.rb CHANGED
@@ -12,11 +12,12 @@ $ZkConstants = {
12
12
  };
13
13
 
14
14
  module Daicadp
15
+ include Daicadp::Helper
15
16
  class Client
16
17
  attr_reader :options
17
18
 
18
19
  def initialize(options)
19
- options[:host] = options[:test] ? ZkConstants.ZKPAY_HOST_DEV : ZkConstants.ZKPAY_HOST
20
+ options[:host] = options[:test] ? ZkConstants[:ZKPAY_HOST_DEV] : ZkConstants[:ZKPAY_HOST]
20
21
  @options = options
21
22
  end
22
23
 
@@ -27,12 +28,10 @@ module Daicadp
27
28
  merchantOrder: order[:orderId],
28
29
  }
29
30
  data[:merchantUser] = order[:userId] if order[:userId]
30
-
31
31
  sorted_params = data.sort.to_h
32
32
  query = sorted_params.map { |key, value| "#{key}=#{value}" }.join('&')
33
33
  signed_data = Helper.sign(query, options[:secret], 'sha256')
34
-
35
- return "#{options[:test] ? ZkConstants.ZKPAY_WEB_DEV : ZkConstants.ZKPAY_WEB}?#{query}&secureHash=#{signed_data}&returnUrl=#{options[:returnUrl]}"
34
+ return "#{options[:test] ? ZkConstants[:ZKPAY_WEB_DEV] : ZkConstants[:ZKPAY_WEB]}?#{query}&secureHash=#{signed_data}&returnUrl=#{options[:returnUrl]}"
36
35
  end
37
36
 
38
37
  def get_merchant_transaction(id)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: daicadp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - daicadp
@@ -25,7 +25,7 @@ dependencies:
25
25
  - !ruby/object:Gem::Version
26
26
  version: '0'
27
27
  - !ruby/object:Gem::Dependency
28
- name: net/http
28
+ name: net-http
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - ">="