yoomoney 0.2.0 → 0.4.0

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: 3720ec618b6bda1461affd3652745c26a53bee8dd933b3fe7f3ac78d12a27d2d
4
- data.tar.gz: cd9cf0bfc9caf25038fc077f9ea3e6fb27c52d00139e7e24c488079a06392e8a
3
+ metadata.gz: 7fc7cc115fd073113e5c5ddd6f74a1dc490e0eb17283cdc0ead7e84fff2c8c28
4
+ data.tar.gz: 758d082193bdc8e9927eab64242366e627b9f6ab180041d7805ee0ef0ab9ce5b
5
5
  SHA512:
6
- metadata.gz: c3fa339cf8f608baa8764fa81e8b44e882da02639562bdc5b628a83fc4a502ccf9becbaa9db6debc8281994973a44788dd4fb52ba9354ef40735bdcdd1bc5d81
7
- data.tar.gz: 59bdf76ecdbc77ba83cd4ad74733329306a2533a1178b1d2aada178bfa76d795aae893570882f7d86a92edd98eaf14975221954e5ba84bf627ab552e005fce1f
6
+ metadata.gz: 5499ebb0a382b81f5e8ac81aa2c4b926e52745dc9f162418f00939eefb0ca71db17dfcf8d7277f22dec6145224eafc61294b011e7f2443d17290124672ec5731
7
+ data.tar.gz: 43206f99994d0cb058341d71613ba1a935cd62980a5d9004cf0240ae42d065d8df0de61a7cc87e89058748d66b5c2d97ae5b80e2e04b714d4c6ecac2abc8422c
data/CHANGELOG.md CHANGED
@@ -1,5 +1,22 @@
1
1
  # Changelog
2
2
 
3
+ ## 0.4.0 (2026-02-19)
4
+
5
+ Full Changelog: [v0.3.0...v0.4.0](https://github.com/Hexlet/yoomoney-ruby/compare/v0.3.0...v0.4.0)
6
+
7
+ ### Features
8
+
9
+ * **api:** api update ([c792fd8](https://github.com/Hexlet/yoomoney-ruby/commit/c792fd813fb0c1937753a2deda1c1d763af4081d))
10
+
11
+ ## 0.3.0 (2026-02-19)
12
+
13
+ Full Changelog: [v0.2.0...v0.3.0](https://github.com/Hexlet/yoomoney-ruby/compare/v0.2.0...v0.3.0)
14
+
15
+ ### Features
16
+
17
+ * **api:** manual updates ([b75593c](https://github.com/Hexlet/yoomoney-ruby/commit/b75593cad51a278a820e8835964c489af6bbf25a))
18
+ * **api:** manual updates ([75047a6](https://github.com/Hexlet/yoomoney-ruby/commit/75047a6b38457301fa731534c18d49393af80be0))
19
+
3
20
  ## 0.2.0 (2026-02-14)
4
21
 
5
22
  Full Changelog: [v0.1.0...v0.2.0](https://github.com/Hexlet/yoomoney-ruby/compare/v0.1.0...v0.2.0)
data/README.md CHANGED
@@ -15,7 +15,7 @@ To use this gem, install via Bundler by adding the following to your application
15
15
  <!-- x-release-please-start-version -->
16
16
 
17
17
  ```ruby
18
- gem "yoomoney", "~> 0.2.0"
18
+ gem "yoomoney", "~> 0.4.0"
19
19
  ```
20
20
 
21
21
  <!-- x-release-please-end -->
@@ -26,7 +26,10 @@ gem "yoomoney", "~> 0.2.0"
26
26
  require "bundler/setup"
27
27
  require "yoomoney"
28
28
 
29
- yoomoney = Yoomoney::Client.new
29
+ yoomoney = Yoomoney::Client.new(
30
+ username: ENV["YOOMONEY_USERNAME"], # This is the default and can be omitted
31
+ password: ENV["YOOMONEY_PASSWORD"] # This is the default and can be omitted
32
+ )
30
33
 
31
34
  payment = yoomoney.payments.create(amount: {currency: "RUB", value: "value"}, idempotence_key: "Idempotence-Key")
32
35
 
@@ -56,6 +56,16 @@ module Yoomoney
56
56
  # @return [Yoomoney::Resources::Me]
57
57
  attr_reader :me
58
58
 
59
+ # @api private
60
+ #
61
+ # @return [Hash{String=>String}]
62
+ private def auth_headers
63
+ return {} if @username.nil? || @password.nil?
64
+
65
+ base64_credentials = ["#{@username}:#{@password}"].pack("m0")
66
+ {"authorization" => "Basic #{base64_credentials}"}
67
+ end
68
+
59
69
  # Creates and returns a new client for interacting with the API.
60
70
  #
61
71
  # @param username [String, nil] HTTP Basic аутентификация клиента ЮKassa (shopId) Defaults to
@@ -215,6 +215,11 @@ module Yoomoney
215
215
  @max_retry_delay = max_retry_delay
216
216
  end
217
217
 
218
+ # @api private
219
+ #
220
+ # @return [Hash{String=>String}]
221
+ private def auth_headers = {}
222
+
218
223
  # @api private
219
224
  #
220
225
  # @return [String]
@@ -271,6 +276,7 @@ module Yoomoney
271
276
 
272
277
  headers = Yoomoney::Internal::Util.normalized_headers(
273
278
  @headers,
279
+ auth_headers,
274
280
  req[:headers].to_h,
275
281
  opts[:extra_headers].to_h
276
282
  )
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Yoomoney
4
- VERSION = "0.2.0"
4
+ VERSION = "0.4.0"
5
5
  end
@@ -51,6 +51,11 @@ module Yoomoney
51
51
  sig { returns(Yoomoney::Resources::Me) }
52
52
  attr_reader :me
53
53
 
54
+ # @api private
55
+ sig { override.returns(T::Hash[String, String]) }
56
+ private def auth_headers
57
+ end
58
+
54
59
  # Creates and returns a new client for interacting with the API.
55
60
  sig do
56
61
  params(
@@ -171,6 +171,11 @@ module Yoomoney
171
171
  )
172
172
  end
173
173
 
174
+ # @api private
175
+ sig { overridable.returns(T::Hash[String, String]) }
176
+ private def auth_headers
177
+ end
178
+
174
179
  # @api private
175
180
  sig { returns(String) }
176
181
  private def user_agent
@@ -34,6 +34,8 @@ module Yoomoney
34
34
 
35
35
  attr_reader me: Yoomoney::Resources::Me
36
36
 
37
+ private def auth_headers: -> ::Hash[String, String]
38
+
37
39
  def initialize: (
38
40
  ?username: String?,
39
41
  ?password: String?,
@@ -85,6 +85,8 @@ module Yoomoney
85
85
  ?idempotency_header: String?
86
86
  ) -> void
87
87
 
88
+ private def auth_headers: -> ::Hash[String, String]
89
+
88
90
  private def user_agent: -> String
89
91
 
90
92
  private def generate_idempotency_key: -> String
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: yoomoney
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yoomoney
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2026-02-14 00:00:00.000000000 Z
11
+ date: 2026-02-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: cgi