baza.rb 0.2.0 → 0.3.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 +4 -4
- data/lib/baza-rb/fake.rb +1 -5
- data/lib/baza-rb/version.rb +1 -1
- data/lib/baza-rb.rb +2 -7
- data/test/test_baza-rb.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 912ab13ee0311c4e86d24120f46469e871fba77babe19f577b9103c7277a6889
|
4
|
+
data.tar.gz: '0890e6eeafc0655074600b85bb2f67076fac6762d7163850f8a67a35778a8110'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f727b783ed1343d979e533a4113cdc15d0f995328343e1e640bea0035741b6e30862159a045555f004e15e0c19fc6e152d62139b12d2782215f28dc01b98d78
|
7
|
+
data.tar.gz: 74beb4a5936c81d094ad47ecfafc7a8cdf65dcb8973623749bcfc95ded8106c4fe3c266d7a3300208a794f45ae9d7e423fc549a73a71b3bf3c0922a55a4cbd25
|
data/lib/baza-rb/fake.rb
CHANGED
@@ -160,15 +160,11 @@ class BazaRb::Fake
|
|
160
160
|
# @param [String] recipient GitHub name (e.g. "yegor256") of the recipient
|
161
161
|
# @param [Float] amount The amount in Z/USDT (not zents!)
|
162
162
|
# @param [String] summary The description of the payment
|
163
|
-
|
164
|
-
# @param [Integer] job The amount of points just rewarded
|
165
|
-
# @return [Integer] Receipt ID
|
166
|
-
def transfer(recipient, amount, summary, job: nil, points: nil)
|
163
|
+
def transfer(recipient, amount, summary, *)
|
167
164
|
raise "The receipient #{recipient.inspect} is not valid" unless recipient.match?(/^[a-zA-Z0-9-]+$/)
|
168
165
|
raise "The amount #{amount} must be a Float" unless amount.is_a?(Float)
|
169
166
|
raise "The amount #{amount} must be positive" unless amount.positive?
|
170
167
|
raise "The summary #{summary.inspect} is empty" if summary.empty?
|
171
|
-
raise 'The job must go together with points' if !job.nil? && points.nil?
|
172
168
|
42
|
173
169
|
end
|
174
170
|
|
data/lib/baza-rb/version.rb
CHANGED
data/lib/baza-rb.rb
CHANGED
@@ -467,9 +467,8 @@ class BazaRb
|
|
467
467
|
# @param [Float] amount The amount in Z/USDT (not zents!)
|
468
468
|
# @param [String] summary The description of the payment
|
469
469
|
# @param [Integer] job The ID of the job or NIL
|
470
|
-
# @param [Integer] job The amount of points just rewarded
|
471
470
|
# @return [Integer] Receipt ID
|
472
|
-
def transfer(recipient, amount, summary, job: nil
|
471
|
+
def transfer(recipient, amount, summary, job: nil)
|
473
472
|
raise 'The "recipient" is nil' if recipient.nil?
|
474
473
|
raise 'The "amount" is nil' if amount.nil?
|
475
474
|
raise 'The "amount" must be Float' unless amount.is_a?(Float)
|
@@ -481,11 +480,7 @@ class BazaRb
|
|
481
480
|
'amount' => amount.to_s,
|
482
481
|
'summary' => summary
|
483
482
|
}
|
484
|
-
unless job.nil?
|
485
|
-
body['job'] = job
|
486
|
-
raise 'The "points" must be Integer' unless points.is_a?(Integer)
|
487
|
-
body['points'] = points.to_s
|
488
|
-
end
|
483
|
+
body['job'] = job unless job.nil?
|
489
484
|
elapsed(@loog) do
|
490
485
|
ret =
|
491
486
|
with_retries(max_tries: @retries, rescue: TimedOut) do
|
data/test/test_baza-rb.rb
CHANGED
@@ -110,7 +110,7 @@ class TestBazaRb < Minitest::Test
|
|
110
110
|
stub_request(:post, 'https://example.org/account/transfer').to_return(
|
111
111
|
status: 302, headers: { 'X-Zerocracy-ReceiptId' => '42' }
|
112
112
|
)
|
113
|
-
id = BazaRb.new('example.org', 443, '000').transfer('jeff', 42.50, 'for fun', job: 555
|
113
|
+
id = BazaRb.new('example.org', 443, '000').transfer('jeff', 42.50, 'for fun', job: 555)
|
114
114
|
assert_equal(42, id)
|
115
115
|
end
|
116
116
|
|