katinguele 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/MIT-LICENSE +20 -0
- data/README.md +41 -0
- data/lib/generators/katinguele/install_generator.rb +32 -0
- data/lib/katinguele/client/builder.rb +56 -0
- data/lib/katinguele/client/requester.rb +69 -0
- data/lib/katinguele/client.rb +13 -0
- data/lib/katinguele/configuration.rb +27 -0
- data/lib/katinguele/errors/error.rb +6 -0
- data/lib/katinguele/errors/request_error.rb +32 -0
- data/lib/katinguele/errors/required_field_error.rb +19 -0
- data/lib/katinguele/errors/timeout_error.rb +16 -0
- data/lib/katinguele/errors.rb +6 -0
- data/lib/katinguele/logger.rb +33 -0
- data/lib/katinguele/request.rb +85 -0
- data/lib/katinguele/request_error_factory.rb +31 -0
- data/lib/katinguele/response.rb +52 -0
- data/lib/katinguele/version.rb +5 -0
- data/lib/katinguele.rb +22 -0
- metadata +229 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 3a7b498b556a8424590d12b89c02c985ac20036b58fcc0d8ddc47e7fd1f92695
|
4
|
+
data.tar.gz: e948c99ede332cb2b4a87869a3b0206ff660b3038d3d7c1d3d250dadf1c91f08
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 063c0c04b98717d45b2dd7ac324942f215458638a99da5fc5e17b85869da8c51cc6ffc642635d8b8b4399f81f0908cf6d2367a5b53e91d69f7153875c850e872
|
7
|
+
data.tar.gz: '0686ee7f583eaba9f5f5cb4a848cf13faabaeb113a585b0edb542e584606d0caad750d8ba35b1b6ac8ee170be01f58883daa46d3cf0592bb674fae1c16973df7'
|
data/MIT-LICENSE
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
Copyright 2019 Linqueta
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
4
|
+
a copy of this software and associated documentation files (the
|
5
|
+
"Software"), to deal in the Software without restriction, including
|
6
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
7
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
8
|
+
permit persons to whom the Software is furnished to do so, subject to
|
9
|
+
the following conditions:
|
10
|
+
|
11
|
+
The above copyright notice and this permission notice shall be
|
12
|
+
included in all copies or substantial portions of the Software.
|
13
|
+
|
14
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
15
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
16
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
17
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
18
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
19
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
20
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,41 @@
|
|
1
|
+
# [Katinguele][gem_page]
|
2
|
+
|
3
|
+
[![Gem Version][gem_version_image]][gem_version_page]
|
4
|
+
[![Build Status][travis_status_image]][travis_page]
|
5
|
+
[![Maintainability][code_climate_maintainability_image]][code_climate_maintainability_page]
|
6
|
+
[![Test Coverage][code_climate_test_coverage_image]][code_climate_test_coverage_page]
|
7
|
+
|
8
|
+
The easiest HTTP client for Ruby
|
9
|
+
|
10
|
+
## Installation
|
11
|
+
|
12
|
+
Add this line to your application's Gemfile:
|
13
|
+
|
14
|
+
```ruby
|
15
|
+
gem 'katinguele'
|
16
|
+
```
|
17
|
+
|
18
|
+
## Contributing
|
19
|
+
|
20
|
+
1. Fork it
|
21
|
+
2. Create your feature branch (git checkout -b my-new-feature)
|
22
|
+
3. Commit your changes (git commit -am 'Add some feature')
|
23
|
+
4. Push to the branch (git push origin my-new-feature)
|
24
|
+
5. Create new Pull Request
|
25
|
+
|
26
|
+
## License
|
27
|
+
|
28
|
+
The gem is available as open source under the terms of the [MIT License][mit_license_page].
|
29
|
+
|
30
|
+
[gem_page]: https://github.com/linqueta/katinguele
|
31
|
+
[code_of_conduct_page]: https://github.com/linqueta/katinguele/blob/master/CODE_OF_CONDUCT.md
|
32
|
+
[mit_license_page]: https://opensource.org/licenses/MIT
|
33
|
+
[contributor_convenant_page]: http://contributor-covenant.org
|
34
|
+
[travis_status_image]: https://travis-ci.org/linqueta/katinguele.svg?branch=master
|
35
|
+
[travis_page]: https://travis-ci.org/linqueta/katinguele
|
36
|
+
[code_climate_maintainability_image]: https://api.codeclimate.com/v1/badges/2b9a2174ac460c3f44ad/maintainability
|
37
|
+
[code_climate_maintainability_page]: https://codeclimate.com/github/linqueta/katinguele/maintainability
|
38
|
+
[code_climate_test_coverage_image]: https://api.codeclimate.com/v1/badges/2b9a2174ac460c3f44ad/test_coverage
|
39
|
+
[code_climate_test_coverage_page]: https://codeclimate.com/github/linqueta/katinguele/test_coverage
|
40
|
+
[gem_version_image]: https://badge.fury.io/rb/katinguele.svg
|
41
|
+
[gem_version_page]: https://rubygems.org/gems/katinguele
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'rails/generators/base'
|
4
|
+
|
5
|
+
module Katinguele
|
6
|
+
class InstallGenerator < Rails::Generators::Base
|
7
|
+
def create_initializer_file
|
8
|
+
create_file(
|
9
|
+
'config/initializers/katinguele.rb',
|
10
|
+
<<~KATINGUELE_INITIALIZER_TEXT
|
11
|
+
# frozen_string_literal: true
|
12
|
+
|
13
|
+
Katinguele.configure do |config|
|
14
|
+
# You can add your service's configuration, like:
|
15
|
+
|
16
|
+
# config.add_service :external_service_1,
|
17
|
+
# raise_error: true,
|
18
|
+
# url: ENV['EXTERNAL_SERVICE_URL_1'],
|
19
|
+
# headers: { 'Content-Type' => 'application/json' }
|
20
|
+
|
21
|
+
# config.add_service :external_service_2,
|
22
|
+
# raise_error: false,
|
23
|
+
# url: ENV['EXTERNAL_SERVICE_URL_2'],
|
24
|
+
# headers: { 'Token' => "#Token {ENV['EXTERNAL_SERVICE_TOKEN']}"}
|
25
|
+
|
26
|
+
# All available options is on README
|
27
|
+
end
|
28
|
+
KATINGUELE_INITIALIZER_TEXT
|
29
|
+
)
|
30
|
+
end
|
31
|
+
end
|
32
|
+
end
|
@@ -0,0 +1,56 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Katinguele
|
4
|
+
module Client
|
5
|
+
class UnknwonService < StandardError; end
|
6
|
+
|
7
|
+
module Builder
|
8
|
+
def self.extended(base)
|
9
|
+
base.send(:build_katinguele_options)
|
10
|
+
base.katinguele_options
|
11
|
+
end
|
12
|
+
|
13
|
+
def katinguele_request_options(options)
|
14
|
+
build_katinguele_request_options(options)
|
15
|
+
end
|
16
|
+
|
17
|
+
def katinguele_service(name)
|
18
|
+
build_katinguele_service(name)
|
19
|
+
end
|
20
|
+
|
21
|
+
private
|
22
|
+
|
23
|
+
def build_katinguele_options
|
24
|
+
define_singleton_method(:katinguele_options) { @katinguele_options ||= {} }
|
25
|
+
end
|
26
|
+
|
27
|
+
def build_katinguele_request_options(options = {})
|
28
|
+
katinguele_options[:request_options] ||= options
|
29
|
+
build_katinguele_request
|
30
|
+
end
|
31
|
+
|
32
|
+
def build_katinguele_service(name = nil)
|
33
|
+
katinguele_options[:service_name] ||= name
|
34
|
+
build_katinguele_request
|
35
|
+
end
|
36
|
+
|
37
|
+
def build_katinguele_request
|
38
|
+
Katinguele.configuration
|
39
|
+
.find_service(katinguele_options[:service_name])
|
40
|
+
.then { |service| handle_unknown_service!(service) }
|
41
|
+
.then { |service| create_request(service) }
|
42
|
+
.then { |request| katinguele_options[:request] = request }
|
43
|
+
end
|
44
|
+
|
45
|
+
def handle_unknown_service!(service)
|
46
|
+
raise UnknwonService if !service && katinguele_options[:service_name]
|
47
|
+
|
48
|
+
service
|
49
|
+
end
|
50
|
+
|
51
|
+
def create_request(service)
|
52
|
+
Katinguele.configuration.request_by(service, katinguele_options[:request_options])
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
@@ -0,0 +1,69 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'faraday'
|
4
|
+
require 'json'
|
5
|
+
|
6
|
+
module Katinguele
|
7
|
+
module Client
|
8
|
+
module Requester
|
9
|
+
METHODS = %i[get post patch put delete].freeze
|
10
|
+
|
11
|
+
def self.extended(base)
|
12
|
+
METHODS.each do |method|
|
13
|
+
base.send(
|
14
|
+
:define_singleton_method,
|
15
|
+
method,
|
16
|
+
->(options = {}) { katinguele_client_request(options, method) }
|
17
|
+
)
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
def katinguele_client_request(options, method)
|
22
|
+
request = build_final_request(options, method)
|
23
|
+
|
24
|
+
build_faraday_client(request)
|
25
|
+
.then { |client| build_faraday_request(request, client, method) }
|
26
|
+
.then { |response| Katinguele::Response.new(response) }
|
27
|
+
.tap { |response| response.log if request.logger }
|
28
|
+
.tap { |response| request.after!(request, response, nil) }
|
29
|
+
rescue Faraday::Error => e
|
30
|
+
response = Katinguele::Response.new(e)
|
31
|
+
error = Katinguele::RequestErrorFactory.build(response)
|
32
|
+
error.log if request.logger
|
33
|
+
return response if rescue_faraday_error?(request, response, error)
|
34
|
+
|
35
|
+
raise error
|
36
|
+
end
|
37
|
+
|
38
|
+
def build_final_request(options, method)
|
39
|
+
Katinguele.configuration
|
40
|
+
.request_by(katinguele_options[:request], options)
|
41
|
+
.tap do |request|
|
42
|
+
request.before!(request)
|
43
|
+
request.method = method
|
44
|
+
request.log if request.logger
|
45
|
+
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def rescue_faraday_error?(req, res, err)
|
49
|
+
req.after!(req, res, err) || (err.is_a?(Katinguele::TimeoutError) && !req.raise_error)
|
50
|
+
end
|
51
|
+
|
52
|
+
def build_faraday_request(req, client, method)
|
53
|
+
client.send(method) do |faraday_req|
|
54
|
+
faraday_req.body = req.payload.to_json if req.payload
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def build_faraday_client(request)
|
59
|
+
Faraday.new(request.uri) do |config|
|
60
|
+
config.use(Faraday::Response::RaiseError) if request.raise_error
|
61
|
+
config.headers = request.headers if request.headers
|
62
|
+
config.options[:open_timeout] = request.open_timeout if request.open_timeout
|
63
|
+
config.options[:timeout] = request.timeout if request.timeout
|
64
|
+
config.adapter(Faraday.default_adapter)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
69
|
+
end
|
@@ -0,0 +1,27 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Katinguele
|
4
|
+
class Configuration
|
5
|
+
attr_reader :services
|
6
|
+
|
7
|
+
def initialize
|
8
|
+
@services = {}
|
9
|
+
end
|
10
|
+
|
11
|
+
def add_service(name, options)
|
12
|
+
return unless name && options
|
13
|
+
|
14
|
+
@services[name] = Request.new(options)
|
15
|
+
end
|
16
|
+
|
17
|
+
def find_service(name)
|
18
|
+
@services[name]
|
19
|
+
end
|
20
|
+
|
21
|
+
def request_by(request, options)
|
22
|
+
return request.tap { request.setup!(options) } if request
|
23
|
+
|
24
|
+
Request.new(options) if options&.any?
|
25
|
+
end
|
26
|
+
end
|
27
|
+
end
|
@@ -0,0 +1,32 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Katinguele
|
4
|
+
class RequestError < Error
|
5
|
+
attr_reader :response
|
6
|
+
|
7
|
+
def initialize(response)
|
8
|
+
@response = response
|
9
|
+
super(build_message)
|
10
|
+
end
|
11
|
+
|
12
|
+
def log
|
13
|
+
Katinguele::Logger.error(self)
|
14
|
+
end
|
15
|
+
|
16
|
+
private
|
17
|
+
|
18
|
+
def build_message
|
19
|
+
"CODE: #{@response.code} - BODY: #{@response.body.to_json}"
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class BadRequestError < RequestError; end
|
24
|
+
class UnauthorizedError < RequestError; end
|
25
|
+
class ForbiddenError < RequestError; end
|
26
|
+
class ResourceNotFoundError < RequestError; end
|
27
|
+
class UnprocessableEntityError < RequestError; end
|
28
|
+
class ClientError < RequestError; end
|
29
|
+
class InternalServerError < RequestError; end
|
30
|
+
class ServiceUnavailableError < RequestError; end
|
31
|
+
class ServerError < RequestError; end
|
32
|
+
end
|
@@ -0,0 +1,19 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Katinguele
|
4
|
+
class RequiredFieldError < StandardError
|
5
|
+
attr_reader :origin, :field
|
6
|
+
|
7
|
+
def initialize(origin, field)
|
8
|
+
@origin = origin
|
9
|
+
@field = field
|
10
|
+
super(build_message)
|
11
|
+
end
|
12
|
+
|
13
|
+
private
|
14
|
+
|
15
|
+
def build_message
|
16
|
+
"The field #{@field} is required for #{@origin}"
|
17
|
+
end
|
18
|
+
end
|
19
|
+
end
|
@@ -0,0 +1,16 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Katinguele
|
4
|
+
class TimeoutError < Error
|
5
|
+
attr_reader :response
|
6
|
+
|
7
|
+
def initialize(response)
|
8
|
+
@response = response
|
9
|
+
super(response.original)
|
10
|
+
end
|
11
|
+
|
12
|
+
def log
|
13
|
+
Katinguele::Logger.error(self)
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Katinguele
|
4
|
+
module Logger
|
5
|
+
module_function
|
6
|
+
|
7
|
+
def request(req, method)
|
8
|
+
p log("request: #{method} #{req.uri}")
|
9
|
+
p log("request: HEADERS: #{req.headers&.to_json}") if req.headers
|
10
|
+
p log("request: PAYLOAD: #{req.payload&.to_json}") if req.payload
|
11
|
+
nil
|
12
|
+
end
|
13
|
+
|
14
|
+
def response(res)
|
15
|
+
p log("response: SUCCESS: #{res.success?}")
|
16
|
+
p log("response: TIMEOUT: #{res.timeout?}")
|
17
|
+
p log("response: CODE: #{res.code}")
|
18
|
+
p log("response: BODY: #{res.body&.to_json}")
|
19
|
+
end
|
20
|
+
|
21
|
+
def error(err)
|
22
|
+
p log("error: #{err.class}")
|
23
|
+
p log("error: SUCCESS: #{err.response.success?}")
|
24
|
+
p log("error: TIMEOUT: #{err.response.timeout?}")
|
25
|
+
p log("error: CODE: #{err.response.code}")
|
26
|
+
p log("error: BODY: #{err.response.body&.to_json}")
|
27
|
+
end
|
28
|
+
|
29
|
+
def log(message)
|
30
|
+
"INFO -- #{message}"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,85 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Katinguele
|
4
|
+
class Request
|
5
|
+
ACCESSORS = %i[
|
6
|
+
after
|
7
|
+
before
|
8
|
+
headers
|
9
|
+
logger
|
10
|
+
open_timeout
|
11
|
+
params
|
12
|
+
path
|
13
|
+
payload
|
14
|
+
protocol
|
15
|
+
raise_error
|
16
|
+
timeout
|
17
|
+
url
|
18
|
+
].freeze
|
19
|
+
|
20
|
+
attr_accessor(*(ACCESSORS | %i[uri method]))
|
21
|
+
|
22
|
+
def initialize(options = {})
|
23
|
+
setup!(options)
|
24
|
+
end
|
25
|
+
|
26
|
+
def log
|
27
|
+
Katinguele::Logger.request(self, @method.to_s.upcase)
|
28
|
+
end
|
29
|
+
|
30
|
+
def setup!(options = {})
|
31
|
+
accessors!(options || {})
|
32
|
+
validate!
|
33
|
+
build_urn!
|
34
|
+
handle_query_params!
|
35
|
+
handle_urn_params!
|
36
|
+
end
|
37
|
+
|
38
|
+
def before!(*params)
|
39
|
+
hook!(:before, params)
|
40
|
+
end
|
41
|
+
|
42
|
+
def after!(*params)
|
43
|
+
hook!(:after, params)
|
44
|
+
end
|
45
|
+
|
46
|
+
private
|
47
|
+
|
48
|
+
def hook!(hook, params)
|
49
|
+
return unless send(hook)&.is_a?(Proc)
|
50
|
+
|
51
|
+
send(hook).call(*params[0..(send(hook).parameters.length - 1)])
|
52
|
+
end
|
53
|
+
|
54
|
+
def validate!
|
55
|
+
raise Katinguele::RequiredFieldError.new(self.class, :url) unless @url
|
56
|
+
end
|
57
|
+
|
58
|
+
def accessors!(params)
|
59
|
+
params.slice(*ACCESSORS)
|
60
|
+
.each { |k, v| instance_variable_set("@#{k}", v) }
|
61
|
+
end
|
62
|
+
|
63
|
+
def build_urn!
|
64
|
+
@uri = [@protocol, [@url, @path].compact.join('/')].compact.join('://')
|
65
|
+
end
|
66
|
+
|
67
|
+
def handle_urn_params!
|
68
|
+
return unless @params.is_a?(Hash)
|
69
|
+
|
70
|
+
@params.filter { |k, _v| @uri.include?(":#{k}") }
|
71
|
+
.each { |k, v| @uri.gsub!(":#{k}", v.to_s) }
|
72
|
+
.then { @uri.gsub!(/:[a-z_-]+/, '') }
|
73
|
+
end
|
74
|
+
|
75
|
+
def handle_query_params!
|
76
|
+
return unless @params.is_a?(Hash)
|
77
|
+
|
78
|
+
@params.reject { |k, _v| @uri.include?(":#{k}") }
|
79
|
+
.map { |k, v| "#{k}=#{v}" }
|
80
|
+
.then { |array| array.join('&') }
|
81
|
+
.then { |query| query unless query.empty? }
|
82
|
+
.then { |query| @uri = [@uri, query].compact.join('?') }
|
83
|
+
end
|
84
|
+
end
|
85
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Katinguele
|
4
|
+
class RequestErrorFactory
|
5
|
+
class << self
|
6
|
+
def build(response)
|
7
|
+
return TimeoutError.new(response) if response.timeout?
|
8
|
+
|
9
|
+
find_by_code(response.code).new(response)
|
10
|
+
end
|
11
|
+
|
12
|
+
private
|
13
|
+
|
14
|
+
def find_by_code(code)
|
15
|
+
case code
|
16
|
+
when 400 then BadRequestError
|
17
|
+
when 401 then UnauthorizedError
|
18
|
+
when 403 then ForbiddenError
|
19
|
+
when 404 then ResourceNotFoundError
|
20
|
+
when 422 then UnprocessableEntityError
|
21
|
+
when 400..499 then ClientError
|
22
|
+
when 500 then InternalServerError
|
23
|
+
when 503 then ServiceUnavailableError
|
24
|
+
when 500..599 then ServerError
|
25
|
+
else
|
26
|
+
RequestError
|
27
|
+
end
|
28
|
+
end
|
29
|
+
end
|
30
|
+
end
|
31
|
+
end
|
@@ -0,0 +1,52 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'json'
|
4
|
+
require 'faraday'
|
5
|
+
|
6
|
+
module Katinguele
|
7
|
+
class Response
|
8
|
+
attr_reader :original
|
9
|
+
|
10
|
+
def initialize(original)
|
11
|
+
@original = original
|
12
|
+
end
|
13
|
+
|
14
|
+
def body
|
15
|
+
return {} if timeout?
|
16
|
+
|
17
|
+
@body ||= parsed_body
|
18
|
+
end
|
19
|
+
|
20
|
+
def success?
|
21
|
+
return false if timeout?
|
22
|
+
|
23
|
+
@success ||= faraday_response? && @original&.success?
|
24
|
+
end
|
25
|
+
|
26
|
+
def code
|
27
|
+
return if timeout?
|
28
|
+
|
29
|
+
@code ||= faraday_response? ? @original.status : @original.response[:status]
|
30
|
+
end
|
31
|
+
|
32
|
+
def timeout?
|
33
|
+
@original.is_a?(Faraday::TimeoutError) ||
|
34
|
+
@original.is_a?(Net::ReadTimeout) ||
|
35
|
+
@original.is_a?(Faraday::ConnectionFailed)
|
36
|
+
end
|
37
|
+
|
38
|
+
def log
|
39
|
+
Katinguele::Logger.response(self)
|
40
|
+
end
|
41
|
+
|
42
|
+
private
|
43
|
+
|
44
|
+
def parsed_body
|
45
|
+
JSON.parse(faraday_response? ? @original.body : @original.response[:body], symbolize_names: true)
|
46
|
+
end
|
47
|
+
|
48
|
+
def faraday_response?
|
49
|
+
@original.is_a?(Faraday::Response)
|
50
|
+
end
|
51
|
+
end
|
52
|
+
end
|
data/lib/katinguele.rb
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require 'katinguele/version'
|
4
|
+
require 'katinguele/errors'
|
5
|
+
require 'katinguele/request'
|
6
|
+
require 'katinguele/response'
|
7
|
+
require 'katinguele/request_error_factory'
|
8
|
+
require 'katinguele/logger'
|
9
|
+
require 'katinguele/configuration'
|
10
|
+
require 'katinguele/client'
|
11
|
+
|
12
|
+
module Katinguele
|
13
|
+
class << self
|
14
|
+
def configure
|
15
|
+
yield(configuration)
|
16
|
+
end
|
17
|
+
|
18
|
+
def configuration
|
19
|
+
@configuration ||= Configuration.new
|
20
|
+
end
|
21
|
+
end
|
22
|
+
end
|
metadata
ADDED
@@ -0,0 +1,229 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: katinguele
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 1.0.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- linqueta
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2019-12-19 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: faraday
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - ">="
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 0.17.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - ">="
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 0.17.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: bundler
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '2.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '2.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: factory_bot
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - ">="
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: 5.1.1
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - ">="
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: 5.1.1
|
55
|
+
- !ruby/object:Gem::Dependency
|
56
|
+
name: pry-byebug
|
57
|
+
requirement: !ruby/object:Gem::Requirement
|
58
|
+
requirements:
|
59
|
+
- - ">="
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 3.7.0
|
62
|
+
type: :development
|
63
|
+
prerelease: false
|
64
|
+
version_requirements: !ruby/object:Gem::Requirement
|
65
|
+
requirements:
|
66
|
+
- - ">="
|
67
|
+
- !ruby/object:Gem::Version
|
68
|
+
version: 3.7.0
|
69
|
+
- !ruby/object:Gem::Dependency
|
70
|
+
name: rake
|
71
|
+
requirement: !ruby/object:Gem::Requirement
|
72
|
+
requirements:
|
73
|
+
- - "~>"
|
74
|
+
- !ruby/object:Gem::Version
|
75
|
+
version: '10.0'
|
76
|
+
type: :development
|
77
|
+
prerelease: false
|
78
|
+
version_requirements: !ruby/object:Gem::Requirement
|
79
|
+
requirements:
|
80
|
+
- - "~>"
|
81
|
+
- !ruby/object:Gem::Version
|
82
|
+
version: '10.0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: rspec
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - "~>"
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '3.0'
|
90
|
+
type: :development
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - "~>"
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '3.0'
|
97
|
+
- !ruby/object:Gem::Dependency
|
98
|
+
name: rubocop
|
99
|
+
requirement: !ruby/object:Gem::Requirement
|
100
|
+
requirements:
|
101
|
+
- - ">="
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: 0.74.0
|
104
|
+
type: :development
|
105
|
+
prerelease: false
|
106
|
+
version_requirements: !ruby/object:Gem::Requirement
|
107
|
+
requirements:
|
108
|
+
- - ">="
|
109
|
+
- !ruby/object:Gem::Version
|
110
|
+
version: 0.74.0
|
111
|
+
- !ruby/object:Gem::Dependency
|
112
|
+
name: rubocop-performance
|
113
|
+
requirement: !ruby/object:Gem::Requirement
|
114
|
+
requirements:
|
115
|
+
- - ">="
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: 1.4.1
|
118
|
+
type: :development
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
requirements:
|
122
|
+
- - ">="
|
123
|
+
- !ruby/object:Gem::Version
|
124
|
+
version: 1.4.1
|
125
|
+
- !ruby/object:Gem::Dependency
|
126
|
+
name: simplecov
|
127
|
+
requirement: !ruby/object:Gem::Requirement
|
128
|
+
requirements:
|
129
|
+
- - ">="
|
130
|
+
- !ruby/object:Gem::Version
|
131
|
+
version: 0.17.0
|
132
|
+
type: :development
|
133
|
+
prerelease: false
|
134
|
+
version_requirements: !ruby/object:Gem::Requirement
|
135
|
+
requirements:
|
136
|
+
- - ">="
|
137
|
+
- !ruby/object:Gem::Version
|
138
|
+
version: 0.17.0
|
139
|
+
- !ruby/object:Gem::Dependency
|
140
|
+
name: simplecov-console
|
141
|
+
requirement: !ruby/object:Gem::Requirement
|
142
|
+
requirements:
|
143
|
+
- - ">="
|
144
|
+
- !ruby/object:Gem::Version
|
145
|
+
version: 0.5.0
|
146
|
+
type: :development
|
147
|
+
prerelease: false
|
148
|
+
version_requirements: !ruby/object:Gem::Requirement
|
149
|
+
requirements:
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 0.5.0
|
153
|
+
- !ruby/object:Gem::Dependency
|
154
|
+
name: vcr
|
155
|
+
requirement: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - ">="
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: 5.0.0
|
160
|
+
type: :development
|
161
|
+
prerelease: false
|
162
|
+
version_requirements: !ruby/object:Gem::Requirement
|
163
|
+
requirements:
|
164
|
+
- - ">="
|
165
|
+
- !ruby/object:Gem::Version
|
166
|
+
version: 5.0.0
|
167
|
+
- !ruby/object:Gem::Dependency
|
168
|
+
name: webmock
|
169
|
+
requirement: !ruby/object:Gem::Requirement
|
170
|
+
requirements:
|
171
|
+
- - ">="
|
172
|
+
- !ruby/object:Gem::Version
|
173
|
+
version: 3.7.6
|
174
|
+
type: :development
|
175
|
+
prerelease: false
|
176
|
+
version_requirements: !ruby/object:Gem::Requirement
|
177
|
+
requirements:
|
178
|
+
- - ">="
|
179
|
+
- !ruby/object:Gem::Version
|
180
|
+
version: 3.7.6
|
181
|
+
description: katinguele
|
182
|
+
email:
|
183
|
+
- lincolnrodrs@gmail.com
|
184
|
+
executables: []
|
185
|
+
extensions: []
|
186
|
+
extra_rdoc_files: []
|
187
|
+
files:
|
188
|
+
- MIT-LICENSE
|
189
|
+
- README.md
|
190
|
+
- lib/generators/katinguele/install_generator.rb
|
191
|
+
- lib/katinguele.rb
|
192
|
+
- lib/katinguele/client.rb
|
193
|
+
- lib/katinguele/client/builder.rb
|
194
|
+
- lib/katinguele/client/requester.rb
|
195
|
+
- lib/katinguele/configuration.rb
|
196
|
+
- lib/katinguele/errors.rb
|
197
|
+
- lib/katinguele/errors/error.rb
|
198
|
+
- lib/katinguele/errors/request_error.rb
|
199
|
+
- lib/katinguele/errors/required_field_error.rb
|
200
|
+
- lib/katinguele/errors/timeout_error.rb
|
201
|
+
- lib/katinguele/logger.rb
|
202
|
+
- lib/katinguele/request.rb
|
203
|
+
- lib/katinguele/request_error_factory.rb
|
204
|
+
- lib/katinguele/response.rb
|
205
|
+
- lib/katinguele/version.rb
|
206
|
+
homepage: https://github.com/linqueta/katinguele
|
207
|
+
licenses:
|
208
|
+
- MIT
|
209
|
+
metadata: {}
|
210
|
+
post_install_message:
|
211
|
+
rdoc_options: []
|
212
|
+
require_paths:
|
213
|
+
- lib
|
214
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
215
|
+
requirements:
|
216
|
+
- - ">="
|
217
|
+
- !ruby/object:Gem::Version
|
218
|
+
version: '0'
|
219
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
220
|
+
requirements:
|
221
|
+
- - ">="
|
222
|
+
- !ruby/object:Gem::Version
|
223
|
+
version: '0'
|
224
|
+
requirements: []
|
225
|
+
rubygems_version: 3.0.3
|
226
|
+
signing_key:
|
227
|
+
specification_version: 4
|
228
|
+
summary: katinguele
|
229
|
+
test_files: []
|