viva_wallet 0.1.4 → 0.2.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: 27747d388b7b0d30fe6b93c67e4a49666d15e6e3f3d3c3588dacc90918633e2b
4
- data.tar.gz: 0a13fcc3fc3155a749ac4f7ffe06137911feac206b1f626cb9ee2b55d2ebb2d2
3
+ metadata.gz: 6bf02afe529b2fd0e38184e4c1d6271b4b8aa4d58218ef003c52f7c62b672d70
4
+ data.tar.gz: fd05d55df0f7db50aed301bfc793d73d4319d8d3bc9063ef0901b59214c59264
5
5
  SHA512:
6
- metadata.gz: c73802166859e512f144de72f409de257e7e49d3958e392a94bb389a9b506a20bad1f372334336fb15efc176b3c3dc9b1f5c74a1583614a3026b2c99b9ce14d9
7
- data.tar.gz: f876f994761f847ee980080ceec5739c283c94c35e6d431cfd0228e9df1cd0dfd6d010f95474af24827f038a24951133b8c03be5fff93f53837608df2dbfd675
6
+ metadata.gz: f50e1629f13eaea0a8f0f253b7fd45f36c99e652ccd1c2229968f2b1ae69b1bf32f1dc580d6659c1c88fe5b5d88007c34ecd680bd293065d70724419644caf27
7
+ data.tar.gz: f8774f93261fb3f2cd9c6e46dcef6cf9fd1ddf0ec43978212fb2d1866782464e8d8123ee65d6588ea95cbebb3498928c77cb67c17bd4804a4c40977cf2ae0c92
data/README.md CHANGED
@@ -23,6 +23,7 @@ Set up an initializer file with your Viva Wallet Smart Checkout client keys:
23
23
  ```ruby
24
24
  VivaWallet.client_id = 'viva_client_id'
25
25
  VivaWallet.client_secret = 'viva_client_secret'
26
+ VivaWallet.source_code = 'website_app_source_code'
26
27
  VivaWallet.test_mode = true/false
27
28
  ```
28
29
  e.g. *config/initializers/viva_wallet.rb*
@@ -7,11 +7,11 @@ module VivaWallet
7
7
  def oauth
8
8
  RestClient::Request.new({
9
9
  method: :post,
10
- url: VivaWallet.account_api_base + 'connect/token?grant_type=client_credentials',
10
+ url: VivaWallet.account_api_base + 'connect/token',
11
+ payload: {grant_type: 'client_credentials'},
11
12
  headers: {
12
- accept: :json,
13
- content_type: :json,
14
- 'Authorization': "Bearer #{VivaWallet.client_base64}"
13
+ content_type: 'application/x-www-form-urlencoded',
14
+ Authorization: "Basic #{VivaWallet.client_base64}"
15
15
  }
16
16
  }).execute do |response, request, result|
17
17
  str_response = response.to_str
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module VivaWallet
4
- VERSION = "0.1.4"
4
+ VERSION = "0.2.1"
5
5
  end
data/lib/viva_wallet.rb CHANGED
@@ -14,7 +14,8 @@ module VivaWallet
14
14
  class ConfigurationError < VivaWalletError; end
15
15
 
16
16
  class << self
17
- attr_writer :client_id, :client_secret, :test_mode, :api_base, :account_api_base, :client_base64
17
+ attr_writer :client_id, :client_secret, :source_code, :test_mode,
18
+ :api_base, :account_api_base, :client_base64
18
19
 
19
20
  def client_id
20
21
  defined? @client_id and @client_id or raise(
@@ -28,6 +29,12 @@ module VivaWallet
28
29
  )
29
30
  end
30
31
 
32
+ def source_code
33
+ defined? @source_code and @source_code or raise(
34
+ ConfigurationError, "VivaWallet source_code not configured"
35
+ )
36
+ end
37
+
31
38
  def test_mode
32
39
  @test_mode.nil? ? false : @test_mode
33
40
  end
@@ -45,9 +52,6 @@ module VivaWallet
45
52
  end
46
53
 
47
54
  def request(method, resource, params = {}, access_token = nil)
48
- access_token = access_token
49
-
50
- params.except!(:access_token)
51
55
 
52
56
  defined? method or raise(
53
57
  ArgumentError, "Request method has not been specified"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: viva_wallet
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.4
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tom Dallimore
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-09 00:00:00.000000000 Z
11
+ date: 2022-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client