tp_client 0.2.2 → 0.2.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.travis.yml +1 -1
- data/Appraisals +3 -3
- data/Rakefile +3 -3
- data/gemfiles/activesupport_4.gemfile +9 -9
- data/gemfiles/activesupport_4.gemfile.lock +1 -1
- data/gemfiles/activesupport_5.gemfile +9 -9
- data/gemfiles/activesupport_5.gemfile.lock +1 -1
- data/gemfiles/activesupport_6.gemfile +9 -9
- data/gemfiles/activesupport_6.gemfile.lock +1 -1
- data/lib/tiny_client/response.rb +30 -6
- data/tp_client.gemspec +22 -22
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1d299ffb9c92c622e0e0a530a0d2f541b422ab4e12983014a69b3e6602a0b60f
|
4
|
+
data.tar.gz: c6c0bd4bae393698a2153b2302706ae179f016d07d5339918cb131263ca51fe9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 902c91b99fc1ae7742a0b0060ea29eafb50b891c651377d727e293f4b37455118050539173b201754dcde4ce257851d6afc56afbc1fd57aac4402368d76e62b7
|
7
|
+
data.tar.gz: 9ec131e57e4cd270c7bcfc0ebefd71a7d47f2b33166d066910978ce92cc14929939347f6c4431e27c5592f64f0c4b2632c46a0a1eeff56d8a22ab958cbccf0a0
|
data/.travis.yml
CHANGED
@@ -9,7 +9,7 @@ gemfile:
|
|
9
9
|
deploy:
|
10
10
|
provider: rubygems
|
11
11
|
api_key:
|
12
|
-
secure:
|
12
|
+
secure: vyxUUOg1A7K1iqfjXa/P9URnbh+ntKvgfAYDAxr4My9isOsnlYXtRdDl2RgLttmmtOv5unPDrTv8Mkh5B1WMA6ihKaBUXCaU4cgyh6vLds2fSy1yxUSR/TmfnoXmRVAtBHYiuKuHol5koIW+gSDNHYenzO2mvrOks06Jtkmp0X2OJgVCS1PqWjTrDvlpfRKf2bUnE2/5/XvwnUqKCLRls1CSpV+phW6m9qsAkqMv0TMa8Em3pOUjY8mCAgFArr3cl5MtyX3Nhh95CzcGHeMUfLu8Lz0NcHscG8xNq58NnFFU6m8nQJYyxZOjFtUrJumyvy5qwZZtprwc8XxE6BmY1IJWfKCnDJbEl/qxaX0psfVG2Eiu6e/Y/Lad1NUV9hYZCXkEVEsksZa7n3sd2XOzbJmqPgM0z53Ly3koj1uMZrJ5BJ4AfZIE4gbFm5+UmSez/K9xnCWUc5NXR9+v1kyJYLsjHevn0DMxb+7xvSR5zxyS9du+GUIbIGRIKBERYGS08u+/zaPTLmGSyMpK+x5ichJoSLaJsECGGUbY2kL9aO18w41oZbvQf+Cp/656oRZM8U4DV2HtRCp6Dqc3Y8MJG1Pzft6+mHYPepon21fi08B6GOAFMF/Rcuz/SpnP9dvSCJyEcgNahDDNvRQmOwT00M8tSDeQeuR3uTXfMScBkAA=
|
13
13
|
gem: tp_client
|
14
14
|
on:
|
15
15
|
tags: true
|
data/Appraisals
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
appraise
|
1
|
+
appraise 'activesupport-4' do
|
2
2
|
gem 'activesupport', '~> 4.0'
|
3
3
|
end
|
4
4
|
|
5
|
-
appraise
|
5
|
+
appraise 'activesupport-5' do
|
6
6
|
gem 'activesupport', '~> 5.0'
|
7
7
|
end
|
8
8
|
|
9
|
-
appraise
|
9
|
+
appraise 'activesupport-6' do
|
10
10
|
gem 'activesupport', '~> 6.0'
|
11
11
|
end
|
data/Rakefile
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
require
|
1
|
+
require 'bundler/gem_tasks'
|
2
2
|
require 'rake/testtask'
|
3
3
|
require 'yard'
|
4
4
|
|
@@ -16,11 +16,11 @@ end
|
|
16
16
|
|
17
17
|
desc 'Build the gem'
|
18
18
|
task gem: [:test] do
|
19
|
-
sh 'gem build
|
19
|
+
sh 'gem build tp_client.gemspec'
|
20
20
|
end
|
21
21
|
|
22
22
|
desc 'Clean up'
|
23
23
|
task :clean do
|
24
24
|
sh 'rm -rf docs'
|
25
|
-
sh 'rm -f
|
25
|
+
sh 'rm -f tp_client*.gem'
|
26
26
|
end
|
@@ -1,16 +1,16 @@
|
|
1
1
|
# This file was generated by Appraisal
|
2
2
|
|
3
|
-
source
|
3
|
+
source 'https://rubygems.org'
|
4
4
|
|
5
|
-
gem
|
5
|
+
gem 'activesupport', '~> 4.0'
|
6
6
|
|
7
7
|
group :test, :development do
|
8
|
-
gem
|
9
|
-
gem
|
10
|
-
gem
|
11
|
-
gem
|
12
|
-
gem
|
13
|
-
gem
|
8
|
+
gem 'byebug'
|
9
|
+
gem 'minitest'
|
10
|
+
gem 'mocha'
|
11
|
+
gem 'rake'
|
12
|
+
gem 'webmock'
|
13
|
+
gem 'yard'
|
14
14
|
end
|
15
15
|
|
16
|
-
gemspec path:
|
16
|
+
gemspec path: '../'
|
@@ -1,16 +1,16 @@
|
|
1
1
|
# This file was generated by Appraisal
|
2
2
|
|
3
|
-
source
|
3
|
+
source 'https://rubygems.org'
|
4
4
|
|
5
|
-
gem
|
5
|
+
gem 'activesupport', '~> 5.0'
|
6
6
|
|
7
7
|
group :test, :development do
|
8
|
-
gem
|
9
|
-
gem
|
10
|
-
gem
|
11
|
-
gem
|
12
|
-
gem
|
13
|
-
gem
|
8
|
+
gem 'byebug'
|
9
|
+
gem 'minitest'
|
10
|
+
gem 'mocha'
|
11
|
+
gem 'rake'
|
12
|
+
gem 'webmock'
|
13
|
+
gem 'yard'
|
14
14
|
end
|
15
15
|
|
16
|
-
gemspec path:
|
16
|
+
gemspec path: '../'
|
@@ -1,16 +1,16 @@
|
|
1
1
|
# This file was generated by Appraisal
|
2
2
|
|
3
|
-
source
|
3
|
+
source 'https://rubygems.org'
|
4
4
|
|
5
|
-
gem
|
5
|
+
gem 'activesupport', '~> 6.0'
|
6
6
|
|
7
7
|
group :test, :development do
|
8
|
-
gem
|
9
|
-
gem
|
10
|
-
gem
|
11
|
-
gem
|
12
|
-
gem
|
13
|
-
gem
|
8
|
+
gem 'byebug'
|
9
|
+
gem 'minitest'
|
10
|
+
gem 'mocha'
|
11
|
+
gem 'rake'
|
12
|
+
gem 'webmock'
|
13
|
+
gem 'yard'
|
14
14
|
end
|
15
15
|
|
16
|
-
gemspec path:
|
16
|
+
gemspec path: '../'
|
data/lib/tiny_client/response.rb
CHANGED
@@ -43,29 +43,53 @@ module TinyClient
|
|
43
43
|
@code >= 400
|
44
44
|
end
|
45
45
|
|
46
|
+
# @return true if the HTTP status code of this response is 404
|
47
|
+
def not_found_error?
|
48
|
+
@code == 404
|
49
|
+
end
|
50
|
+
|
51
|
+
# @return true if the HTTP status code of this response correspond to an client error.
|
46
52
|
def client_error?
|
47
53
|
(400..499).cover?(@code)
|
48
54
|
end
|
49
55
|
|
56
|
+
# @return true if the HTTP status code of this response correspond to a server error.
|
50
57
|
def server_error?
|
51
58
|
@code >= 500
|
52
59
|
end
|
53
60
|
|
61
|
+
# @return true if the HTTP status code of this response correspond to a redirect.
|
54
62
|
def redirect?
|
55
63
|
(300..399).cover?(@code)
|
56
64
|
end
|
57
65
|
|
58
|
-
|
66
|
+
# @return Hash with url, status, body and headers fields
|
67
|
+
def to_hash
|
59
68
|
{
|
60
|
-
url
|
61
|
-
status
|
62
|
-
body
|
63
|
-
headers
|
64
|
-
}
|
69
|
+
'url' => url,
|
70
|
+
'status' => status,
|
71
|
+
'body' => (parse_body rescue body_str),
|
72
|
+
'headers' => (parse_headers rescue header_str)
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
76
|
+
# @return String of #to_hash
|
77
|
+
def to_s
|
78
|
+
to_hash.to_s
|
65
79
|
end
|
66
80
|
|
67
81
|
protected
|
68
82
|
|
83
|
+
def parse_headers
|
84
|
+
{}.tap do |headers|
|
85
|
+
header_str.to_s.each_line do |header|
|
86
|
+
next if header.index(':').nil?
|
87
|
+
key, value = header.split(':', 2)
|
88
|
+
headers[key] = value.to_s.strip
|
89
|
+
end
|
90
|
+
end
|
91
|
+
end
|
92
|
+
|
69
93
|
def gzip_decompress
|
70
94
|
ActiveSupport::Gzip.decompress(body_str)
|
71
95
|
end
|
data/tp_client.gemspec
CHANGED
@@ -1,37 +1,37 @@
|
|
1
1
|
Gem::Specification.new do |s|
|
2
|
-
s.
|
3
|
-
s.
|
4
|
-
s.version
|
2
|
+
s.platform = Gem::Platform::RUBY
|
3
|
+
s.name = 'tp_client'
|
4
|
+
s.version = '0.2.3'
|
5
|
+
s.authors = ['TINYpulse Devops']
|
6
|
+
s.email = 'devops@tinypulse.com'
|
5
7
|
|
6
|
-
s.
|
7
|
-
s.description = 'TINYclient is an HTTP/JSON crud toolkit inspired by ActiveRecord and based on Curb.'
|
8
|
-
s.email = 'devops@tinypulse.com'
|
8
|
+
s.license = 'MIT'
|
9
9
|
|
10
|
-
s.
|
10
|
+
s.summary = 'TINYclient, an HTTP/JSON crud client toolkit.'
|
11
|
+
s.description = 'TINYclient is an HTTP/JSON crud toolkit inspired by ActiveRecord and based on Curb.'
|
12
|
+
s.homepage = 'https://github.com/TINYhr/tiny_client'
|
11
13
|
|
12
14
|
if s.respond_to?(:metadata)
|
13
|
-
s.metadata[
|
15
|
+
s.metadata['allowed_push_host'] = 'https://rubygems.org'
|
16
|
+
s.metadata['homepage_uri'] = s.homepage
|
14
17
|
else
|
15
|
-
raise
|
16
|
-
"public gem pushes."
|
18
|
+
raise 'RubyGems 2.0 or newer is required to protect against public gem pushes.'
|
17
19
|
end
|
18
20
|
|
19
21
|
#### Load-time details
|
20
|
-
s.
|
22
|
+
s.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
23
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
24
|
+
end
|
25
|
+
s.require_paths = %w[lib ext]
|
21
26
|
s.rubyforge_project = 'tiny_client'
|
22
|
-
s.test_files
|
27
|
+
s.test_files = ['test/tiny_client/']
|
23
28
|
|
24
|
-
#### Documentation
|
25
|
-
s.
|
26
|
-
s.homepage = 'https://github.com/TINYhr/tiny_client'
|
27
|
-
s.rdoc_options = ['--main', 'README.md']
|
29
|
+
#### Documentation
|
30
|
+
s.rdoc_options = ['--main', 'README.md']
|
28
31
|
s.extra_rdoc_files = ['LICENSE', 'README.md']
|
29
32
|
|
30
|
-
s.
|
31
|
-
s.
|
32
|
-
|
33
|
-
s.add_runtime_dependency 'curb', '> 0.7.0', '< 1.0.0'
|
34
|
-
s.add_runtime_dependency 'activesupport', '>= 4.0', '< 7.0'
|
33
|
+
s.add_runtime_dependency 'curb', '> 0.7.0', '< 1.0.0'
|
34
|
+
s.add_runtime_dependency 'activesupport', '>= 4.0', '< 7.0'
|
35
35
|
|
36
|
-
s.add_development_dependency
|
36
|
+
s.add_development_dependency 'appraisal', '~> 2.2', '>= 2.2.0'
|
37
37
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: tp_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- TINYpulse Devops
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-03-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: curb
|
@@ -113,6 +113,7 @@ licenses:
|
|
113
113
|
- MIT
|
114
114
|
metadata:
|
115
115
|
allowed_push_host: https://rubygems.org
|
116
|
+
homepage_uri: https://github.com/TINYhr/tiny_client
|
116
117
|
post_install_message:
|
117
118
|
rdoc_options:
|
118
119
|
- "--main"
|