nxt_http_client 0.1.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 +7 -0
- data/.gitignore +15 -0
- data/.rspec +3 -0
- data/.travis.yml +7 -0
- data/Gemfile +6 -0
- data/Gemfile.lock +78 -0
- data/LICENSE.txt +21 -0
- data/README.md +139 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/lib/nxt_http_client.rb +12 -0
- data/lib/nxt_http_client/client.rb +55 -0
- data/lib/nxt_http_client/client_dsl.rb +61 -0
- data/lib/nxt_http_client/response_handler.rb +70 -0
- data/lib/nxt_http_client/version.rb +3 -0
- data/nxt_http_client.gemspec +48 -0
- metadata +191 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: e7d812e906c38f18bfdc0af07803de8edff149491e3acc8b7604613ee84a0eb1
|
4
|
+
data.tar.gz: c4d4c5b22b6efc750799a184ec5799429c86718b4ca8ab69d1de492e376ff4f5
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 36af4b509d99547a515984a14b320d61f30484e59979ef808396a83b9657fb42eef84d79424e18226023c5072915cfc3a1c02f79fb884e87e274d216524d690a
|
7
|
+
data.tar.gz: 351da1f478b5a7efc6f26aea0cfeaf1618879eb63819853ac41db6c78320d0c6b89d6be33ae56b12eeee5f6869a09c198bd76e524b9cfacd38a7691e88f9261b
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/Gemfile
ADDED
data/Gemfile.lock
ADDED
@@ -0,0 +1,78 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
nxt_http_client (0.1.0)
|
5
|
+
activesupport (~> 5.2)
|
6
|
+
typhoeus
|
7
|
+
|
8
|
+
GEM
|
9
|
+
remote: https://rubygems.org/
|
10
|
+
specs:
|
11
|
+
activesupport (5.2.3)
|
12
|
+
concurrent-ruby (~> 1.0, >= 1.0.2)
|
13
|
+
i18n (>= 0.7, < 2)
|
14
|
+
minitest (~> 5.1)
|
15
|
+
tzinfo (~> 1.1)
|
16
|
+
addressable (2.6.0)
|
17
|
+
public_suffix (>= 2.0.2, < 4.0)
|
18
|
+
coderay (1.1.2)
|
19
|
+
concurrent-ruby (1.1.5)
|
20
|
+
crack (0.4.3)
|
21
|
+
safe_yaml (~> 1.0.0)
|
22
|
+
diff-lcs (1.3)
|
23
|
+
ethon (0.12.0)
|
24
|
+
ffi (>= 1.3.0)
|
25
|
+
ffi (1.11.1)
|
26
|
+
hashdiff (1.0.0)
|
27
|
+
i18n (1.6.0)
|
28
|
+
concurrent-ruby (~> 1.0)
|
29
|
+
method_source (0.9.2)
|
30
|
+
minitest (5.11.3)
|
31
|
+
nxt_vcr_harness (0.1.3)
|
32
|
+
rspec (~> 3.0)
|
33
|
+
vcr (~> 5.0)
|
34
|
+
pry (0.12.2)
|
35
|
+
coderay (~> 1.1.0)
|
36
|
+
method_source (~> 0.9.0)
|
37
|
+
public_suffix (3.1.1)
|
38
|
+
rake (10.5.0)
|
39
|
+
rspec (3.8.0)
|
40
|
+
rspec-core (~> 3.8.0)
|
41
|
+
rspec-expectations (~> 3.8.0)
|
42
|
+
rspec-mocks (~> 3.8.0)
|
43
|
+
rspec-core (3.8.2)
|
44
|
+
rspec-support (~> 3.8.0)
|
45
|
+
rspec-expectations (3.8.4)
|
46
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
47
|
+
rspec-support (~> 3.8.0)
|
48
|
+
rspec-mocks (3.8.1)
|
49
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
50
|
+
rspec-support (~> 3.8.0)
|
51
|
+
rspec-support (3.8.2)
|
52
|
+
safe_yaml (1.0.5)
|
53
|
+
thread_safe (0.3.6)
|
54
|
+
typhoeus (1.3.1)
|
55
|
+
ethon (>= 0.9.0)
|
56
|
+
tzinfo (1.2.5)
|
57
|
+
thread_safe (~> 0.1)
|
58
|
+
vcr (5.0.0)
|
59
|
+
webmock (3.6.0)
|
60
|
+
addressable (>= 2.3.6)
|
61
|
+
crack (>= 0.3.2)
|
62
|
+
hashdiff (>= 0.4.0, < 2.0.0)
|
63
|
+
|
64
|
+
PLATFORMS
|
65
|
+
ruby
|
66
|
+
|
67
|
+
DEPENDENCIES
|
68
|
+
bundler (~> 1.17)
|
69
|
+
nxt_http_client!
|
70
|
+
nxt_vcr_harness
|
71
|
+
pry
|
72
|
+
rake (~> 10.0)
|
73
|
+
rspec (~> 3.0)
|
74
|
+
vcr
|
75
|
+
webmock
|
76
|
+
|
77
|
+
BUNDLED WITH
|
78
|
+
1.17.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2019 Andreas Robecke
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,139 @@
|
|
1
|
+
# NxtHttpClient
|
2
|
+
|
3
|
+
Build http clients with ease. NxtHttpClient is a simple DSL on top of the typhoeus gem.
|
4
|
+
The idea is that you can configure a client on the class level and then adjust or further configure
|
5
|
+
request options on an instance level. All http interactions are handled by typhoeus. If you need to
|
6
|
+
access the original `Typhoeus::Request` in your instance, you can do that.
|
7
|
+
|
8
|
+
## Installation
|
9
|
+
|
10
|
+
Add this line to your application's Gemfile:
|
11
|
+
|
12
|
+
```ruby
|
13
|
+
gem 'nxt_http_client'
|
14
|
+
```
|
15
|
+
|
16
|
+
And then execute:
|
17
|
+
|
18
|
+
$ bundle
|
19
|
+
|
20
|
+
Or install it yourself as:
|
21
|
+
|
22
|
+
$ gem install nxt_http_client
|
23
|
+
|
24
|
+
## Usage
|
25
|
+
|
26
|
+
```ruby
|
27
|
+
class MyClient < NxtHttpClient
|
28
|
+
|
29
|
+
register_defaults do |defaults|
|
30
|
+
defaults.base_url = 'www.example.com'
|
31
|
+
defaults.request_options = {
|
32
|
+
headers: { API_KEY: '1993' },
|
33
|
+
method: :get,
|
34
|
+
followlocation: true
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
register_response_handler do |handler|
|
39
|
+
handler.on(:error) do |response|
|
40
|
+
raise StandardError, "I can't handle this: #{response.code}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
|
44
|
+
before_fire do |request|
|
45
|
+
# Will be called before fire
|
46
|
+
end
|
47
|
+
|
48
|
+
after_fire do |request, result, response|
|
49
|
+
# Will be called after fire
|
50
|
+
end
|
51
|
+
|
52
|
+
def call
|
53
|
+
fire('details', method: :get) do |handler|
|
54
|
+
handler.on(:success) do |response|
|
55
|
+
response.body
|
56
|
+
end
|
57
|
+
|
58
|
+
handler.on(404) do |response|
|
59
|
+
raise StandardError, '404'
|
60
|
+
end
|
61
|
+
|
62
|
+
# You can also fuzzy match response codes using the wildcard *
|
63
|
+
handler.on('5**') do |response|
|
64
|
+
raise StandardError, 'This is bad'
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
```
|
70
|
+
|
71
|
+
### register_defaults
|
72
|
+
|
73
|
+
Register default request options on the class level.
|
74
|
+
|
75
|
+
### register_response_handler
|
76
|
+
|
77
|
+
Register a default response handler for your client class.
|
78
|
+
You can reconfigure or overwrite it this completely later on the instance level.
|
79
|
+
|
80
|
+
### fire
|
81
|
+
|
82
|
+
Use `fire('uri', **request_options)` to actually fire your requests and define what to do with the response by using
|
83
|
+
the NxtHttpClient DSL. Registered callbacks have a hierarchy by which they are executed. Specific callbacks will come first
|
84
|
+
and more common callbacks will come later in case none of the specific callbacks matched. It this is not what you want you
|
85
|
+
can simply put the logic you need into one common callback that is called in any case. You can also use strings with wildcards
|
86
|
+
to match a group of response by status code. `handler.on('4**') { ... }` basically would match all client errors.
|
87
|
+
|
88
|
+
```ruby
|
89
|
+
fire('uri', **request_options) do |handler|
|
90
|
+
handler.on(:any) do |response|
|
91
|
+
raise StandardError, 'This would overwrite all others since it matches first'
|
92
|
+
end
|
93
|
+
|
94
|
+
handler.on(:success) do |response|
|
95
|
+
response.body
|
96
|
+
end
|
97
|
+
|
98
|
+
handler.on(:timed_out) do |response|
|
99
|
+
raise StandardError, 'Timeout'
|
100
|
+
end
|
101
|
+
|
102
|
+
handler.on(:error) do |response|
|
103
|
+
raise StandardError, 'This is bad'
|
104
|
+
end
|
105
|
+
|
106
|
+
handler.on(:others) do |response|
|
107
|
+
raise StandardError, 'Other problem'
|
108
|
+
end
|
109
|
+
|
110
|
+
handler.on(:headers) do |response|
|
111
|
+
# This is already executed when the headers are received
|
112
|
+
end
|
113
|
+
|
114
|
+
handler.on(:body) do |chunk|
|
115
|
+
# Use this to stream the body in chunks
|
116
|
+
end
|
117
|
+
end
|
118
|
+
```
|
119
|
+
|
120
|
+
### Callbacks around fire
|
121
|
+
|
122
|
+
You can also hook into the before_fire and after_fire callbacks to do something before and after the actual request is executed.
|
123
|
+
These callbacks are inherited down the class hierarchy but are not being chained. Meaning when you overwrite those in your subclass,
|
124
|
+
the callbacks defined by your parent class will not be called anymore.
|
125
|
+
|
126
|
+
|
127
|
+
## Development
|
128
|
+
|
129
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
130
|
+
|
131
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
132
|
+
|
133
|
+
## Contributing
|
134
|
+
|
135
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/nxt_http_client.
|
136
|
+
|
137
|
+
## License
|
138
|
+
|
139
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "nxt_http_client"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,12 @@
|
|
1
|
+
require 'active_support/all'
|
2
|
+
require 'typhoeus'
|
3
|
+
|
4
|
+
require 'nxt_http_client/version'
|
5
|
+
require 'nxt_http_client/response_handler'
|
6
|
+
require 'nxt_http_client/client_dsl'
|
7
|
+
require 'nxt_http_client/client'
|
8
|
+
|
9
|
+
module NxtHttpClient
|
10
|
+
class Error < StandardError; end
|
11
|
+
# Your code goes here...
|
12
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
module NxtHttpClient
|
2
|
+
class Client
|
3
|
+
extend ClientDsl
|
4
|
+
|
5
|
+
def build_request(url, **opts)
|
6
|
+
base_url = opts.delete(:base_url) || self.class.base_url
|
7
|
+
url = [base_url, url].reject(&:blank?).join('/')
|
8
|
+
opts = self.class.default_request_options.deep_merge(opts)
|
9
|
+
|
10
|
+
Typhoeus::Request.new(url, opts)
|
11
|
+
end
|
12
|
+
|
13
|
+
def fire(url = '', **opts, &block)
|
14
|
+
# calling_method = caller_locations(1,1)[0].label
|
15
|
+
response_handler = opts.fetch(:response_handler) { dup_handler_from_class }
|
16
|
+
response_handler.configure(&block) if block_given?
|
17
|
+
request = build_request(url, opts.except(:response_handler))
|
18
|
+
|
19
|
+
before_fire_callback = self.class.before_fire_callback
|
20
|
+
before_fire_callback && instance_exec(request, &before_fire_callback)
|
21
|
+
|
22
|
+
if response_handler.callbacks['headers']
|
23
|
+
request.on_headers do |response|
|
24
|
+
response_handler.eval_callback(self, 'headers', response)
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
if response_handler.callbacks['body']
|
29
|
+
request.on_body do |response|
|
30
|
+
response_handler.eval_callback(self, 'body', response)
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
result = nil
|
35
|
+
|
36
|
+
request.on_complete do |response|
|
37
|
+
callback = response_handler.callback_for_response(response)
|
38
|
+
result = callback && instance_exec(response, &callback) || response
|
39
|
+
|
40
|
+
after_fire_callback = self.class.after_fire_callback
|
41
|
+
after_fire_callback && instance_exec(request, response, result, &after_fire_callback)
|
42
|
+
|
43
|
+
result
|
44
|
+
end
|
45
|
+
|
46
|
+
request.run
|
47
|
+
|
48
|
+
result
|
49
|
+
end
|
50
|
+
|
51
|
+
def dup_handler_from_class
|
52
|
+
self.class.response_handler.dup
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,61 @@
|
|
1
|
+
module ClientDsl
|
2
|
+
|
3
|
+
def register_defaults(defaults = OpenStruct.new, &block)
|
4
|
+
@defaults = defaults
|
5
|
+
@defaults.tap { |d| block.call(d) }
|
6
|
+
@defaults
|
7
|
+
end
|
8
|
+
|
9
|
+
def before_fire(&block)
|
10
|
+
@before_fire_callback = block
|
11
|
+
end
|
12
|
+
|
13
|
+
def before_fire_callback
|
14
|
+
@before_fire_callback
|
15
|
+
end
|
16
|
+
|
17
|
+
def after_fire(&block)
|
18
|
+
@after_fire_callback = block
|
19
|
+
end
|
20
|
+
|
21
|
+
def after_fire_callback
|
22
|
+
@after_fire_callback
|
23
|
+
end
|
24
|
+
|
25
|
+
def defaults
|
26
|
+
@defaults
|
27
|
+
end
|
28
|
+
|
29
|
+
def base_url
|
30
|
+
@base_url ||= (@defaults.base_url || '')
|
31
|
+
end
|
32
|
+
|
33
|
+
def default_request_options
|
34
|
+
@default_request_options ||= (defaults.request_options || {})
|
35
|
+
end
|
36
|
+
|
37
|
+
def register_response_handler(handler = nil, &block)
|
38
|
+
@response_handler = handler
|
39
|
+
@response_handler ||= dup_handler_from_ancestor_or_new
|
40
|
+
@response_handler.configure(&block) if block_given?
|
41
|
+
@response_handler
|
42
|
+
end
|
43
|
+
|
44
|
+
def response_handler
|
45
|
+
@response_handler
|
46
|
+
end
|
47
|
+
|
48
|
+
def dup_handler_from_ancestor_or_new
|
49
|
+
handler_from_ancestor = ancestors[1].instance_variable_get(:@response_handler)
|
50
|
+
handler_from_ancestor && handler_from_ancestor.dup || NxtHttpClient::ResponseHandler.new
|
51
|
+
end
|
52
|
+
|
53
|
+
def inherited(child)
|
54
|
+
child.instance_variable_set(:@response_handler, @response_handler.dup)
|
55
|
+
child.instance_variable_set(:@default_request_options, @default_request_options.dup)
|
56
|
+
child.instance_variable_set(:@base_url, @base_url)
|
57
|
+
child.instance_variable_set(:@before_fire_callback, @before_fire_callback.dup)
|
58
|
+
child.instance_variable_set(:@after_fire_callback, @after_fire_callback.dup)
|
59
|
+
child.instance_variable_set(:@defaults, OpenStruct.new(**@defaults.to_h.deep_dup))
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
module NxtHttpClient
|
2
|
+
class ResponseHandler
|
3
|
+
CallbackAlreadyRegistered = Class.new(StandardError)
|
4
|
+
|
5
|
+
def initialize
|
6
|
+
@callbacks = {}
|
7
|
+
@result = nil
|
8
|
+
end
|
9
|
+
|
10
|
+
attr_accessor :result
|
11
|
+
attr_reader :callbacks
|
12
|
+
|
13
|
+
def eval_callback(target, key, response)
|
14
|
+
return unless callbacks[key]
|
15
|
+
target.instance_exec(response, &callbacks[key])
|
16
|
+
end
|
17
|
+
|
18
|
+
def configure(&block)
|
19
|
+
tap { |handler| block.call(handler) }
|
20
|
+
end
|
21
|
+
|
22
|
+
def register_callback(code, overwrite: false, &block)
|
23
|
+
key = code.to_s
|
24
|
+
# This would add callbacks to the response handler
|
25
|
+
unless overwrite
|
26
|
+
callbacks[key].present? && raise_callback_already_registered(code)
|
27
|
+
end
|
28
|
+
|
29
|
+
callbacks[key] = block
|
30
|
+
end
|
31
|
+
|
32
|
+
def register_callback!(code, &block)
|
33
|
+
register_callback(code, overwrite: true, &block)
|
34
|
+
end
|
35
|
+
|
36
|
+
alias_method :on, :register_callback
|
37
|
+
alias_method :on!, :register_callback!
|
38
|
+
|
39
|
+
def callback_for_response(response)
|
40
|
+
key_from_response = response.code.to_s
|
41
|
+
return callbacks['any'] if callbacks['any'].present?
|
42
|
+
|
43
|
+
first_matching_key = callbacks.keys.sort.reverse.find do |key|
|
44
|
+
regex_key = key.gsub('*', '[0-9]{1}')
|
45
|
+
key_from_response =~ /\A#{regex_key}\z/
|
46
|
+
end
|
47
|
+
|
48
|
+
first_matching_key && callbacks[first_matching_key] ||
|
49
|
+
response.success? && callbacks['success'] ||
|
50
|
+
response.timed_out? && callbacks['timed_out'] ||
|
51
|
+
!response.success? && callbacks['error'] ||
|
52
|
+
callbacks['others']
|
53
|
+
end
|
54
|
+
|
55
|
+
private
|
56
|
+
|
57
|
+
def raise_callback_already_registered(code)
|
58
|
+
msg = "Callback already registered for status: #{code}."
|
59
|
+
msg << ' Use bang method to overwrite the callback.'
|
60
|
+
raise CallbackAlreadyRegistered, msg
|
61
|
+
end
|
62
|
+
|
63
|
+
# we need to dup callbacks since dup is shallow
|
64
|
+
def initialize_copy(original)
|
65
|
+
super
|
66
|
+
@callbacks = original.send(:callbacks).dup
|
67
|
+
@result = nil
|
68
|
+
end
|
69
|
+
end
|
70
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "nxt_http_client/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "nxt_http_client"
|
8
|
+
spec.version = NxtHttpClient::VERSION
|
9
|
+
spec.authors = ["Andreas Robecke", "Nils Sommer", "Raphael Kallensee", "Luetfi Demirci"]
|
10
|
+
spec.email = ["a.robecke@getsafe.de"]
|
11
|
+
|
12
|
+
spec.summary = %q{NxtHttpClinet is a simple DSL on top the typhoeus http gem}
|
13
|
+
spec.description = %q{NxtHttpClinet allows you to easily create and configure http clients.}
|
14
|
+
spec.homepage = "https://github.com/nxt-insurance"
|
15
|
+
spec.license = "MIT"
|
16
|
+
|
17
|
+
# Prevent pushing this gem to RubyGems.org. To allow pushes either set the 'allowed_push_host'
|
18
|
+
# to allow pushing to a single host or delete this section to allow pushing to any host.
|
19
|
+
if spec.respond_to?(:metadata)
|
20
|
+
spec.metadata["allowed_push_host"] = 'https://rubygems.org'
|
21
|
+
|
22
|
+
spec.metadata["homepage_uri"] = spec.homepage
|
23
|
+
spec.metadata["source_code_uri"] = "https://github.com/nxt-insurance/nxt_http_client"
|
24
|
+
else
|
25
|
+
raise "RubyGems 2.0 or newer is required to protect against " \
|
26
|
+
"public gem pushes."
|
27
|
+
end
|
28
|
+
|
29
|
+
# Specify which files should be added to the gem when it is released.
|
30
|
+
# The `git ls-files -z` loads the files in the RubyGem that have been added into git.
|
31
|
+
spec.files = Dir.chdir(File.expand_path('..', __FILE__)) do
|
32
|
+
`git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features)/}) }
|
33
|
+
end
|
34
|
+
spec.bindir = 'exe'
|
35
|
+
spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
36
|
+
spec.require_paths = ['lib']
|
37
|
+
|
38
|
+
spec.add_dependency 'typhoeus'
|
39
|
+
spec.add_dependency 'activesupport', '~> 5.2'
|
40
|
+
|
41
|
+
spec.add_development_dependency 'bundler', '~> 1.17'
|
42
|
+
spec.add_development_dependency 'rake', '~> 10.0'
|
43
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
44
|
+
spec.add_development_dependency 'pry'
|
45
|
+
spec.add_development_dependency 'vcr'
|
46
|
+
spec.add_development_dependency 'webmock'
|
47
|
+
spec.add_development_dependency 'nxt_vcr_harness'
|
48
|
+
end
|
metadata
ADDED
@@ -0,0 +1,191 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: nxt_http_client
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Andreas Robecke
|
8
|
+
- Nils Sommer
|
9
|
+
- Raphael Kallensee
|
10
|
+
- Luetfi Demirci
|
11
|
+
autorequire:
|
12
|
+
bindir: exe
|
13
|
+
cert_chain: []
|
14
|
+
date: 2019-07-18 00:00:00.000000000 Z
|
15
|
+
dependencies:
|
16
|
+
- !ruby/object:Gem::Dependency
|
17
|
+
name: typhoeus
|
18
|
+
requirement: !ruby/object:Gem::Requirement
|
19
|
+
requirements:
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - ">="
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: '0'
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: activesupport
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
requirements:
|
34
|
+
- - "~>"
|
35
|
+
- !ruby/object:Gem::Version
|
36
|
+
version: '5.2'
|
37
|
+
type: :runtime
|
38
|
+
prerelease: false
|
39
|
+
version_requirements: !ruby/object:Gem::Requirement
|
40
|
+
requirements:
|
41
|
+
- - "~>"
|
42
|
+
- !ruby/object:Gem::Version
|
43
|
+
version: '5.2'
|
44
|
+
- !ruby/object:Gem::Dependency
|
45
|
+
name: bundler
|
46
|
+
requirement: !ruby/object:Gem::Requirement
|
47
|
+
requirements:
|
48
|
+
- - "~>"
|
49
|
+
- !ruby/object:Gem::Version
|
50
|
+
version: '1.17'
|
51
|
+
type: :development
|
52
|
+
prerelease: false
|
53
|
+
version_requirements: !ruby/object:Gem::Requirement
|
54
|
+
requirements:
|
55
|
+
- - "~>"
|
56
|
+
- !ruby/object:Gem::Version
|
57
|
+
version: '1.17'
|
58
|
+
- !ruby/object:Gem::Dependency
|
59
|
+
name: rake
|
60
|
+
requirement: !ruby/object:Gem::Requirement
|
61
|
+
requirements:
|
62
|
+
- - "~>"
|
63
|
+
- !ruby/object:Gem::Version
|
64
|
+
version: '10.0'
|
65
|
+
type: :development
|
66
|
+
prerelease: false
|
67
|
+
version_requirements: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - "~>"
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '10.0'
|
72
|
+
- !ruby/object:Gem::Dependency
|
73
|
+
name: rspec
|
74
|
+
requirement: !ruby/object:Gem::Requirement
|
75
|
+
requirements:
|
76
|
+
- - "~>"
|
77
|
+
- !ruby/object:Gem::Version
|
78
|
+
version: '3.0'
|
79
|
+
type: :development
|
80
|
+
prerelease: false
|
81
|
+
version_requirements: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - "~>"
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '3.0'
|
86
|
+
- !ruby/object:Gem::Dependency
|
87
|
+
name: pry
|
88
|
+
requirement: !ruby/object:Gem::Requirement
|
89
|
+
requirements:
|
90
|
+
- - ">="
|
91
|
+
- !ruby/object:Gem::Version
|
92
|
+
version: '0'
|
93
|
+
type: :development
|
94
|
+
prerelease: false
|
95
|
+
version_requirements: !ruby/object:Gem::Requirement
|
96
|
+
requirements:
|
97
|
+
- - ">="
|
98
|
+
- !ruby/object:Gem::Version
|
99
|
+
version: '0'
|
100
|
+
- !ruby/object:Gem::Dependency
|
101
|
+
name: vcr
|
102
|
+
requirement: !ruby/object:Gem::Requirement
|
103
|
+
requirements:
|
104
|
+
- - ">="
|
105
|
+
- !ruby/object:Gem::Version
|
106
|
+
version: '0'
|
107
|
+
type: :development
|
108
|
+
prerelease: false
|
109
|
+
version_requirements: !ruby/object:Gem::Requirement
|
110
|
+
requirements:
|
111
|
+
- - ">="
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '0'
|
114
|
+
- !ruby/object:Gem::Dependency
|
115
|
+
name: webmock
|
116
|
+
requirement: !ruby/object:Gem::Requirement
|
117
|
+
requirements:
|
118
|
+
- - ">="
|
119
|
+
- !ruby/object:Gem::Version
|
120
|
+
version: '0'
|
121
|
+
type: :development
|
122
|
+
prerelease: false
|
123
|
+
version_requirements: !ruby/object:Gem::Requirement
|
124
|
+
requirements:
|
125
|
+
- - ">="
|
126
|
+
- !ruby/object:Gem::Version
|
127
|
+
version: '0'
|
128
|
+
- !ruby/object:Gem::Dependency
|
129
|
+
name: nxt_vcr_harness
|
130
|
+
requirement: !ruby/object:Gem::Requirement
|
131
|
+
requirements:
|
132
|
+
- - ">="
|
133
|
+
- !ruby/object:Gem::Version
|
134
|
+
version: '0'
|
135
|
+
type: :development
|
136
|
+
prerelease: false
|
137
|
+
version_requirements: !ruby/object:Gem::Requirement
|
138
|
+
requirements:
|
139
|
+
- - ">="
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
142
|
+
description: NxtHttpClinet allows you to easily create and configure http clients.
|
143
|
+
email:
|
144
|
+
- a.robecke@getsafe.de
|
145
|
+
executables: []
|
146
|
+
extensions: []
|
147
|
+
extra_rdoc_files: []
|
148
|
+
files:
|
149
|
+
- ".gitignore"
|
150
|
+
- ".rspec"
|
151
|
+
- ".travis.yml"
|
152
|
+
- Gemfile
|
153
|
+
- Gemfile.lock
|
154
|
+
- LICENSE.txt
|
155
|
+
- README.md
|
156
|
+
- Rakefile
|
157
|
+
- bin/console
|
158
|
+
- bin/setup
|
159
|
+
- lib/nxt_http_client.rb
|
160
|
+
- lib/nxt_http_client/client.rb
|
161
|
+
- lib/nxt_http_client/client_dsl.rb
|
162
|
+
- lib/nxt_http_client/response_handler.rb
|
163
|
+
- lib/nxt_http_client/version.rb
|
164
|
+
- nxt_http_client.gemspec
|
165
|
+
homepage: https://github.com/nxt-insurance
|
166
|
+
licenses:
|
167
|
+
- MIT
|
168
|
+
metadata:
|
169
|
+
allowed_push_host: https://rubygems.org
|
170
|
+
homepage_uri: https://github.com/nxt-insurance
|
171
|
+
source_code_uri: https://github.com/nxt-insurance/nxt_http_client
|
172
|
+
post_install_message:
|
173
|
+
rdoc_options: []
|
174
|
+
require_paths:
|
175
|
+
- lib
|
176
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: '0'
|
181
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
182
|
+
requirements:
|
183
|
+
- - ">="
|
184
|
+
- !ruby/object:Gem::Version
|
185
|
+
version: '0'
|
186
|
+
requirements: []
|
187
|
+
rubygems_version: 3.0.1
|
188
|
+
signing_key:
|
189
|
+
specification_version: 4
|
190
|
+
summary: NxtHttpClinet is a simple DSL on top the typhoeus http gem
|
191
|
+
test_files: []
|