baza.rb 0.0.3 → 0.0.4

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: 79bdf99ef89239ac525987bbde20700d7c2ce13d05198df581729b0bd73bec6b
4
- data.tar.gz: 8acc9a7baef255599d65b3ef6092f35c7355b22ce6ea09cca490a0da0e2dd429
3
+ metadata.gz: 0ac6dd23ce75d129ed2569730f17c38477220e4637736acf630b3a5b1233e30a
4
+ data.tar.gz: 86036e407483b556df491bc25b9b37ba7a39fd054ec8d5005f7d5f5ef5af1139
5
5
  SHA512:
6
- metadata.gz: 8d03964151b2b9eb9f7362425a877321d31d4bbce17c0e500f7f151d95cb3bde298fef2edc0f870c68e5c4447c6c2b82793ebc0a2e44508bf5182fad35080103
7
- data.tar.gz: e45fdea8eb1df4ac95cf8a43cca2e6899bd997dd6140fe5eb9c80315cdc11301b6dc5eeb57a3b9683a6c7f67538bc31048e3c3069acca389ec3ab70dbeb66351
6
+ metadata.gz: abc122fe9f3500aee61644f9605fdd11b5d4afbf593ccbcf000be18802799a144573822aa51aa88fe3b84140a0dd2be9d04001a5cdbb5c9e00d7cf28e6f39e00
7
+ data.tar.gz: 85d8540811e627ee942821862da29b2578d92362dd889d9f12c85f8713377cd30151213449ee079d63702d2bf47d927de1892b49755ee28407cf13f569ca82ab
data/baza.rb.gemspec CHANGED
@@ -27,7 +27,7 @@ Gem::Specification.new do |s|
27
27
  s.required_rubygems_version = Gem::Requirement.new('>= 0') if s.respond_to? :required_rubygems_version=
28
28
  s.required_ruby_version = '>=3.0'
29
29
  s.name = 'baza.rb'
30
- s.version = Baza::VERSION
30
+ s.version = BazaRb::VERSION
31
31
  s.license = 'MIT'
32
32
  s.summary = 'Zerocracy API Ruby Client'
33
33
  s.description =
@@ -25,6 +25,6 @@
25
25
  # Author:: Yegor Bugayenko (yegor256@gmail.com)
26
26
  # Copyright:: Copyright (c) 2024 Yegor Bugayenko
27
27
  # License:: MIT
28
- class Baza
29
- VERSION = '0.0.3'
28
+ class BazaRb
29
+ VERSION = '0.0.4'
30
30
  end
data/lib/baza-rb.rb CHANGED
@@ -20,12 +20,12 @@
20
20
  # OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
21
  # SOFTWARE.
22
22
 
23
- require 'typhoeus'
24
- require 'retries'
23
+ require 'base64'
25
24
  require 'iri'
26
25
  require 'loog'
27
- require 'base64'
26
+ require 'retries'
28
27
  require 'tago'
28
+ require 'typhoeus'
29
29
  require_relative 'baza-rb/version'
30
30
 
31
31
  # Interface to the API of zerocracy.com.
@@ -273,7 +273,7 @@ class BazaRb
273
273
  body: {
274
274
  'jname' => jname,
275
275
  'file' => File.basename(file),
276
- 'zip' => File.open(file, 'r')
276
+ 'zip' => File.open(file, 'rb')
277
277
  },
278
278
  headers:,
279
279
  connecttimeout: @timeout,
@@ -377,7 +377,7 @@ class BazaRb
377
377
 
378
378
  def headers
379
379
  {
380
- 'User-Agent' => "baza.rb #{Baza::VERSION}",
380
+ 'User-Agent' => "baza.rb #{BazaRb::VERSION}",
381
381
  'Connection' => 'close',
382
382
  'X-Zerocracy-Token' => @token
383
383
  }
@@ -434,10 +434,11 @@ class BazaRb
434
434
  return ret
435
435
  end
436
436
  @loog.debug("#{log}\n #{(ret.headers || {}).map { |k, v| "#{k}: #{v}" }.join("\n ")}")
437
+ headers = ret.headers || {}
437
438
  msg = [
438
439
  "Invalid response code ##{ret.code} ",
439
440
  "at #{mtd} #{url}",
440
- ret.headers['X-Zerocracy-Flash'] ? " (#{ret.headers['X-Zerocracy-Flash'].inspect})" : ''
441
+ headers['X-Zerocracy-Flash'] ? " (#{headers['X-Zerocracy-Flash'].inspect})" : ''
441
442
  ].join
442
443
  case ret.code
443
444
  when 500
@@ -446,7 +447,7 @@ class BazaRb
446
447
  'please report this to https://github.com/zerocracy/baza'
447
448
  when 503
448
449
  msg +=
449
- ", most probably it's an internal error on the server (#{ret.headers['X-Zerocracy-Failure'].inspect}), " \
450
+ ", most probably it's an internal error on the server (#{headers['X-Zerocracy-Failure'].inspect}), " \
450
451
  'please report this to https://github.com/zerocracy/baza.rb'
451
452
  when 404
452
453
  msg +=
data/test/test_baza-rb.rb CHANGED
@@ -167,7 +167,7 @@ class TestBazaRb < Minitest::Test
167
167
  with_http_server(200, 'yes') do |baza|
168
168
  baza.name_exists?('simple')
169
169
  end
170
- assert_equal("baza.rb #{Baza::VERSION}", req['user-agent'])
170
+ assert_equal("baza.rb #{BazaRb::VERSION}", req['user-agent'])
171
171
  end
172
172
 
173
173
  def test_push_with_meta
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: baza.rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yegor Bugayenko