payabli 3.0.4 → 3.0.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: ba6433fa0be5362832d5430527bae26321e6d8f10a8aa1a62366742fbce5b0a2
4
- data.tar.gz: 427557254056844c433a4fc82e023b1144d5c82458aff1e5a77fb1264ed1a795
3
+ metadata.gz: b244baca4d457ef5e1e43e54b46c5b7cc24648cdd351b5da31dbbe6211cf27da
4
+ data.tar.gz: 358b6be5dac8473a4d25b4de4750cbac51ae5a4c1361b8904ff9e57165becba0
5
5
  SHA512:
6
- metadata.gz: f99db2b158290293363055837d01b63802afb3d81e5d3d2ff453599dd2578a56fd902f522de63b51c65744cb0e2a644183636b9d124e139a8ba15cdc3d65e226
7
- data.tar.gz: 496bdb849ed1aeaf582a6c0af089da120cf00a1495a55948c4de04c7394d446d3ae8af055fb0ff71a0acb50a2fb6f2ffbf0aa911a3ee6ee3b45a17500f91a16b
6
+ metadata.gz: e193a9655b0961dbb9d4f2532bce484191b0b1e81c389e778b8e6e8c8c6eb44e5e7e21edc7b2cd4b1890379c2266831fa9d7235ca4c6ee7676fafb5455f100cf
7
+ data.tar.gz: '04587a27b2f6e1b4dfc5c10e2e7c2103036c2c5c1036044b3d4478481a3719f2458386bea6fab67bab38d730286306622aa5b869040d0b4bad83dd05b1e35469'
data/.fern/metadata.json CHANGED
@@ -6,10 +6,10 @@
6
6
  "enableWireTests": true,
7
7
  "rubocopVariableNumberStyle": "snake_case"
8
8
  },
9
- "originGitCommit": "4a292ff89b1a47f4e159d99e6b8ac1d9af84a653",
9
+ "originGitCommit": "691a950bd6f2451fa2ba6099f1b830b17fac51ec",
10
10
  "originGitCommitIsDirty": true,
11
11
  "invokedBy": "ci",
12
- "requestedVersion": "3.0.4",
12
+ "requestedVersion": "3.0.5",
13
13
  "ciProvider": "github",
14
- "sdkVersion": "3.0.4"
14
+ "sdkVersion": "3.0.5"
15
15
  }
data/README.md CHANGED
@@ -71,10 +71,7 @@ Instantiate and use the client with the following:
71
71
  ```ruby
72
72
  require "payabli"
73
73
 
74
- client = Payabli::Client.new(
75
- client_id: "<clientId>",
76
- client_secret: "<clientSecret>"
77
- )
74
+ client = Payabli::Client.new(api_key: "<value>")
78
75
 
79
76
  client.money_in.getpaidv_2(
80
77
  customer_data: {
@@ -2,41 +2,19 @@
2
2
 
3
3
  module Payabli
4
4
  class Client
5
+ # @param api_key [String]
5
6
  # @param base_url [String, nil]
6
- # @param client_id [String, nil]
7
- # @param client_secret [String, nil]
8
- # @param api_key [String, nil]
9
7
  # @param max_retries [Integer]
10
8
  #
11
9
  # @return [void]
12
- def initialize(base_url: nil, client_id: ENV.fetch("OAUTH_CLIENT_ID", nil), client_secret: ENV.fetch("OAUTH_CLIENT_SECRET", nil), api_key: nil, max_retries: 2)
13
- if !client_id.to_s.empty? && !client_secret.to_s.empty?
14
- # Create an unauthenticated client for the auth endpoint
15
- auth_raw_client = Payabli::Internal::Http::RawClient.new(
16
- base_url: base_url || Payabli::Environment::SANDBOX,
17
- headers: {
18
- "X-Fern-Language" => "Ruby"
19
- }
20
- )
21
-
22
- # Create the auth client for token retrieval
23
- auth_client = Payabli::Token::Client.new(client: auth_raw_client)
24
-
25
- # Create the OAuth provider with the auth client and credentials
26
- @auth_provider = Payabli::Internal::OAuthProvider.new(
27
- auth_client: auth_client,
28
- options: { base_url: base_url, client_id: client_id, client_secret: client_secret }
29
- )
30
- end
31
-
10
+ def initialize(api_key:, base_url: nil, max_retries: 2)
32
11
  @raw_client = Payabli::Internal::Http::RawClient.new(
33
12
  base_url: base_url || Payabli::Environment::SANDBOX,
34
13
  headers: {
35
- "User-Agent" => "payabli/3.0.4",
14
+ "User-Agent" => "payabli/3.0.5",
36
15
  "X-Fern-Language" => "Ruby",
37
16
  requestToken: api_key.to_s
38
17
  },
39
- auth_provider: @auth_provider,
40
18
  max_retries: max_retries
41
19
  )
42
20
  end
@@ -113,7 +113,7 @@ module Payabli
113
113
 
114
114
  field :rep_office, -> { String }, optional: true, nullable: false, api_name: "RepOffice"
115
115
 
116
- field :on_create, -> { String }, optional: true, nullable: false, api_name: "onCreate"
116
+ field :on_create, -> { Internal::Types::Array[String] }, optional: true, nullable: false, api_name: "onCreate"
117
117
  end
118
118
  end
119
119
  end
@@ -83,7 +83,7 @@ module Payabli
83
83
 
84
84
  field :rep_office, -> { String }, optional: true, nullable: false, api_name: "RepOffice"
85
85
 
86
- field :on_create, -> { String }, optional: true, nullable: false, api_name: "onCreate"
86
+ field :on_create, -> { Internal::Types::Array[String] }, optional: true, nullable: false, api_name: "onCreate"
87
87
  end
88
88
  end
89
89
  end
@@ -95,7 +95,7 @@ module Payabli
95
95
 
96
96
  field :rep_office, -> { String }, optional: true, nullable: false, api_name: "RepOffice"
97
97
 
98
- field :on_create, -> { String }, optional: true, nullable: false, api_name: "onCreate"
98
+ field :on_create, -> { Internal::Types::Array[String] }, optional: true, nullable: false, api_name: "onCreate"
99
99
  end
100
100
  end
101
101
  end
@@ -116,7 +116,7 @@ module Payabli
116
116
 
117
117
  field :rep_office, -> { String }, optional: true, nullable: false, api_name: "RepOffice"
118
118
 
119
- field :on_create, -> { String }, optional: true, nullable: false, api_name: "onCreate"
119
+ field :on_create, -> { Internal::Types::Array[String] }, optional: true, nullable: false, api_name: "onCreate"
120
120
  end
121
121
  end
122
122
  end
@@ -3,7 +3,7 @@
3
3
  module Payabli
4
4
  module Types
5
5
  module OnCreate
6
- # OnCreate is an alias for String
6
+ # OnCreate is an alias for Array
7
7
 
8
8
  # @option str [String]
9
9
  #
@@ -26,7 +26,7 @@ module Payabli
26
26
 
27
27
  field :device, -> { String }, optional: true, nullable: false
28
28
 
29
- field :initator, -> { String }, optional: true, nullable: false
29
+ field :initiator, -> { String }, optional: true, nullable: false
30
30
 
31
31
  field :method_, -> { Payabli::Types::Methodall }, optional: true, nullable: false, api_name: "method"
32
32
 
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Payabli
4
- VERSION = "3.0.4"
4
+ VERSION = "3.0.5"
5
5
  end
data/lib/payabli.rb CHANGED
@@ -1110,4 +1110,3 @@ require_relative "payabli/payout_subscription/types/update_payout_subscription_b
1110
1110
  require_relative "payabli/charge_backs/client"
1111
1111
  require_relative "payabli/charge_backs/types/response_charge_back"
1112
1112
  require_relative "payabli/environment"
1113
- require_relative "payabli/internal/oauth_provider"
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: payabli
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.4
4
+ version: 3.0.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - Payabli
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2026-07-20 00:00:00.000000000 Z
11
+ date: 2026-07-24 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: The Payabli Ruby library provides convenient access to the Payabli API
14
14
  from Ruby.
@@ -113,7 +113,6 @@ files:
113
113
  - lib/payabli/internal/multipart/multipart_form_data.rb
114
114
  - lib/payabli/internal/multipart/multipart_form_data_part.rb
115
115
  - lib/payabli/internal/multipart/multipart_request.rb
116
- - lib/payabli/internal/oauth_provider.rb
117
116
  - lib/payabli/internal/types/array.rb
118
117
  - lib/payabli/internal/types/boolean.rb
119
118
  - lib/payabli/internal/types/enum.rb
@@ -1,67 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Payabli
4
- module Internal
5
- class OAuthProvider
6
- BUFFER_IN_SECONDS = 120 # 2 minutes
7
-
8
- # @param auth_client [untyped]
9
- # @param options [Hash[String, untyped]]
10
- #
11
- # @return [void]
12
- def initialize(auth_client:, options:)
13
- @auth_client = auth_client
14
- @options = options
15
- @access_token = nil
16
- @expires_at = nil
17
- end
18
-
19
- # Returns a cached access token, refreshing if necessary.
20
- # Refreshes the token if it's nil, or if we're within the buffer period before expiration.
21
- #
22
- # @return [String]
23
- def token
24
- return refresh if @access_token.nil? || token_needs_refresh?
25
-
26
- @access_token
27
- end
28
-
29
- # Returns the authentication headers to be included in requests.
30
- #
31
- # @return [Hash[String, String]]
32
- def auth_headers
33
- access_token = token
34
- {
35
- Authorization: "Bearer #{access_token}"
36
- }
37
- end
38
-
39
- # Checks if the token needs to be refreshed.
40
- # Returns true if the token will expire within the buffer period.
41
- #
42
- # @return [Boolean]
43
- private def token_needs_refresh?
44
- return true if @expires_at.nil?
45
-
46
- Time.now >= (@expires_at - BUFFER_IN_SECONDS)
47
- end
48
-
49
- # Refreshes the access token by calling the token endpoint.
50
- #
51
- # @return [String]
52
- private def refresh
53
- request_params = {
54
- client_id: @options[:client_id],
55
- client_secret: @options[:client_secret]
56
- }
57
-
58
- token_response = @auth_client.create_server_side_token(**request_params)
59
-
60
- @access_token = token_response.access_token
61
- @expires_at = Time.now + token_response.expires_in
62
-
63
- @access_token
64
- end
65
- end
66
- end
67
- end