smartpay 0.2.11 → 0.2.15
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/api.rb +1 -1
- data/lib/smartpay/client.rb +9 -1
- data/lib/smartpay/configuration.rb +2 -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: e69060f27a2870839a5271eb8718bbb0f7898efee00f70a06231ccc4042643f4
|
4
|
+
data.tar.gz: 739ddc687f25d13c683b7e651ec5f8b6a569d8dcddee74913bd21afbee055bbf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 33edcef309bce743fc835bf3c812d73db904bac4a6407e85072357279d661292ce2b2e9001bfd672cd14c25e42d3fd0c8956ea57f947fed0133ae99150e48f20
|
7
|
+
data.tar.gz: 5f0ad3bef86e42f14ce864605e25505e07dab21ef23e1be1f243474f249f327a0145c742a340345cdde1e3c699ae53e8c05bbabcb4657434f906fdae1906d955
|
data/lib/smartpay/api.rb
CHANGED
@@ -5,7 +5,7 @@ module Smartpay
|
|
5
5
|
class << self
|
6
6
|
def create_checkout_session(payload)
|
7
7
|
Responses::CheckoutSession.new(
|
8
|
-
Client.post('/checkout
|
8
|
+
Client.post('/checkout-sessions', Requests::CheckoutSession.new(payload).as_hash)
|
9
9
|
)
|
10
10
|
end
|
11
11
|
end
|
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,7 @@ module Smartpay
|
|
11
11
|
|
12
12
|
def initialize
|
13
13
|
@post_timeout = DEFAULT_TIMEOUT_SETTING
|
14
|
-
@api_url = DEFAULT_API_URL
|
14
|
+
@api_url = ENV['SMARTPAY_API_PREFIX'] || DEFAULT_API_URL
|
15
15
|
@checkout_url = DEFAULT_CHECKOUT_URL
|
16
16
|
end
|
17
17
|
|
@@ -20,7 +20,7 @@ module Smartpay
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def api_url
|
23
|
-
@api_url || DEFAULT_API_URL
|
23
|
+
@api_url || ENV['SMARTPAY_API_PREFIX'] || DEFAULT_API_URL
|
24
24
|
end
|
25
25
|
|
26
26
|
def checkout_url
|
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.15
|
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
|