http-rest_client 0.1.1 → 0.2.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/http/rest_client/dsl.rb +16 -0
- data/lib/http/rest_client/version.rb +1 -1
- metadata +9 -17
- data/.github/main.workflow +0 -14
- data/.gitignore +0 -11
- data/.rubocop.yml +0 -53
- data/.yardstick.yml +0 -30
- data/CODE_OF_CONDUCT.md +0 -74
- data/Gemfile +0 -3
- data/Gemfile.lock +0 -86
- data/Rakefile +0 -23
- data/http-rest_client.gemspec +0 -31
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 96562ed8866127b46998a7a32a822416f1421ef2130989af91a1eae7e8cd4ad5
|
4
|
+
data.tar.gz: 2939ac1fc85f80e68b74e9e6598d80727bf9e1c414ac9bc232978f4d3ce89862
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: eb18a5e9704afe27a3c0fd7c3b7ba8e5bf9fcac133724ac2468a2aa9c4e1ea277f66b65a0133478d6215621de28a3ce9a59118862da397342fc3c7a3d36cbbb3
|
7
|
+
data.tar.gz: f25f74bf72a6f80445e3dfe98464504c61cb86408e2321132a435cd2120dfa619d2ce9635c9a893a5075358d3121267b9a44f7ccf4f7f0c2160dd5d18b9fa203
|
data/lib/http/rest_client/dsl.rb
CHANGED
@@ -49,6 +49,21 @@ module HTTP
|
|
49
49
|
superclass.respond_to?(:path) ? superclass.path : nil
|
50
50
|
end
|
51
51
|
|
52
|
+
# Defines the client proxy hosts. Inheritable-safe
|
53
|
+
#
|
54
|
+
# Expects an array with host, port, username and password.
|
55
|
+
# The last two are optional.
|
56
|
+
#
|
57
|
+
# @param value [String] the endpoint URI path.
|
58
|
+
# @return [String]
|
59
|
+
def proxy(*value)
|
60
|
+
@proxy = value if value && !value.empty?
|
61
|
+
|
62
|
+
return @proxy if @proxy
|
63
|
+
|
64
|
+
superclass.respond_to?(:proxy) ? superclass.proxy : nil
|
65
|
+
end
|
66
|
+
|
52
67
|
# Sets the client expected HTTP request content type
|
53
68
|
#
|
54
69
|
# @param type [String] the full mime-type name.
|
@@ -93,6 +108,7 @@ module HTTP
|
|
93
108
|
# @return parsed response, can be a [String], a [Hash] or an [Array]
|
94
109
|
def request(verb, uri, options = {})
|
95
110
|
client = HTTP::Client.new(headers: headers)
|
111
|
+
client = client.via(*proxy) if proxy
|
96
112
|
handle_response(client.request(verb, uri, options))
|
97
113
|
end
|
98
114
|
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: http-rest_client
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Stas SUȘCOV
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-11-24 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: http
|
@@ -129,17 +129,8 @@ executables: []
|
|
129
129
|
extensions: []
|
130
130
|
extra_rdoc_files: []
|
131
131
|
files:
|
132
|
-
- ".github/main.workflow"
|
133
|
-
- ".gitignore"
|
134
|
-
- ".rubocop.yml"
|
135
|
-
- ".yardstick.yml"
|
136
|
-
- CODE_OF_CONDUCT.md
|
137
|
-
- Gemfile
|
138
|
-
- Gemfile.lock
|
139
132
|
- LICENSE.txt
|
140
133
|
- README.md
|
141
|
-
- Rakefile
|
142
|
-
- http-rest_client.gemspec
|
143
134
|
- lib/http/rest_client.rb
|
144
135
|
- lib/http/rest_client/crud.rb
|
145
136
|
- lib/http/rest_client/dsl.rb
|
@@ -148,8 +139,9 @@ files:
|
|
148
139
|
homepage: https://github.com/stas/http-rest_client
|
149
140
|
licenses:
|
150
141
|
- MIT
|
151
|
-
metadata:
|
152
|
-
|
142
|
+
metadata:
|
143
|
+
rubygems_mfa_required: 'true'
|
144
|
+
post_install_message:
|
153
145
|
rdoc_options: []
|
154
146
|
require_paths:
|
155
147
|
- lib
|
@@ -157,15 +149,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
157
149
|
requirements:
|
158
150
|
- - ">="
|
159
151
|
- !ruby/object:Gem::Version
|
160
|
-
version: '
|
152
|
+
version: '2.6'
|
161
153
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
162
154
|
requirements:
|
163
155
|
- - ">="
|
164
156
|
- !ruby/object:Gem::Version
|
165
157
|
version: '0'
|
166
158
|
requirements: []
|
167
|
-
rubygems_version: 3.
|
168
|
-
signing_key:
|
159
|
+
rubygems_version: 3.2.22
|
160
|
+
signing_key:
|
169
161
|
specification_version: 4
|
170
162
|
summary: An easy to use HTTP/REST client
|
171
163
|
test_files: []
|
data/.github/main.workflow
DELETED
data/.gitignore
DELETED
data/.rubocop.yml
DELETED
@@ -1,53 +0,0 @@
|
|
1
|
-
require:
|
2
|
-
- rubocop-performance
|
3
|
-
- rubocop-rspec
|
4
|
-
|
5
|
-
RSpec:
|
6
|
-
Enabled: true
|
7
|
-
|
8
|
-
Performance:
|
9
|
-
Enabled: true
|
10
|
-
|
11
|
-
Bundler:
|
12
|
-
Enabled: true
|
13
|
-
|
14
|
-
Gemspec:
|
15
|
-
Enabled: true
|
16
|
-
|
17
|
-
Style/StringLiterals:
|
18
|
-
Enabled: true
|
19
|
-
EnforcedStyle: single_quotes
|
20
|
-
|
21
|
-
Style/FrozenStringLiteralComment:
|
22
|
-
Enabled: false
|
23
|
-
|
24
|
-
Metrics/LineLength:
|
25
|
-
Max: 80
|
26
|
-
|
27
|
-
Metrics/BlockLength:
|
28
|
-
Exclude:
|
29
|
-
- 'spec/**/*_spec.rb'
|
30
|
-
- '**/*.gemspec'
|
31
|
-
|
32
|
-
Layout/IndentationConsistency:
|
33
|
-
EnforcedStyle: normal
|
34
|
-
|
35
|
-
Style/BlockDelimiters:
|
36
|
-
Enabled: true
|
37
|
-
|
38
|
-
RSpec/FilePath:
|
39
|
-
Exclude:
|
40
|
-
- 'spec/**/*_spec.rb'
|
41
|
-
|
42
|
-
RSpec/DescribedClass:
|
43
|
-
Exclude:
|
44
|
-
- 'spec/integration/*_spec.rb'
|
45
|
-
|
46
|
-
RSpec/ExampleLength:
|
47
|
-
Enabled: false
|
48
|
-
|
49
|
-
RSpec/MultipleExpectations:
|
50
|
-
Enabled: false
|
51
|
-
|
52
|
-
RSpec/ContextWording:
|
53
|
-
Enabled: false
|
data/.yardstick.yml
DELETED
@@ -1,30 +0,0 @@
|
|
1
|
-
---
|
2
|
-
path: ['lib/**/*.rb']
|
3
|
-
threshold: 100
|
4
|
-
rules:
|
5
|
-
ApiTag::Presence:
|
6
|
-
enabled: false
|
7
|
-
ApiTag::Inclusion:
|
8
|
-
enabled: false
|
9
|
-
ApiTag::ProtectedMethod:
|
10
|
-
enabled: false
|
11
|
-
ApiTag::PrivateMethod:
|
12
|
-
enabled: false
|
13
|
-
ExampleTag:
|
14
|
-
enabled: false
|
15
|
-
ReturnTag:
|
16
|
-
enabled: true
|
17
|
-
exclude: []
|
18
|
-
Summary::Presence:
|
19
|
-
enabled: true
|
20
|
-
exclude: []
|
21
|
-
Summary::Length:
|
22
|
-
enabled: true
|
23
|
-
exclude: []
|
24
|
-
Summary::Delimiter:
|
25
|
-
enabled: true
|
26
|
-
exclude: []
|
27
|
-
Summary::SingleLine:
|
28
|
-
enabled: true
|
29
|
-
exclude: []
|
30
|
-
|
data/CODE_OF_CONDUCT.md
DELETED
@@ -1,74 +0,0 @@
|
|
1
|
-
# Contributor Covenant Code of Conduct
|
2
|
-
|
3
|
-
## Our Pledge
|
4
|
-
|
5
|
-
In the interest of fostering an open and welcoming environment, we as
|
6
|
-
contributors and maintainers pledge to making participation in our project and
|
7
|
-
our community a harassment-free experience for everyone, regardless of age,
|
8
|
-
body size, disability, ethnicity, gender identity and expression, level of
|
9
|
-
experience, nationality, personal appearance, race, religion, or sexual
|
10
|
-
identity and orientation.
|
11
|
-
|
12
|
-
## Our Standards
|
13
|
-
|
14
|
-
Examples of behavior that contributes to creating a positive environment
|
15
|
-
include:
|
16
|
-
|
17
|
-
* Using welcoming and inclusive language
|
18
|
-
* Being respectful of differing viewpoints and experiences
|
19
|
-
* Gracefully accepting constructive criticism
|
20
|
-
* Focusing on what is best for the community
|
21
|
-
* Showing empathy towards other community members
|
22
|
-
|
23
|
-
Examples of unacceptable behavior by participants include:
|
24
|
-
|
25
|
-
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
-
advances
|
27
|
-
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
-
* Public or private harassment
|
29
|
-
* Publishing others' private information, such as a physical or electronic
|
30
|
-
address, without explicit permission
|
31
|
-
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
-
professional setting
|
33
|
-
|
34
|
-
## Our Responsibilities
|
35
|
-
|
36
|
-
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
-
behavior and are expected to take appropriate and fair corrective action in
|
38
|
-
response to any instances of unacceptable behavior.
|
39
|
-
|
40
|
-
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
-
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
-
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
-
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
-
threatening, offensive, or harmful.
|
45
|
-
|
46
|
-
## Scope
|
47
|
-
|
48
|
-
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
-
when an individual is representing the project or its community. Examples of
|
50
|
-
representing a project or community include using an official project e-mail
|
51
|
-
address, posting via an official social media account, or acting as an
|
52
|
-
appointed representative at an online or offline event. Representation of a
|
53
|
-
project may be further defined and clarified by project maintainers.
|
54
|
-
|
55
|
-
## Enforcement
|
56
|
-
|
57
|
-
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
-
reported by contacting the project team at stas@nerd.ro. All complaints will be
|
59
|
-
reviewed and investigated and will result in a response that is deemed
|
60
|
-
necessary and appropriate to the circumstances. The project team is obligated
|
61
|
-
to maintain confidentiality with regard to the reporter of an incident.
|
62
|
-
Further details of specific enforcement policies may be posted separately.
|
63
|
-
|
64
|
-
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
-
faith may face temporary or permanent repercussions as determined by other
|
66
|
-
members of the project's leadership.
|
67
|
-
|
68
|
-
## Attribution
|
69
|
-
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
-
available at [http://contributor-covenant.org/version/1/4][version]
|
72
|
-
|
73
|
-
[homepage]: http://contributor-covenant.org
|
74
|
-
[version]: http://contributor-covenant.org/version/1/4/
|
data/Gemfile
DELETED
data/Gemfile.lock
DELETED
@@ -1,86 +0,0 @@
|
|
1
|
-
PATH
|
2
|
-
remote: .
|
3
|
-
specs:
|
4
|
-
http-rest_client (0.1.0)
|
5
|
-
http
|
6
|
-
|
7
|
-
GEM
|
8
|
-
remote: https://rubygems.org/
|
9
|
-
specs:
|
10
|
-
addressable (2.6.0)
|
11
|
-
public_suffix (>= 2.0.2, < 4.0)
|
12
|
-
ast (2.4.0)
|
13
|
-
diff-lcs (1.3)
|
14
|
-
docile (1.3.2)
|
15
|
-
domain_name (0.5.20180417)
|
16
|
-
unf (>= 0.0.5, < 1.0.0)
|
17
|
-
http (4.1.1)
|
18
|
-
addressable (~> 2.3)
|
19
|
-
http-cookie (~> 1.0)
|
20
|
-
http-form_data (~> 2.0)
|
21
|
-
http_parser.rb (~> 0.6.0)
|
22
|
-
http-cookie (1.0.3)
|
23
|
-
domain_name (~> 0.5)
|
24
|
-
http-form_data (2.1.1)
|
25
|
-
http_parser.rb (0.6.0)
|
26
|
-
jaro_winkler (1.5.3)
|
27
|
-
json (2.2.0)
|
28
|
-
parallel (1.17.0)
|
29
|
-
parser (2.6.3.0)
|
30
|
-
ast (~> 2.4.0)
|
31
|
-
public_suffix (3.1.1)
|
32
|
-
rainbow (3.0.0)
|
33
|
-
rake (12.3.2)
|
34
|
-
rspec (3.8.0)
|
35
|
-
rspec-core (~> 3.8.0)
|
36
|
-
rspec-expectations (~> 3.8.0)
|
37
|
-
rspec-mocks (~> 3.8.0)
|
38
|
-
rspec-core (3.8.1)
|
39
|
-
rspec-support (~> 3.8.0)
|
40
|
-
rspec-expectations (3.8.4)
|
41
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
42
|
-
rspec-support (~> 3.8.0)
|
43
|
-
rspec-mocks (3.8.1)
|
44
|
-
diff-lcs (>= 1.2.0, < 2.0)
|
45
|
-
rspec-support (~> 3.8.0)
|
46
|
-
rspec-support (3.8.2)
|
47
|
-
rubocop (0.71.0)
|
48
|
-
jaro_winkler (~> 1.5.1)
|
49
|
-
parallel (~> 1.10)
|
50
|
-
parser (>= 2.6)
|
51
|
-
rainbow (>= 2.2.2, < 4.0)
|
52
|
-
ruby-progressbar (~> 1.7)
|
53
|
-
unicode-display_width (>= 1.4.0, < 1.7)
|
54
|
-
rubocop-performance (1.3.0)
|
55
|
-
rubocop (>= 0.68.0)
|
56
|
-
rubocop-rspec (1.33.0)
|
57
|
-
rubocop (>= 0.60.0)
|
58
|
-
ruby-progressbar (1.10.1)
|
59
|
-
simplecov (0.16.1)
|
60
|
-
docile (~> 1.1)
|
61
|
-
json (>= 1.8, < 3)
|
62
|
-
simplecov-html (~> 0.10.0)
|
63
|
-
simplecov-html (0.10.2)
|
64
|
-
unf (0.1.4)
|
65
|
-
unf_ext
|
66
|
-
unf_ext (0.0.7.6)
|
67
|
-
unicode-display_width (1.6.0)
|
68
|
-
yard (0.9.19)
|
69
|
-
yardstick (0.9.9)
|
70
|
-
yard (~> 0.8, >= 0.8.7.2)
|
71
|
-
|
72
|
-
PLATFORMS
|
73
|
-
ruby
|
74
|
-
|
75
|
-
DEPENDENCIES
|
76
|
-
bundler
|
77
|
-
http-rest_client!
|
78
|
-
rake
|
79
|
-
rspec
|
80
|
-
rubocop-performance
|
81
|
-
rubocop-rspec
|
82
|
-
simplecov
|
83
|
-
yardstick
|
84
|
-
|
85
|
-
BUNDLED WITH
|
86
|
-
1.17.2
|
data/Rakefile
DELETED
@@ -1,23 +0,0 @@
|
|
1
|
-
require 'bundler/gem_tasks'
|
2
|
-
require 'rspec/core/rake_task'
|
3
|
-
require 'rubocop/rake_task'
|
4
|
-
require 'yaml'
|
5
|
-
require 'yardstick/rake/verify'
|
6
|
-
|
7
|
-
desc('Documentation stats and measurements')
|
8
|
-
task('qa:docs') do
|
9
|
-
yaml = YAML.load_file('.yardstick.yml')
|
10
|
-
config = Yardstick::Config.coerce(yaml)
|
11
|
-
measure = Yardstick.measure(config)
|
12
|
-
measure.puts
|
13
|
-
coverage = Yardstick.round_percentage(measure.coverage * 100)
|
14
|
-
exit(1) if coverage < config.threshold
|
15
|
-
end
|
16
|
-
|
17
|
-
RuboCop::RakeTask.new('qa:code')
|
18
|
-
|
19
|
-
desc('Run QA tasks')
|
20
|
-
task(qa: ['qa:docs', 'qa:code'])
|
21
|
-
|
22
|
-
RSpec::Core::RakeTask.new(spec: :qa)
|
23
|
-
task(default: :spec)
|
data/http-rest_client.gemspec
DELETED
@@ -1,31 +0,0 @@
|
|
1
|
-
lib = File.expand_path('lib', __dir__)
|
2
|
-
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
3
|
-
require 'http/rest_client/version'
|
4
|
-
|
5
|
-
Gem::Specification.new do |spec|
|
6
|
-
spec.name = 'http-rest_client'
|
7
|
-
spec.version = HTTP::RestClient::VERSION
|
8
|
-
spec.authors = ['Stas SUȘCOV']
|
9
|
-
spec.email = ['stas@nerd.ro']
|
10
|
-
|
11
|
-
spec.summary = 'An easy to use HTTP/REST client'
|
12
|
-
spec.description = 'A HTTP/REST Client to help you wrap APIs easily.'
|
13
|
-
spec.homepage = 'https://github.com/stas/http-rest_client'
|
14
|
-
spec.license = 'MIT'
|
15
|
-
|
16
|
-
# Specify which files should be added to the gem when it is released.
|
17
|
-
spec.files = Dir.chdir(File.expand_path(__dir__)) do
|
18
|
-
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(spec)/}) }
|
19
|
-
end
|
20
|
-
spec.require_paths = ['lib']
|
21
|
-
|
22
|
-
spec.add_dependency 'http'
|
23
|
-
|
24
|
-
spec.add_development_dependency 'bundler'
|
25
|
-
spec.add_development_dependency 'rake'
|
26
|
-
spec.add_development_dependency 'rspec'
|
27
|
-
spec.add_development_dependency 'rubocop-performance'
|
28
|
-
spec.add_development_dependency 'rubocop-rspec'
|
29
|
-
spec.add_development_dependency 'simplecov'
|
30
|
-
spec.add_development_dependency 'yardstick'
|
31
|
-
end
|