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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 0353211f9e0231c5524115accebba99be527dd01361f2706d587626d81e8129f
4
- data.tar.gz: b96ca9b9bd0aaac4746f5849ea29ef9e098de79f0de59fa4e9acb0f3ebf05a21
3
+ metadata.gz: e69060f27a2870839a5271eb8718bbb0f7898efee00f70a06231ccc4042643f4
4
+ data.tar.gz: 739ddc687f25d13c683b7e651ec5f8b6a569d8dcddee74913bd21afbee055bbf
5
5
  SHA512:
6
- metadata.gz: 7778f540af382892db264134748b4e1be41e1bc1292e4ab569393b342fe4e3c7caf55b36b70b1b41a125b99e882ba7b5ef1bea6c38276d76695546cedaa1101c
7
- data.tar.gz: cc1a7c500e098b63d5650472f50b5c23c072d88c1569a7e4b457ead20c2bf99434b48a86c59da786d4baa4c6df7d0045a4f4884e6a2b407566b597346cd3d6e4
6
+ metadata.gz: 33edcef309bce743fc835bf3c812d73db904bac4a6407e85072357279d661292ce2b2e9001bfd672cd14c25e42d3fd0c8956ea57f947fed0133ae99150e48f20
7
+ data.tar.gz: 5f0ad3bef86e42f14ce864605e25505e07dab21ef23e1be1f243474f249f327a0145c742a340345cdde1e3c699ae53e8c05bbabcb4657434f906fdae1906d955
@@ -1,8 +1,6 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  Smartpay.configure do |config|
4
- config.api_url = 'https://api.smartpay.co/smartpayments'
5
- config.checkout_url = 'https://checkout.smartpay.co'
6
4
  config.public_key = 'pk_test_'
7
5
  config.secret_key = 'sk_test_'
8
6
  end
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/sessions', Requests::CheckoutSession.new(payload).as_hash)
8
+ Client.post('/checkout-sessions', Requests::CheckoutSession.new(payload).as_hash)
9
9
  )
10
10
  end
11
11
  end
@@ -6,7 +6,8 @@ module Smartpay
6
6
  class Client
7
7
  class << self
8
8
  def post(path, payload = {})
9
- response = RestClient::Request.execute(method: :post, url: api_url(path), headers: headers, timeout: timeout, payload: payload.to_json)
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
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Smartpay
4
- VERSION = "0.2.11"
4
+ VERSION = "0.2.15"
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.2.11
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-26 00:00:00.000000000 Z
11
+ date: 2021-10-28 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: rest-client