flash_integration 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +5 -0
- data/LICENSE +21 -0
- data/README.md +86 -0
- data/Rakefile +49 -0
- data/lib/flash/integration/connection.rb +118 -0
- data/lib/flash/integration/multipart_flat.rb +26 -0
- data/lib/flash/integration/request.rb +18 -0
- data/lib/flash/integration/response.rb +25 -0
- data/lib/flash/integration/version.rb +14 -0
- data/lib/flash_integration.rb +28 -0
- data/spec/flash/integration/connection_spec.rb +99 -0
- data/spec/flash/integration/response_spec.rb +40 -0
- data/spec/flash_integration_spec.rb +24 -0
- data/spec/spec_helper.rb +25 -0
- metadata +216 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: b2f23dde3fb12c40861560bd60bb180f1586f63095a7f9d29ad23dd9d930f777
|
4
|
+
data.tar.gz: 201d2a58f30ee5084bd5feefa3b2e156063aa2d23a2b5d92473dbff2bb150731
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 221cc98e24c5a4108e315baff391197488ce22f40f1734c84681328b2beb86a8202948152b7d62e96f41816efc9635309317b1061aaaa365081888e0962d7ee6
|
7
|
+
data.tar.gz: 816300806c206582b671275bce3b9355154683780dce4b750a74744d18e7e0a8792c024d0ff9d07c1aa5e63c239f0547419087f15fce645e40b8df39c0417d67
|
data/LICENSE
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
MIT License
|
2
|
+
|
3
|
+
Copyright (c) 2021 QFlash
|
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 all
|
13
|
+
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 THE
|
21
|
+
SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,86 @@
|
|
1
|
+
BigId Auth's Library for Ruby
|
2
|
+
==============
|
3
|
+
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/flash_integration.svg)](https://badge.fury.io/rb/flash_integration)
|
5
|
+
[![Build Status](https://travis-ci.com/Quasar-Flash/flash-integration-ruby.svg?branch=master)](https://travis-ci.com/Quasar-Flash/flash-integration-ruby)
|
6
|
+
|
7
|
+
Dev Requirements
|
8
|
+
-----------------
|
9
|
+
|
10
|
+
- Ruby: Any version
|
11
|
+
- Bundler
|
12
|
+
|
13
|
+
Global Installation
|
14
|
+
-----------------
|
15
|
+
|
16
|
+
gem install flash_integration
|
17
|
+
|
18
|
+
Installation for Rails
|
19
|
+
-----------------
|
20
|
+
|
21
|
+
# Add to the Gemfile
|
22
|
+
gem 'flash_integration', '~> 0.1.0'
|
23
|
+
|
24
|
+
Example - How to extend
|
25
|
+
-----------------
|
26
|
+
|
27
|
+
module MyApp
|
28
|
+
class Connection < Flash::Integration::Connection
|
29
|
+
def initialize(base_url: "http://localhost")
|
30
|
+
super(base_url: base_url)
|
31
|
+
end
|
32
|
+
|
33
|
+
def default_headers
|
34
|
+
{
|
35
|
+
"Accept": "application/json",
|
36
|
+
"Content-Type": "application/json"
|
37
|
+
}
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
41
|
+
|
42
|
+
Example - How to request
|
43
|
+
-----------------
|
44
|
+
|
45
|
+
res = @connection.post(
|
46
|
+
method: :post,
|
47
|
+
url: url,
|
48
|
+
params: {},
|
49
|
+
headers: {},
|
50
|
+
body: body, # except for get
|
51
|
+
multipart: multipart # only for post
|
52
|
+
)
|
53
|
+
res # Flash::Integration::Response type
|
54
|
+
res.request
|
55
|
+
res.status
|
56
|
+
res.headers
|
57
|
+
res.body
|
58
|
+
res.time
|
59
|
+
|
60
|
+
Problems?
|
61
|
+
-----------------
|
62
|
+
|
63
|
+
**Please do not directly email any committers with questions or problems.** A community is best served when discussions are held in public.
|
64
|
+
|
65
|
+
Searching the [issues](https://github.com/Quasar-Flash/flash-integration-ruby/issues) for your problem is also a good idea.
|
66
|
+
|
67
|
+
Contributing
|
68
|
+
-----------------
|
69
|
+
|
70
|
+
- Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet;
|
71
|
+
- Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it;
|
72
|
+
- Fork the project;
|
73
|
+
- Start a feature/bugfix branch;
|
74
|
+
- Commit and push until you are happy with your contribution;
|
75
|
+
- Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.;
|
76
|
+
- Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
|
77
|
+
|
78
|
+
License
|
79
|
+
-----------------
|
80
|
+
|
81
|
+
Please see [LICENSE](https://github.com/Quasar-Flash/flash-integration-ruby/blob/master/LICENSE.txt) for licensing details.
|
82
|
+
|
83
|
+
Authors
|
84
|
+
-----------------
|
85
|
+
|
86
|
+
Danilo Carolino, [@danilogco](https://github.com/danilogco) / [@Quasar-Flash](https://github.com/Quasar-Flash)
|
data/Rakefile
ADDED
@@ -0,0 +1,49 @@
|
|
1
|
+
#!/usr/bin/env rake
|
2
|
+
# frozen_string_literal: true
|
3
|
+
|
4
|
+
begin
|
5
|
+
require "bundler/setup"
|
6
|
+
rescue LoadError
|
7
|
+
puts "You must `gem install bundler` and `bundle install` to run rake tasks"
|
8
|
+
end
|
9
|
+
|
10
|
+
begin
|
11
|
+
require "rdoc/task"
|
12
|
+
rescue LoadError
|
13
|
+
require "rdoc/rdoc"
|
14
|
+
require "rake/rdoctask"
|
15
|
+
|
16
|
+
RDoc::Task = Rake::RDocTask
|
17
|
+
end
|
18
|
+
|
19
|
+
RDoc::Task.new(:rdoc) do |rdoc|
|
20
|
+
rdoc.rdoc_dir = "rdoc"
|
21
|
+
rdoc.title = "flash_integration"
|
22
|
+
rdoc.options << "--line-numbers"
|
23
|
+
rdoc.rdoc_files.include("README.rdoc")
|
24
|
+
rdoc.rdoc_files.include("lib/**/*.rb")
|
25
|
+
end
|
26
|
+
|
27
|
+
Bundler::GemHelper.install_tasks
|
28
|
+
|
29
|
+
begin
|
30
|
+
require "rake/testtask"
|
31
|
+
require "rubocop/rake_task"
|
32
|
+
|
33
|
+
RuboCop::RakeTask.new(:rubocop) do |t|
|
34
|
+
t.requires << "rubocop-rspec"
|
35
|
+
t.options = ["--display-cop-names"]
|
36
|
+
end
|
37
|
+
rescue LoadError
|
38
|
+
# no rspec available
|
39
|
+
end
|
40
|
+
|
41
|
+
begin
|
42
|
+
require "rspec/core/rake_task"
|
43
|
+
|
44
|
+
RSpec::Core::RakeTask.new(:spec)
|
45
|
+
rescue LoadError
|
46
|
+
# no rspec available
|
47
|
+
end
|
48
|
+
|
49
|
+
task default: %i[rubocop spec]
|
@@ -0,0 +1,118 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Flash
|
4
|
+
module Integration
|
5
|
+
class Connection
|
6
|
+
attr_reader :base_url
|
7
|
+
|
8
|
+
def initialize(base_url:, request_class: Faraday)
|
9
|
+
@request_class = request_class
|
10
|
+
@base_url = base_url
|
11
|
+
end
|
12
|
+
|
13
|
+
def get(url: "", params: {}, headers: {})
|
14
|
+
send_request(
|
15
|
+
method: :get,
|
16
|
+
url: url,
|
17
|
+
params: params,
|
18
|
+
headers: headers
|
19
|
+
)
|
20
|
+
end
|
21
|
+
|
22
|
+
def post(url: "", params: {}, headers: {}, body: {}, multipart: false)
|
23
|
+
send_request(
|
24
|
+
method: :post,
|
25
|
+
url: url,
|
26
|
+
params: params,
|
27
|
+
headers: headers,
|
28
|
+
body: body,
|
29
|
+
multipart: multipart
|
30
|
+
)
|
31
|
+
end
|
32
|
+
|
33
|
+
def put(url: "", params: {}, headers: {}, body: {})
|
34
|
+
send_request(
|
35
|
+
method: :put,
|
36
|
+
url: url,
|
37
|
+
params: params,
|
38
|
+
headers: headers,
|
39
|
+
body: body
|
40
|
+
)
|
41
|
+
end
|
42
|
+
|
43
|
+
def patch(url: "", params: {}, headers: {}, body: {})
|
44
|
+
send_request(
|
45
|
+
method: :patch,
|
46
|
+
url: url,
|
47
|
+
params: params,
|
48
|
+
headers: headers,
|
49
|
+
body: body
|
50
|
+
)
|
51
|
+
end
|
52
|
+
|
53
|
+
def delete(url: "", params: {}, headers: {}, body: {})
|
54
|
+
send_request(
|
55
|
+
method: :delete,
|
56
|
+
url: url,
|
57
|
+
params: params,
|
58
|
+
headers: headers,
|
59
|
+
body: body
|
60
|
+
)
|
61
|
+
end
|
62
|
+
|
63
|
+
def default_headers
|
64
|
+
{}
|
65
|
+
end
|
66
|
+
|
67
|
+
private
|
68
|
+
def send_request(method:, url:, params:, headers:, body: nil, multipart: false)
|
69
|
+
connection = multipart ? multipart_connection : @request_class.new(url: @base_url)
|
70
|
+
|
71
|
+
merged_headers = default_headers.merge(headers)
|
72
|
+
|
73
|
+
request = build_request(
|
74
|
+
method, connection.build_url(url).to_s, params, merged_headers, body
|
75
|
+
)
|
76
|
+
|
77
|
+
result =
|
78
|
+
connection.send(method) do |request|
|
79
|
+
request.url(url)
|
80
|
+
request.params = params
|
81
|
+
request.headers = merged_headers
|
82
|
+
request.body = body if body
|
83
|
+
end
|
84
|
+
|
85
|
+
build_response(request, result.status, result.headers, result.body)
|
86
|
+
end
|
87
|
+
|
88
|
+
def multipart_connection
|
89
|
+
@request_class.new(url: @base_url) do |conn|
|
90
|
+
conn.use Flash::Integration::MultipartFlat
|
91
|
+
conn.request :url_encoded
|
92
|
+
conn.adapter @request_class.default_adapter
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
96
|
+
def build_request(method, url, params, headers, body)
|
97
|
+
Flash::Integration::Request.new(
|
98
|
+
method: method,
|
99
|
+
url: url,
|
100
|
+
params: params,
|
101
|
+
headers: headers,
|
102
|
+
body: body,
|
103
|
+
time: Time.now.utc
|
104
|
+
)
|
105
|
+
end
|
106
|
+
|
107
|
+
def build_response(request, status, headers, body)
|
108
|
+
Flash::Integration::Response.new(
|
109
|
+
request: request,
|
110
|
+
status: status,
|
111
|
+
headers: headers,
|
112
|
+
body: body,
|
113
|
+
time: Time.now.utc
|
114
|
+
)
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Flash
|
4
|
+
module Integration
|
5
|
+
class MultipartFlat < Faraday::Request::Multipart
|
6
|
+
self.mime_type = "multipart/form-data"
|
7
|
+
DEFAULT_BOUNDARY_PREFIX = "-----------RubyMultipartPost" unless defined? DEFAULT_BOUNDARY_PREFIX
|
8
|
+
|
9
|
+
def process_params(params, prefix = nil, pieces = nil, &block)
|
10
|
+
params.inject(pieces || []) do |all, (key, value)|
|
11
|
+
key = prefix.to_s if prefix
|
12
|
+
|
13
|
+
case value
|
14
|
+
when Array
|
15
|
+
values = value.inject([]) { |a, v| a << [nil, v] }
|
16
|
+
process_params(values, key, all, &block)
|
17
|
+
when Hash
|
18
|
+
process_params(value, key, all, &block)
|
19
|
+
else
|
20
|
+
all << block.call(key, value)
|
21
|
+
end
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Flash
|
4
|
+
module Integration
|
5
|
+
class Request
|
6
|
+
attr_reader :method, :url, :params, :headers, :body, :time
|
7
|
+
|
8
|
+
def initialize(attributes)
|
9
|
+
@method = attributes.fetch(:method)
|
10
|
+
@url = attributes.fetch(:url)
|
11
|
+
@params = attributes[:params] || {}
|
12
|
+
@headers = attributes[:headers] || {}
|
13
|
+
@body = attributes[:body] || {}
|
14
|
+
@time = attributes[:time] || Time.now.utc
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
18
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Flash
|
4
|
+
module Integration
|
5
|
+
class Response
|
6
|
+
attr_reader :request, :status, :headers, :body, :time
|
7
|
+
|
8
|
+
def initialize(attributes)
|
9
|
+
@request = attributes.fetch(:request)
|
10
|
+
@status = attributes.fetch(:status)
|
11
|
+
@headers = attributes[:headers] || {}
|
12
|
+
@body = attributes[:body] || {}
|
13
|
+
@time = attributes[:time] || Time.now.utc
|
14
|
+
end
|
15
|
+
|
16
|
+
def success?
|
17
|
+
@status.between?(200, 299)
|
18
|
+
end
|
19
|
+
|
20
|
+
def error?
|
21
|
+
!success?
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Flash
|
4
|
+
module Integration
|
5
|
+
# When updating version, keep in mind Semantic Versioning http://semver.org/
|
6
|
+
# TL;DR; (Major.Minor.Patch)
|
7
|
+
# Releases before 1.0.0 are in active development and can change anytime
|
8
|
+
# 1.0.0 and up is indication and declaration of a stable public API
|
9
|
+
# Major - Incremented for incompatible changes with previous release (or big enough new features)
|
10
|
+
# Minor - Incremented for new backwards-compatible features + deprecations
|
11
|
+
# Patch - Incremented for backwards-compatible bug fixes
|
12
|
+
VERSION = "0.1.0"
|
13
|
+
end
|
14
|
+
end
|
@@ -0,0 +1,28 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "faraday"
|
4
|
+
|
5
|
+
require "flash/integration/version"
|
6
|
+
require "flash/integration/multipart_flat"
|
7
|
+
require "flash/integration/response"
|
8
|
+
require "flash/integration/request"
|
9
|
+
require "flash/integration/connection"
|
10
|
+
|
11
|
+
module Flash::Integration
|
12
|
+
class << self
|
13
|
+
attr_writer :configuration
|
14
|
+
|
15
|
+
def configuration
|
16
|
+
@configuration ||= Configuration.new
|
17
|
+
end
|
18
|
+
end
|
19
|
+
|
20
|
+
def self.configure
|
21
|
+
self.configuration ||= Configuration.new
|
22
|
+
|
23
|
+
yield(configuration)
|
24
|
+
end
|
25
|
+
|
26
|
+
class Configuration
|
27
|
+
end
|
28
|
+
end
|
@@ -0,0 +1,99 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
describe Flash::Integration::Connection do
|
6
|
+
let(:base_url) { "http://localhost" }
|
7
|
+
let(:connection) { Faraday::Connection.new(url: base_url) }
|
8
|
+
let(:instance) { described_class.new(request_class: request_class, base_url: base_url) }
|
9
|
+
let(:request_params) { double("request-params") }
|
10
|
+
let(:request_class) { class_double(Faraday, default_adapter: double("request-params")) }
|
11
|
+
let(:request_headers) { {} }
|
12
|
+
let(:request_body) { double("request-body") }
|
13
|
+
let(:response_status) { double("response-status") }
|
14
|
+
let(:response_headers) { double("response-headers") }
|
15
|
+
let(:response_body) { double("response-body") }
|
16
|
+
let(:time) { Time.now.utc }
|
17
|
+
let(:multipart) { nil }
|
18
|
+
|
19
|
+
let(:response) do
|
20
|
+
double(
|
21
|
+
"response",
|
22
|
+
request: request,
|
23
|
+
status: response_status,
|
24
|
+
headers: response_headers,
|
25
|
+
body: response_body
|
26
|
+
)
|
27
|
+
end
|
28
|
+
let(:request) do
|
29
|
+
Flash::Integration::Request.new(
|
30
|
+
method: http_protocol,
|
31
|
+
url: base_url,
|
32
|
+
params: request_params,
|
33
|
+
headers: request_headers,
|
34
|
+
body: request_body,
|
35
|
+
time: time
|
36
|
+
)
|
37
|
+
end
|
38
|
+
|
39
|
+
shared_examples "successful_request" do |http_protocol|
|
40
|
+
let(:http_protocol) { http_protocol.to_sym }
|
41
|
+
let(:args) { { url: base_url, params: request_params, headers: request_headers, body: request_body } }
|
42
|
+
|
43
|
+
subject { instance.send(http_protocol, **args) }
|
44
|
+
|
45
|
+
before do
|
46
|
+
allow(request_class).to receive(:new).and_return(connection)
|
47
|
+
allow(connection).to receive(http_protocol).and_return(response)
|
48
|
+
end
|
49
|
+
|
50
|
+
it { subject; expect(request_class).to have_received(:new) }
|
51
|
+
|
52
|
+
it { subject; expect(connection).to have_received(http_protocol) }
|
53
|
+
|
54
|
+
it { expect(subject.request).to have_attributes(
|
55
|
+
method: http_protocol,
|
56
|
+
url: base_url,
|
57
|
+
params: request_params,
|
58
|
+
headers: request_headers,
|
59
|
+
body: request_body)
|
60
|
+
}
|
61
|
+
|
62
|
+
it { expect(subject.time).to be_kind_of(Time) }
|
63
|
+
|
64
|
+
it { expect(subject.status).to eq(response_status) }
|
65
|
+
|
66
|
+
it { expect(subject.headers).to eq(response_headers) }
|
67
|
+
|
68
|
+
it { expect(subject.body).to eq(response_body) }
|
69
|
+
|
70
|
+
it { expect(connection.adapter).to eq(Faraday::Adapter::NetHttp) }
|
71
|
+
|
72
|
+
it { expect(connection.builder.handlers).to eq([Faraday::Request::UrlEncoded]) }
|
73
|
+
end
|
74
|
+
|
75
|
+
describe "#get" do
|
76
|
+
include_examples "successful_request", :get
|
77
|
+
|
78
|
+
let!(:args) { { url: base_url, params: request_params, headers: request_headers } }
|
79
|
+
let(:request_body) { {} }
|
80
|
+
end
|
81
|
+
|
82
|
+
describe "#post" do
|
83
|
+
include_examples "successful_request", :post
|
84
|
+
|
85
|
+
let!(:args) { { url: base_url, params: request_params, headers: request_headers, body: request_body, multipart: true } }
|
86
|
+
end
|
87
|
+
|
88
|
+
describe "#put" do
|
89
|
+
include_examples "successful_request", :put
|
90
|
+
end
|
91
|
+
|
92
|
+
describe "#patch" do
|
93
|
+
include_examples "successful_request", :patch
|
94
|
+
end
|
95
|
+
|
96
|
+
describe "#delete" do
|
97
|
+
include_examples "successful_request", :delete
|
98
|
+
end
|
99
|
+
end
|
@@ -0,0 +1,40 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
describe Flash::Integration::Response do
|
6
|
+
let(:request) { double("request") }
|
7
|
+
let(:instance) { described_class.new(request: request, status: status) }
|
8
|
+
|
9
|
+
describe "#success?" do
|
10
|
+
subject { instance.success? }
|
11
|
+
|
12
|
+
context "when the status code is between 200 and 299" do
|
13
|
+
let(:status) { 250 }
|
14
|
+
|
15
|
+
it { expect(subject).to be_truthy }
|
16
|
+
end
|
17
|
+
|
18
|
+
context "when the status code is not between 200 and 299" do
|
19
|
+
let(:status) { 500 }
|
20
|
+
|
21
|
+
it { expect(subject).to be_falsey }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
describe "#error?" do
|
26
|
+
subject { instance.error? }
|
27
|
+
|
28
|
+
context "when the status code is between 200 and 299" do
|
29
|
+
let(:status) { 250 }
|
30
|
+
|
31
|
+
it { expect(subject).to be_falsey }
|
32
|
+
end
|
33
|
+
|
34
|
+
context "when the status code is not between 200 and 299" do
|
35
|
+
let(:status) { 500 }
|
36
|
+
|
37
|
+
it { expect(subject).to be_truthy }
|
38
|
+
end
|
39
|
+
end
|
40
|
+
end
|
@@ -0,0 +1,24 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
require "flash_integration"
|
5
|
+
|
6
|
+
RSpec.describe Flash::Integration do
|
7
|
+
describe ".configure" do
|
8
|
+
before do
|
9
|
+
described_class.configuration = nil
|
10
|
+
ENV.clear
|
11
|
+
end
|
12
|
+
|
13
|
+
subject { described_class.configuration }
|
14
|
+
|
15
|
+
context "when configuration is defined" do
|
16
|
+
before do
|
17
|
+
described_class.configure do |config|
|
18
|
+
end
|
19
|
+
end
|
20
|
+
|
21
|
+
it { expect(subject).not_to be_nil }
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "rubygems"
|
4
|
+
require "bundler"
|
5
|
+
require "pry"
|
6
|
+
require "flash_integration"
|
7
|
+
|
8
|
+
begin
|
9
|
+
Bundler.setup(:default, :development, :test)
|
10
|
+
rescue Bundler::BundlerError => e
|
11
|
+
warn e.message
|
12
|
+
warn "Run `bundle install` to install missing gems"
|
13
|
+
|
14
|
+
exit e.status_code
|
15
|
+
end
|
16
|
+
|
17
|
+
require "simplecov"
|
18
|
+
|
19
|
+
SimpleCov.start do
|
20
|
+
add_filter "spec"
|
21
|
+
end
|
22
|
+
|
23
|
+
RSpec.configure do |config|
|
24
|
+
config.alias_example_group_to :detail, detailed: true
|
25
|
+
end
|
metadata
ADDED
@@ -0,0 +1,216 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: flash_integration
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Danilo Carolino
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-04-25 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: 1.4.1
|
20
|
+
- - ">="
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '1.0'
|
23
|
+
type: :runtime
|
24
|
+
prerelease: false
|
25
|
+
version_requirements: !ruby/object:Gem::Requirement
|
26
|
+
requirements:
|
27
|
+
- - "~>"
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 1.4.1
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '1.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: bundler
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - ">="
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: 1.1.0
|
40
|
+
type: :development
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - ">="
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 1.1.0
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: pry
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 0.14.1
|
54
|
+
type: :development
|
55
|
+
prerelease: false
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
requirements:
|
58
|
+
- - "~>"
|
59
|
+
- !ruby/object:Gem::Version
|
60
|
+
version: 0.14.1
|
61
|
+
- !ruby/object:Gem::Dependency
|
62
|
+
name: rake
|
63
|
+
requirement: !ruby/object:Gem::Requirement
|
64
|
+
requirements:
|
65
|
+
- - "~>"
|
66
|
+
- !ruby/object:Gem::Version
|
67
|
+
version: '13.0'
|
68
|
+
- - ">="
|
69
|
+
- !ruby/object:Gem::Version
|
70
|
+
version: 10.0.0
|
71
|
+
type: :development
|
72
|
+
prerelease: false
|
73
|
+
version_requirements: !ruby/object:Gem::Requirement
|
74
|
+
requirements:
|
75
|
+
- - "~>"
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '13.0'
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: 10.0.0
|
81
|
+
- !ruby/object:Gem::Dependency
|
82
|
+
name: rspec
|
83
|
+
requirement: !ruby/object:Gem::Requirement
|
84
|
+
requirements:
|
85
|
+
- - "~>"
|
86
|
+
- !ruby/object:Gem::Version
|
87
|
+
version: 3.10.0
|
88
|
+
type: :development
|
89
|
+
prerelease: false
|
90
|
+
version_requirements: !ruby/object:Gem::Requirement
|
91
|
+
requirements:
|
92
|
+
- - "~>"
|
93
|
+
- !ruby/object:Gem::Version
|
94
|
+
version: 3.10.0
|
95
|
+
- !ruby/object:Gem::Dependency
|
96
|
+
name: rubocop
|
97
|
+
requirement: !ruby/object:Gem::Requirement
|
98
|
+
requirements:
|
99
|
+
- - "~>"
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: 1.12.1
|
102
|
+
type: :development
|
103
|
+
prerelease: false
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
requirements:
|
106
|
+
- - "~>"
|
107
|
+
- !ruby/object:Gem::Version
|
108
|
+
version: 1.12.1
|
109
|
+
- !ruby/object:Gem::Dependency
|
110
|
+
name: rubocop-packaging
|
111
|
+
requirement: !ruby/object:Gem::Requirement
|
112
|
+
requirements:
|
113
|
+
- - "~>"
|
114
|
+
- !ruby/object:Gem::Version
|
115
|
+
version: 0.5.1
|
116
|
+
type: :development
|
117
|
+
prerelease: false
|
118
|
+
version_requirements: !ruby/object:Gem::Requirement
|
119
|
+
requirements:
|
120
|
+
- - "~>"
|
121
|
+
- !ruby/object:Gem::Version
|
122
|
+
version: 0.5.1
|
123
|
+
- !ruby/object:Gem::Dependency
|
124
|
+
name: rubocop-performance
|
125
|
+
requirement: !ruby/object:Gem::Requirement
|
126
|
+
requirements:
|
127
|
+
- - "~>"
|
128
|
+
- !ruby/object:Gem::Version
|
129
|
+
version: 1.10.2
|
130
|
+
type: :development
|
131
|
+
prerelease: false
|
132
|
+
version_requirements: !ruby/object:Gem::Requirement
|
133
|
+
requirements:
|
134
|
+
- - "~>"
|
135
|
+
- !ruby/object:Gem::Version
|
136
|
+
version: 1.10.2
|
137
|
+
- !ruby/object:Gem::Dependency
|
138
|
+
name: rubocop-rspec
|
139
|
+
requirement: !ruby/object:Gem::Requirement
|
140
|
+
requirements:
|
141
|
+
- - "~>"
|
142
|
+
- !ruby/object:Gem::Version
|
143
|
+
version: 2.2.0
|
144
|
+
type: :development
|
145
|
+
prerelease: false
|
146
|
+
version_requirements: !ruby/object:Gem::Requirement
|
147
|
+
requirements:
|
148
|
+
- - "~>"
|
149
|
+
- !ruby/object:Gem::Version
|
150
|
+
version: 2.2.0
|
151
|
+
- !ruby/object:Gem::Dependency
|
152
|
+
name: simplecov
|
153
|
+
requirement: !ruby/object:Gem::Requirement
|
154
|
+
requirements:
|
155
|
+
- - "~>"
|
156
|
+
- !ruby/object:Gem::Version
|
157
|
+
version: 0.21.0
|
158
|
+
type: :development
|
159
|
+
prerelease: false
|
160
|
+
version_requirements: !ruby/object:Gem::Requirement
|
161
|
+
requirements:
|
162
|
+
- - "~>"
|
163
|
+
- !ruby/object:Gem::Version
|
164
|
+
version: 0.21.0
|
165
|
+
description: A library to make easily to build integrations
|
166
|
+
email:
|
167
|
+
- danilo.carolino@qflash.com.br
|
168
|
+
executables: []
|
169
|
+
extensions: []
|
170
|
+
extra_rdoc_files: []
|
171
|
+
files:
|
172
|
+
- CHANGELOG.md
|
173
|
+
- LICENSE
|
174
|
+
- README.md
|
175
|
+
- Rakefile
|
176
|
+
- lib/flash/integration/connection.rb
|
177
|
+
- lib/flash/integration/multipart_flat.rb
|
178
|
+
- lib/flash/integration/request.rb
|
179
|
+
- lib/flash/integration/response.rb
|
180
|
+
- lib/flash/integration/version.rb
|
181
|
+
- lib/flash_integration.rb
|
182
|
+
- spec/flash/integration/connection_spec.rb
|
183
|
+
- spec/flash/integration/response_spec.rb
|
184
|
+
- spec/flash_integration_spec.rb
|
185
|
+
- spec/spec_helper.rb
|
186
|
+
homepage: https://github.com/Quasar-Flash/flash-integration-ruby
|
187
|
+
licenses:
|
188
|
+
- MIT
|
189
|
+
metadata:
|
190
|
+
changelog_uri: https://github.com/Quasar-Flash/flash-integration-ruby/blob/master/CHANGELOG.md
|
191
|
+
source_code_uri: https://github.com/Quasar-Flash/flash-integration-ruby
|
192
|
+
bug_tracker_uri: https://github.com/Quasar-Flash/flash-integration-ruby/issues
|
193
|
+
post_install_message:
|
194
|
+
rdoc_options: []
|
195
|
+
require_paths:
|
196
|
+
- lib
|
197
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
198
|
+
requirements:
|
199
|
+
- - ">="
|
200
|
+
- !ruby/object:Gem::Version
|
201
|
+
version: '2.5'
|
202
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
203
|
+
requirements:
|
204
|
+
- - ">="
|
205
|
+
- !ruby/object:Gem::Version
|
206
|
+
version: '0'
|
207
|
+
requirements: []
|
208
|
+
rubygems_version: 3.2.16
|
209
|
+
signing_key:
|
210
|
+
specification_version: 4
|
211
|
+
summary: Flash Integration Library
|
212
|
+
test_files:
|
213
|
+
- spec/flash/integration/connection_spec.rb
|
214
|
+
- spec/flash/integration/response_spec.rb
|
215
|
+
- spec/flash_integration_spec.rb
|
216
|
+
- spec/spec_helper.rb
|