fadada-ruby-sdk 0.1.0 → 0.2.0

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/lib/client.rb +2 -3
  3. data/lib/signer.rb +2 -2
  4. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: db9e024b25996f63dbe1339092d8576addf19abb55097dd64ae2b48b2373e576
4
- data.tar.gz: 8f08dbe3966c43f09192c2fcb58c45dc465483f8c7f48c26fc7c95cf51c68108
3
+ metadata.gz: 1309a20b8043bc2729666d23129d2c97967b77e03dc193b8419c652312eb1a83
4
+ data.tar.gz: 3fde2492c4600a46046bddc757c74c723dc426b631bacc9a1f8ad6f89e3db659
5
5
  SHA512:
6
- metadata.gz: 514a86bf1ddc25445d70a3023177d03a144756c7b44f2e5768dc779aaf40c72ab2b0858c9657b04068542c0024176f6461405222bb819fbb062c835ef4d6d0af
7
- data.tar.gz: 3274a9758f6d2b0f3f355985ab62ca19490480c7517910c4149c5051833cd3b846d1fbd225f2818f353ddd7028f285fd769ae1cc66af58f1eb43c065ece55735
6
+ metadata.gz: ccd07d0cec6f72ff08299ca64f3679098f0b6504ce3f6bfaaf1aca27f57b3e7e2d71728d85ad828ed7869d3b7e966c6d84143fdddfb2d047662cb87018fe30ea
7
+ data.tar.gz: e6a4524310a7e32a2cf9287b5639b91d8d7cb836dad89188f9ffdb56a66ddf34141c8297fc75a3b7dff8dcd532c7a0046b959f5baa1e66f1f58825478cc14d2b
data/lib/client.rb CHANGED
@@ -12,10 +12,9 @@ module FadadaRubySdk
12
12
  def request(url, access_token, params)
13
13
  headers, params = @signer.sign(access_token, params)
14
14
 
15
- url = URI.join(@app_end_point, url)
16
- url = URI(url)
15
+ url = URI("#{@api_end_point}#{url}")
17
16
  http = Net::HTTP.new(url.host, url.port)
18
- http.use_ssl = true if @api_end_point.downcase.starts_with?('https') # Enable SSL for HTTPS
17
+ http.use_ssl = true if @api_end_point.downcase.start_with?('https') # Enable SSL for HTTPS
19
18
 
20
19
  request = Net::HTTP::Post.new(url.request_uri)
21
20
  request['Content-Type'] = 'application/x-www-form-urlencoded'
data/lib/signer.rb CHANGED
@@ -32,7 +32,7 @@ module FadadaRubySdk
32
32
  headers = HEADER_STUB.dup
33
33
  params = {}
34
34
 
35
- headers['X-FASC-Request-Id'] = @app_id
35
+ headers['X-FASC-App-Id'] = @app_id
36
36
  headers['X-FASC-Timestamp'] = (Time.now.to_f * 1000).to_i.to_s
37
37
  headers['X-FASC-Nonce'] = SecureRandom.uuid.gsub('-', '')
38
38
  if access_token.nil? || access_token.empty?
@@ -54,7 +54,7 @@ module FadadaRubySdk
54
54
  end
55
55
 
56
56
  def generate_signature(sorted_params_str, timestamp, secret)
57
- sorted_str_digest = Digest::SHA256.hexdigest(sortd_params_str)
57
+ sorted_str_digest = Digest::SHA256.hexdigest(sorted_params_str)
58
58
  hmac = OpenSSL::HMAC.digest('sha256', secret, timestamp)
59
59
  OpenSSL::HMAC.hexdigest('sha256', hmac, sorted_str_digest)
60
60
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fadada-ruby-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yi Zhang