smartpay 0.8.0 → 0.9.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: f015233da3625d9cb3178fb715f7885d9cd0680816dbb368a0ed4ab530577a37
4
- data.tar.gz: 98909c98c67fd90c2bb66862edb643f54680b236bdb027e8f6ae6bf3fdd11e77
3
+ metadata.gz: 00410e1e92eac18110d098a09a4750d33d8a6f1b06c996b2cfaab3d8894fdfd6
4
+ data.tar.gz: b8efe4cb9dd735fb8b34f21a8cff1b21c19dd87994d74a2baf5b27960040e7f0
5
5
  SHA512:
6
- metadata.gz: 556f127ac1e15bec24476e88d2dfaa47918d19818ce24c3a208ee2e6d0a1a367e6f4a97613060d855358414c55980f446d5ef924c06fac50e2912ed69e39da0b
7
- data.tar.gz: d5c98640761e4ae80d39520d8b9d8b97864cc13ab3e50fbcea6bee56f794331c610012e4aff41d6aff20bf65013387719e1db306b0784db09471d445db369738
6
+ metadata.gz: 19fce14ce1eb29e8513d9b1f7c7594a6ed822f1b9ba5f5cc7b69c657458d79af3e54ee3413182b550e91426e064b3aa683d4d0de4f47bab9f3911ff8c2accc9f
7
+ data.tar.gz: 25123f86a91d9d6053e66798d5db35594c433383ec5d76728981d500e241e8b95169e3d4907305a4e1bc1fb360b3403bc2b29cc0e560e1468669816c2a6cf0fc
data/.whitesource ADDED
@@ -0,0 +1,12 @@
1
+ {
2
+ "scanSettings": {
3
+ "baseBranches": []
4
+ },
5
+ "checkRunSettings": {
6
+ "vulnerableCheckRunConclusionLevel": "failure",
7
+ "displayMode": "diff"
8
+ },
9
+ "issueSettings": {
10
+ "minSeverityLevel": "LOW"
11
+ }
12
+ }
@@ -3,13 +3,12 @@
3
3
  require "rest-client"
4
4
 
5
5
  module Smartpay
6
+ # Smartpay configuration
6
7
  class Configuration
7
- attr_accessor :public_key, :secret_key
8
- attr_writer :request_timeout, :api_url, :checkout_url, :retry_options
8
+ attr_accessor :public_key, :secret_key, :request_timeout, :api_url, :retry_options
9
9
 
10
10
  DEFAULT_TIMEOUT_SETTING = 30
11
11
  DEFAULT_API_URL = "https://api.smartpay.co/v1"
12
- DEFAULT_CHECKOUT_URL = "https://checkout.smartpay.co"
13
12
  DEFAULT_RETRY_OPTIONS = {
14
13
  max_tries: 1,
15
14
  base_sleep_seconds: 0.5,
@@ -19,44 +18,16 @@ module Smartpay
19
18
  }.freeze
20
19
 
21
20
  def initialize
22
- @request_timeout = DEFAULT_TIMEOUT_SETTING
23
- @api_url = if in_development_mode?
24
- ENV["SMARTPAY_API_PREFIX"].downcase || DEFAULT_API_URL
25
- else
26
- DEFAULT_API_URL
27
- end
28
- @checkout_url = if in_development_mode? && ENV["SMARTPAY_CHECKOUT_URL"].is_a?(String)
29
- ENV["SMARTPAY_CHECKOUT_URL"].downcase || DEFAULT_CHECKOUT_URL
30
- else
31
- DEFAULT_CHECKOUT_URL
32
- end
33
- @retry_options = DEFAULT_RETRY_OPTIONS
34
- end
35
-
36
- def request_timeout
37
- @request_timeout || DEFAULT_TIMEOUT_SETTING
38
- end
39
-
40
- def api_url
41
- if in_development_mode?
42
- @api_url || ENV["SMARTPAY_API_PREFIX"].downcase || DEFAULT_API_URL
43
- else
44
- @api_url || DEFAULT_API_URL
45
- end
46
- end
47
-
48
- def checkout_url
49
- @checkout_url || DEFAULT_CHECKOUT_URL
50
- end
51
-
52
- def retry_options
53
- @retry_options || DEFAULT_RETRY_OPTIONS
21
+ reset
54
22
  end
55
23
 
56
- private
57
-
58
- def in_development_mode?
59
- ENV["SMARTPAY_API_PREFIX"].downcase.include?("api.smartpay") if ENV["SMARTPAY_API_PREFIX"].is_a?(String)
24
+ def reset
25
+ @request_timeout = DEFAULT_TIMEOUT_SETTING
26
+ @api_url = ENV.fetch("SMARTPAY_API_PREFIX", DEFAULT_API_URL).downcase
27
+ @retry_options = DEFAULT_RETRY_OPTIONS
28
+ @request_timeout = DEFAULT_TIMEOUT_SETTING
29
+ @public_key = ENV.fetch("SMARTPAY_PUBLIC_KEY", nil)
30
+ @secret_key = ENV.fetch("SMARTPAY_SECRET_KEY", nil)
60
31
  end
61
32
  end
62
33
  end
@@ -3,7 +3,6 @@
3
3
  module Smartpay
4
4
  module Responses
5
5
  class CheckoutSession < Base
6
-
7
6
  def redirect_url(options = {})
8
7
  url = response[:url]
9
8
 
@@ -15,16 +14,6 @@ module Smartpay
15
14
 
16
15
  url
17
16
  end
18
-
19
- private
20
-
21
- def checkout_url
22
- Smartpay.configuration.checkout_url
23
- end
24
-
25
- def public_key
26
- Smartpay.configuration.public_key
27
- end
28
17
  end
29
18
  end
30
19
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Smartpay
4
- VERSION = "0.8.0"
4
+ VERSION = "0.9.0"
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smartpay
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Smartpay
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-01-18 00:00:00.000000000 Z
11
+ date: 2023-02-20 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client
@@ -47,6 +47,7 @@ extra_rdoc_files: []
47
47
  files:
48
48
  - ".rspec"
49
49
  - ".rubocop.yml"
50
+ - ".whitesource"
50
51
  - CHANGELOG.md
51
52
  - CODE_OF_CONDUCT.md
52
53
  - Gemfile