smartpay 0.2.10 → 0.2.14
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 +15 -3
- 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: 27577ba266e00cb77bb730e603c9b8f44d93d9062f4935f72f9ef29c9904c456
|
4
|
+
data.tar.gz: d9d98d1da2b90545f42ed7a982bca956fb6eaa9beb6b90a73c0789ae6ce07bfe
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 5a95a99d46cd097137108c2839802e79903ecb6902ccfafc637eee370c1bf96c272c20a8e6dc5c54af8a1d7aa3114cb6d8f1c55ced9b2916384cc5249c05a5ec
|
7
|
+
data.tar.gz: 3a6651ccdf5d72b9716be260b5c20638220ef6c7da00e3ecd43db9ee405ac6ea5205d923aed0213ce9c84a4d5d0c16a22c4de4bb4a6dd373b9bc92c71bb00340
|
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
|
@@ -2,11 +2,11 @@
|
|
2
2
|
|
3
3
|
module Smartpay
|
4
4
|
class Configuration
|
5
|
-
attr_accessor :
|
6
|
-
|
5
|
+
attr_accessor :public_key, :secret_key
|
6
|
+
attr_writer :post_timeout, :api_url, :checkout_url
|
7
7
|
|
8
8
|
DEFAULT_TIMEOUT_SETTING = 30
|
9
|
-
DEFAULT_API_URL = 'https://api.smartpay.co'
|
9
|
+
DEFAULT_API_URL = 'https://api.smartpay.co/v1'
|
10
10
|
DEFAULT_CHECKOUT_URL = 'https://checkout.smartpay.co'
|
11
11
|
|
12
12
|
def initialize
|
@@ -14,5 +14,17 @@ module Smartpay
|
|
14
14
|
@api_url = DEFAULT_API_URL
|
15
15
|
@checkout_url = DEFAULT_CHECKOUT_URL
|
16
16
|
end
|
17
|
+
|
18
|
+
def post_timeout
|
19
|
+
@post_timeout || DEFAULT_TIMEOUT_SETTING
|
20
|
+
end
|
21
|
+
|
22
|
+
def api_url
|
23
|
+
@api_url || DEFAULT_API_URL
|
24
|
+
end
|
25
|
+
|
26
|
+
def checkout_url
|
27
|
+
@checkout_url || DEFAULT_CHECKOUT_URL
|
28
|
+
end
|
17
29
|
end
|
18
30
|
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.14
|
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
|