smartpay 0.2.12 → 0.2.16
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/generators/smartpay/templates/initializer.rb +0 -2
- data/lib/smartpay/client.rb +9 -1
- data/lib/smartpay/configuration.rb +18 -2
- data/lib/smartpay/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: a42e702ac2b0fc1237d6e5aff589bd3cf454aa7bcbddd5ba3843983d0e8e1324
|
4
|
+
data.tar.gz: 91a4fdfff9be9e03499605f1899d6cc1f3bdb047303d4500a155cbe528443a2a
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 91bcb22eabb064bd0e21ec6c8c08fbd3f339a697e1131ceda8d5c98fb1bce7ccb08470b72399b7bb89964bd63d5cdadc75d40bc114703a5258dab99c76302076
|
7
|
+
data.tar.gz: 7aee3ae59b6af7a79f821b73dea25cd4f7865357a61a4ff5bff06fe1cd10329b0de4aca2ce0c2998488d24a517af859404d183d56bf7d6f0b4836cd0ad7c227d
|
data/lib/smartpay/client.rb
CHANGED
@@ -6,7 +6,8 @@ module Smartpay
|
|
6
6
|
class Client
|
7
7
|
class << self
|
8
8
|
def post(path, payload = {})
|
9
|
-
|
9
|
+
request_payload = default_payload.merge(payload)
|
10
|
+
response = RestClient::Request.execute(method: :post, url: api_url(path), headers: headers, timeout: timeout, payload: request_payload.to_json)
|
10
11
|
JSON.parse(response.body, symbolize_names: true)
|
11
12
|
end
|
12
13
|
|
@@ -31,6 +32,13 @@ module Smartpay
|
|
31
32
|
def secret_key
|
32
33
|
Smartpay.configuration.secret_key
|
33
34
|
end
|
35
|
+
|
36
|
+
def default_payload
|
37
|
+
{
|
38
|
+
'dev-lang': :ruby,
|
39
|
+
'sdk-version': Smartpay::VERSION
|
40
|
+
}.freeze
|
41
|
+
end
|
34
42
|
end
|
35
43
|
end
|
36
44
|
end
|
@@ -11,7 +11,11 @@ module Smartpay
|
|
11
11
|
|
12
12
|
def initialize
|
13
13
|
@post_timeout = DEFAULT_TIMEOUT_SETTING
|
14
|
-
@api_url =
|
14
|
+
@api_url = if in_development_mode?
|
15
|
+
ENV['SMARTPAY_API_PREFIX'] || DEFAULT_API_URL
|
16
|
+
else
|
17
|
+
DEFAULT_API_URL
|
18
|
+
end
|
15
19
|
@checkout_url = DEFAULT_CHECKOUT_URL
|
16
20
|
end
|
17
21
|
|
@@ -20,11 +24,23 @@ module Smartpay
|
|
20
24
|
end
|
21
25
|
|
22
26
|
def api_url
|
23
|
-
|
27
|
+
if in_development_mode?
|
28
|
+
@api_url || ENV['SMARTPAY_API_PREFIX'] || DEFAULT_API_URL
|
29
|
+
else
|
30
|
+
@api_url || DEFAULT_API_URL
|
31
|
+
end
|
24
32
|
end
|
25
33
|
|
26
34
|
def checkout_url
|
27
35
|
@checkout_url || DEFAULT_CHECKOUT_URL
|
28
36
|
end
|
37
|
+
|
38
|
+
private
|
39
|
+
|
40
|
+
def in_development_mode?
|
41
|
+
if ENV['SMARTPAY_API_PREFIX'].is_a?(String)
|
42
|
+
ENV['SMARTPAY_API_PREFIX'].include?('api.smartpay')
|
43
|
+
end
|
44
|
+
end
|
29
45
|
end
|
30
46
|
end
|
data/lib/smartpay/version.rb
CHANGED
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.2.
|
4
|
+
version: 0.2.16
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Smartpay
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-10-
|
11
|
+
date: 2021-10-28 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rest-client
|