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 +4 -4
- data/baza.rb.gemspec +1 -1
- data/lib/baza-rb/version.rb +2 -2
- data/lib/baza-rb.rb +8 -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: 0ac6dd23ce75d129ed2569730f17c38477220e4637736acf630b3a5b1233e30a
|
4
|
+
data.tar.gz: 86036e407483b556df491bc25b9b37ba7a39fd054ec8d5005f7d5f5ef5af1139
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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 =
|
30
|
+
s.version = BazaRb::VERSION
|
31
31
|
s.license = 'MIT'
|
32
32
|
s.summary = 'Zerocracy API Ruby Client'
|
33
33
|
s.description =
|
data/lib/baza-rb/version.rb
CHANGED
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 '
|
24
|
-
require 'retries'
|
23
|
+
require 'base64'
|
25
24
|
require 'iri'
|
26
25
|
require 'loog'
|
27
|
-
require '
|
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, '
|
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 #{
|
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
|
-
|
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 (#{
|
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 #{
|
170
|
+
assert_equal("baza.rb #{BazaRb::VERSION}", req['user-agent'])
|
171
171
|
end
|
172
172
|
|
173
173
|
def test_push_with_meta
|