neoway_auth 0.1.0.1
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.txt +22 -0
- data/README.md +116 -0
- data/Rakefile +48 -0
- data/lib/locales/en.yml +8 -0
- data/lib/locales/pt-BR.yml +8 -0
- data/lib/neoway/auth/authenticated_connection.rb +44 -0
- data/lib/neoway/auth/authenticated_resource.rb +11 -0
- data/lib/neoway/auth/authentication.rb +55 -0
- data/lib/neoway/auth/authentication_error.rb +8 -0
- data/lib/neoway/auth/bad_request_error.rb +8 -0
- data/lib/neoway/auth/base_error.rb +25 -0
- data/lib/neoway/auth/connection.rb +25 -0
- data/lib/neoway/auth/invalid_credentials_error.rb +8 -0
- data/lib/neoway/auth/result.rb +17 -0
- data/lib/neoway/auth/server_error.rb +8 -0
- data/lib/neoway/auth/unexpected_error.rb +8 -0
- data/lib/neoway/auth/version.rb +14 -0
- data/lib/neoway_auth.rb +48 -0
- data/spec/neoway_auth_spec.rb +43 -0
- data/spec/spec_helper.rb +37 -0
- metadata +289 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 9acdb36e688a7747a28b449af755a354887d218d7ed7f6dcf65d615c51051ec9
|
4
|
+
data.tar.gz: 7dd943a2457c92797ce19cb5ce536320bc763e51ba5f2ac459b2984cfb6bb4a7
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 78e2a43e5de5f7dd3abf56a55d75ea7973d84a247cf467d5f21e5dd6a4351d4f346f028fa62855a8013a4e5e19c729f83b1449b7a8f6f1d7b98512f6f6509ce2
|
7
|
+
data.tar.gz: 90c1ed5b3e9fe7e01bbddf822f54167b9f78b2b8458c63d397f907bfdd8d0f774a74d988525728ee887b0fd67f5921ab4ff00fe93124b096f0d993a074ea72fc
|
data/CHANGELOG.md
ADDED
data/LICENSE.txt
ADDED
@@ -0,0 +1,22 @@
|
|
1
|
+
Copyright (c) 2021 Quasar Flash
|
2
|
+
|
3
|
+
MIT LICENSE
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining
|
6
|
+
a copy of this software and associated documentation files (the
|
7
|
+
"Software"), to deal in the Software without restriction, including
|
8
|
+
without limitation the rights to use, copy, modify, merge, publish,
|
9
|
+
distribute, sublicense, and/or sell copies of the Software, and to
|
10
|
+
permit persons to whom the Software is furnished to do so, subject to
|
11
|
+
the following conditions:
|
12
|
+
|
13
|
+
The above copyright notice and this permission notice shall be
|
14
|
+
included in all copies or substantial portions of the Software.
|
15
|
+
|
16
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
17
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
18
|
+
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
|
19
|
+
NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
|
20
|
+
LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
|
21
|
+
OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
|
22
|
+
WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,116 @@
|
|
1
|
+
Neoway Auth's Library for Ruby
|
2
|
+
==============
|
3
|
+
|
4
|
+
[![Gem Version](https://badge.fury.io/rb/neoway_auth.svg)](https://badge.fury.io/rb/neoway_auth)
|
5
|
+
[![Build Status](https://travis-ci.com/Quasar-Flash/neoway-auth-ruby.svg?branch=master)](https://travis-ci.com/Quasar-Flash/neoway-auth-ruby)
|
6
|
+
|
7
|
+
Dev Requirements
|
8
|
+
-----------------
|
9
|
+
|
10
|
+
- Ruby: Any version
|
11
|
+
- Bundler
|
12
|
+
|
13
|
+
Global Installation
|
14
|
+
-----------------
|
15
|
+
|
16
|
+
```ruby
|
17
|
+
gem install neoway_auth
|
18
|
+
```
|
19
|
+
|
20
|
+
Installation for Rails
|
21
|
+
-----------------
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
# Add to the Gemfile
|
25
|
+
gem "neoway_auth", "~> 0.1.0"
|
26
|
+
```
|
27
|
+
|
28
|
+
Setting the Neoway configs - Rails Project
|
29
|
+
-----------------
|
30
|
+
|
31
|
+
Create the config/initializers/neoway.rb file and define:
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
# Set the env variables
|
35
|
+
Neoway.configure do |config|
|
36
|
+
config.application_name = "application_name"
|
37
|
+
config.application_secret = "application_secret"
|
38
|
+
config.base_url = "https://api.example.com" # optional - default: https://api.neoway.com.br
|
39
|
+
end
|
40
|
+
```
|
41
|
+
|
42
|
+
Applying an authentication
|
43
|
+
-----------------
|
44
|
+
|
45
|
+
```ruby
|
46
|
+
require 'neoway_auth'
|
47
|
+
|
48
|
+
auth = Neoway::Auth::Authentication.new
|
49
|
+
auth.login
|
50
|
+
```
|
51
|
+
|
52
|
+
Result example:
|
53
|
+
|
54
|
+
```ruby
|
55
|
+
#<Neoway::Auth::Result:0x00005605054895a8
|
56
|
+
@body=
|
57
|
+
"{\"token\":\"xxxxxxxxxxxxxxxxxxxxx\"}\n",
|
58
|
+
@headers=
|
59
|
+
{"server"=>"nginx",
|
60
|
+
"content-type"=>"application/json; charset=utf-8",
|
61
|
+
"content-length"=>"225",
|
62
|
+
"referrer-policy"=>"no-referrer",
|
63
|
+
"strict-transport-security"=>"max-age=31536000; includeSubdomains; preload",
|
64
|
+
"x-content-type-options"=>"nosniff",
|
65
|
+
"x-frame-options"=>"SAMEORIGIN",
|
66
|
+
"x-xss-protection"=>"1; mode=block",
|
67
|
+
"content-security-policy"=>"default-src 'none'",
|
68
|
+
"date"=>"Fri, 02 Jul 2021 02:36:06 GMT",
|
69
|
+
"connection"=>"keep-alive"},
|
70
|
+
@request=
|
71
|
+
#<Flash::Integration::Request:0x0000560504f99430
|
72
|
+
@body="{\"application\":\"xxx-app\",\"application_secret\":\"xxxxxx\"}",
|
73
|
+
@headers={:"Content-Type"=>"application/json", :Accept=>"application/json"},
|
74
|
+
@method=:post,
|
75
|
+
@params={},
|
76
|
+
@time=2021-07-02 02:36:06.458744646 UTC,
|
77
|
+
@url="https://api.neoway.com.br/auth/token">,
|
78
|
+
@status=200,
|
79
|
+
@time=2021-07-02 02:36:06.689160825 UTC>
|
80
|
+
```
|
81
|
+
|
82
|
+
Problems?
|
83
|
+
-----------------
|
84
|
+
|
85
|
+
**Please do not directly email any committers with questions or problems.**
|
86
|
+
A community is best served when discussions are held in public.
|
87
|
+
|
88
|
+
Searching the [issues](https://github.com/Quasar-Flash/neoway-auth-ruby/issues)
|
89
|
+
for your problem is also a good idea.
|
90
|
+
|
91
|
+
Contributing
|
92
|
+
-----------------
|
93
|
+
|
94
|
+
- Check out the latest master to make sure the feature hasn't been implemented
|
95
|
+
or the bug hasn't been fixed yet;
|
96
|
+
- Check out the issue tracker to make sure someone already hasn't requested it
|
97
|
+
and/or contributed it;
|
98
|
+
- Fork the project;
|
99
|
+
- Start a feature/bugfix branch;
|
100
|
+
- Commit and push until you are happy with your contribution;
|
101
|
+
- Make sure to add tests for it. This is important so I don't break it in a
|
102
|
+
future version unintentionally.;
|
103
|
+
- Please try not to mess with the Rakefile, version, or history. If you want to
|
104
|
+
have your own version, or is otherwise necessary, that is fine, but please
|
105
|
+
isolate to its own commit so I can cherry-pick around it.
|
106
|
+
|
107
|
+
License
|
108
|
+
-----------------
|
109
|
+
|
110
|
+
Please see [LICENSE](https://github.com/Quasar-Flash/neoway-auth-ruby/blob/master/LICENSE.txt)
|
111
|
+
for licensing details.
|
112
|
+
|
113
|
+
Authors
|
114
|
+
-----------------
|
115
|
+
|
116
|
+
Danilo Carolino, [@danilogco](https://github.com/danilogco) / [@Quasar-Flash](https://github.com/Quasar-Flash)
|
data/Rakefile
ADDED
@@ -0,0 +1,48 @@
|
|
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 = "neoway_auth"
|
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.options = ["--display-cop-names"]
|
35
|
+
end
|
36
|
+
rescue LoadError
|
37
|
+
# no rspec available
|
38
|
+
end
|
39
|
+
|
40
|
+
begin
|
41
|
+
require "rspec/core/rake_task"
|
42
|
+
|
43
|
+
RSpec::Core::RakeTask.new(:spec)
|
44
|
+
rescue LoadError
|
45
|
+
# no rspec available
|
46
|
+
end
|
47
|
+
|
48
|
+
task default: %i[rubocop spec]
|
data/lib/locales/en.yml
ADDED
@@ -0,0 +1,8 @@
|
|
1
|
+
en:
|
2
|
+
errors:
|
3
|
+
neoway:
|
4
|
+
auth:
|
5
|
+
authentication_error: An error ocurred during the authentication
|
6
|
+
bad_request_error: The request body or format is invalid
|
7
|
+
invalid_credentials_error: The credentials informed are invalid
|
8
|
+
server_error: An internal server error ocurred
|
@@ -0,0 +1,8 @@
|
|
1
|
+
pt-BR:
|
2
|
+
errors:
|
3
|
+
neoway:
|
4
|
+
auth:
|
5
|
+
authentication_error: Ocorreu um erro durante a autenticação
|
6
|
+
bad_request_error: O corpo ou formato da requisição é inválido
|
7
|
+
invalid_credentials_error: As credenciais informadas são inválidas
|
8
|
+
server_error: Ocorreu um erro inesperado no servidor
|
@@ -0,0 +1,44 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neoway
|
4
|
+
module Auth
|
5
|
+
class AuthenticatedConnection < Connection
|
6
|
+
COOKIE_CACHE_KEY = "NEOWAY_AUTHENTICATION_COOKIE_CACHE_KEY"
|
7
|
+
|
8
|
+
def initialize(authentication: Neoway::Auth::Authentication.new, cache: default_cache)
|
9
|
+
super(request_class: request_class, base_url: base_url)
|
10
|
+
|
11
|
+
@authentication = authentication
|
12
|
+
@cache = cache
|
13
|
+
@expiration_time = Neoway::Auth::TOKEN_EXPIRATION.seconds
|
14
|
+
end
|
15
|
+
|
16
|
+
def default_headers
|
17
|
+
super.merge(Authorization: (@cache ? cached_token : auth_token))
|
18
|
+
end
|
19
|
+
|
20
|
+
private
|
21
|
+
def auth_token
|
22
|
+
response = @authentication.login
|
23
|
+
|
24
|
+
extract_token(response.body)
|
25
|
+
end
|
26
|
+
|
27
|
+
def cached_token
|
28
|
+
@cache.fetch(COOKIE_CACHE_KEY, expires_in: @expiration_time) { auth_token }
|
29
|
+
end
|
30
|
+
|
31
|
+
def default_cache
|
32
|
+
defined?(Rails) ? Rails.cache : nil
|
33
|
+
end
|
34
|
+
|
35
|
+
def extract_token(value)
|
36
|
+
raise Neoway::Auth::AuthenticationError unless value
|
37
|
+
|
38
|
+
value_json = JSON.parse(value)
|
39
|
+
|
40
|
+
"Bearer #{value_json['token']}"
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
44
|
+
end
|
@@ -0,0 +1,55 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neoway
|
4
|
+
module Auth
|
5
|
+
class Authentication
|
6
|
+
def initialize(connection: Connection.new,
|
7
|
+
application_name: Neoway.configuration.application_name,
|
8
|
+
application_secret: Neoway.configuration.application_secret)
|
9
|
+
@application_name = application_name
|
10
|
+
@application_secret = application_secret
|
11
|
+
@connection = connection
|
12
|
+
end
|
13
|
+
|
14
|
+
def login(body: login_body)
|
15
|
+
res = @connection.post(url: Neoway::Auth::AUTH_ENDPOINT, body: body)
|
16
|
+
|
17
|
+
return parse_result(res) if res.status == 200
|
18
|
+
|
19
|
+
raise_error_by_status(res.status)
|
20
|
+
end
|
21
|
+
|
22
|
+
private
|
23
|
+
def login_body
|
24
|
+
raise Neoway::Auth::InvalidCredentialsError if @application_name.nil? || @application_secret.nil?
|
25
|
+
|
26
|
+
{
|
27
|
+
application: @application_name,
|
28
|
+
application_secret: @application_secret
|
29
|
+
}.to_json
|
30
|
+
end
|
31
|
+
|
32
|
+
def parse_result(res)
|
33
|
+
Neoway::Auth::Result.new(
|
34
|
+
body: res.body,
|
35
|
+
headers: res.headers,
|
36
|
+
request: res.request,
|
37
|
+
status: res.status,
|
38
|
+
time: res.time)
|
39
|
+
end
|
40
|
+
|
41
|
+
def raise_error_by_status(status)
|
42
|
+
case status.to_i
|
43
|
+
when 400
|
44
|
+
raise Neoway::Auth::BadRequestError
|
45
|
+
when 401
|
46
|
+
raise Neoway::Auth::InvalidCredentialsError
|
47
|
+
when 500
|
48
|
+
raise Neoway::Auth::ServerError
|
49
|
+
else
|
50
|
+
raise Neoway::Auth::UnexpectedError
|
51
|
+
end
|
52
|
+
end
|
53
|
+
end
|
54
|
+
end
|
55
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neoway
|
4
|
+
module Auth
|
5
|
+
class BaseError < StandardError
|
6
|
+
def initialize(message = self.class.default_message)
|
7
|
+
super(message)
|
8
|
+
end
|
9
|
+
|
10
|
+
def self.default_message
|
11
|
+
name = self.name.dup
|
12
|
+
|
13
|
+
I18n.t("errors.#{underscore(name)}")
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.underscore(str)
|
17
|
+
str.gsub(/::/, ".")
|
18
|
+
.gsub(/([A-Z]+)([A-Z][a-z])/, '\1_\2')
|
19
|
+
.gsub(/([a-z\d])([A-Z])/, '\1_\2')
|
20
|
+
.tr("-", "_")
|
21
|
+
.downcase
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,25 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neoway
|
4
|
+
module Auth
|
5
|
+
class Connection < Flash::Integration::Connection
|
6
|
+
def initialize(request_class: Faraday)
|
7
|
+
super(request_class: request_class, base_url: retrieve_base_url)
|
8
|
+
end
|
9
|
+
|
10
|
+
def default_headers
|
11
|
+
{
|
12
|
+
"Content-Type": "application/json",
|
13
|
+
"Accept": "application/json"
|
14
|
+
}
|
15
|
+
end
|
16
|
+
|
17
|
+
private
|
18
|
+
def retrieve_base_url(base_url = Neoway.configuration&.base_url)
|
19
|
+
return base_url if base_url
|
20
|
+
|
21
|
+
Neoway::BASE_URL
|
22
|
+
end
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
@@ -0,0 +1,17 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neoway
|
4
|
+
module Auth
|
5
|
+
class Result
|
6
|
+
attr_accessor :body, :headers, :request, :status, :time
|
7
|
+
|
8
|
+
def initialize(body:, headers:, request:, status:, time:)
|
9
|
+
@body = body
|
10
|
+
@headers = headers
|
11
|
+
@request = request
|
12
|
+
@status = status
|
13
|
+
@time = time
|
14
|
+
end
|
15
|
+
end
|
16
|
+
end
|
17
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
module Neoway
|
4
|
+
module Auth
|
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.1"
|
13
|
+
end
|
14
|
+
end
|
data/lib/neoway_auth.rb
ADDED
@@ -0,0 +1,48 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "faraday"
|
4
|
+
require "i18n"
|
5
|
+
require "json"
|
6
|
+
require "flash_integration"
|
7
|
+
|
8
|
+
require "neoway/auth/version"
|
9
|
+
require "neoway/auth/result"
|
10
|
+
require "neoway/auth/connection"
|
11
|
+
require "neoway/auth/authentication"
|
12
|
+
require "neoway/auth/authenticated_resource"
|
13
|
+
require "neoway/auth/authenticated_connection"
|
14
|
+
require "neoway/auth/base_error"
|
15
|
+
require "neoway/auth/authentication_error"
|
16
|
+
require "neoway/auth/bad_request_error"
|
17
|
+
require "neoway/auth/invalid_credentials_error"
|
18
|
+
require "neoway/auth/server_error"
|
19
|
+
|
20
|
+
I18n.load_path += Dir[File.join(__dir__, "locales", "**/*.yml")]
|
21
|
+
I18n.reload! if I18n.backend.initialized?
|
22
|
+
|
23
|
+
module Neoway
|
24
|
+
BASE_URL = "https://api.neoway.com.br"
|
25
|
+
|
26
|
+
class << self
|
27
|
+
attr_writer :configuration
|
28
|
+
|
29
|
+
def configuration
|
30
|
+
@configuration ||= Configuration.new
|
31
|
+
end
|
32
|
+
end
|
33
|
+
|
34
|
+
def self.configure
|
35
|
+
self.configuration ||= Configuration.new
|
36
|
+
|
37
|
+
yield(configuration)
|
38
|
+
end
|
39
|
+
|
40
|
+
class Configuration
|
41
|
+
attr_accessor :application_name, :application_secret, :base_url
|
42
|
+
end
|
43
|
+
|
44
|
+
module Auth
|
45
|
+
TOKEN_EXPIRATION = 60_000
|
46
|
+
AUTH_ENDPOINT = "auth/token"
|
47
|
+
end
|
48
|
+
end
|
@@ -0,0 +1,43 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "spec_helper"
|
4
|
+
|
5
|
+
RSpec.describe Neoway::Auth do
|
6
|
+
describe ".configure" do
|
7
|
+
before do
|
8
|
+
Neoway.configuration = nil
|
9
|
+
ENV.clear
|
10
|
+
end
|
11
|
+
|
12
|
+
subject { Neoway.configuration }
|
13
|
+
|
14
|
+
context "when configuration is defined" do
|
15
|
+
before do
|
16
|
+
Neoway.configure do |config|
|
17
|
+
config.application_name = "application_name"
|
18
|
+
config.application_secret = "application_secret"
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
it { expect(subject).not_to be_nil }
|
23
|
+
|
24
|
+
it { expect(subject.application_name).to eq("application_name") }
|
25
|
+
|
26
|
+
it { expect(subject.application_secret).to eq("application_secret") }
|
27
|
+
end
|
28
|
+
|
29
|
+
context "when configuration is not defined" do
|
30
|
+
it { expect(subject).not_to be_nil }
|
31
|
+
|
32
|
+
it { expect(subject.application_name).to be_nil }
|
33
|
+
|
34
|
+
it { expect(subject.application_secret).to be_nil }
|
35
|
+
end
|
36
|
+
|
37
|
+
describe "I18n calls" do
|
38
|
+
it { expect(I18n.default_locale).to eq(:en) }
|
39
|
+
|
40
|
+
it { expect(I18n.config.available_locales).to contain_exactly(:en, :'pt-BR') }
|
41
|
+
end
|
42
|
+
end
|
43
|
+
end
|
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
require "simplecov"
|
4
|
+
|
5
|
+
SimpleCov.formatters = [SimpleCov::Formatter::HTMLFormatter]
|
6
|
+
|
7
|
+
SimpleCov.start do
|
8
|
+
add_filter "/spec/"
|
9
|
+
minimum_coverage 50
|
10
|
+
minimum_coverage_by_file 30
|
11
|
+
end
|
12
|
+
|
13
|
+
require "neoway_auth"
|
14
|
+
|
15
|
+
Dir["./spec/support/**/*.rb"].each { |f| require f }
|
16
|
+
Dir["./spec/initializers/**/*.rb"].each { |f| require f }
|
17
|
+
|
18
|
+
require "bundler"
|
19
|
+
require "pry"
|
20
|
+
|
21
|
+
begin
|
22
|
+
Bundler.setup(:default, :development, :test)
|
23
|
+
rescue Bundler::BundlerError => e
|
24
|
+
warn e.message
|
25
|
+
warn "Run `bundle install` to install missing gems"
|
26
|
+
|
27
|
+
exit e.status_code
|
28
|
+
end
|
29
|
+
|
30
|
+
RSpec.configure do |config|
|
31
|
+
# Enable flags like --only-failures and --next-failure
|
32
|
+
config.example_status_persistence_file_path = ".rspec_status"
|
33
|
+
|
34
|
+
config.expect_with :rspec do |c|
|
35
|
+
c.syntax = :expect
|
36
|
+
end
|
37
|
+
end
|
metadata
ADDED
@@ -0,0 +1,289 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: neoway_auth
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0.1
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Danilo Carolino
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2021-07-02 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'
|
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'
|
30
|
+
- - ">="
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '1.0'
|
33
|
+
- !ruby/object:Gem::Dependency
|
34
|
+
name: flash_integration
|
35
|
+
requirement: !ruby/object:Gem::Requirement
|
36
|
+
requirements:
|
37
|
+
- - "~>"
|
38
|
+
- !ruby/object:Gem::Version
|
39
|
+
version: '0.1'
|
40
|
+
type: :runtime
|
41
|
+
prerelease: false
|
42
|
+
version_requirements: !ruby/object:Gem::Requirement
|
43
|
+
requirements:
|
44
|
+
- - "~>"
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: '0.1'
|
47
|
+
- !ruby/object:Gem::Dependency
|
48
|
+
name: i18n
|
49
|
+
requirement: !ruby/object:Gem::Requirement
|
50
|
+
requirements:
|
51
|
+
- - "~>"
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: '1.8'
|
54
|
+
- - ">="
|
55
|
+
- !ruby/object:Gem::Version
|
56
|
+
version: '1.0'
|
57
|
+
type: :runtime
|
58
|
+
prerelease: false
|
59
|
+
version_requirements: !ruby/object:Gem::Requirement
|
60
|
+
requirements:
|
61
|
+
- - "~>"
|
62
|
+
- !ruby/object:Gem::Version
|
63
|
+
version: '1.8'
|
64
|
+
- - ">="
|
65
|
+
- !ruby/object:Gem::Version
|
66
|
+
version: '1.0'
|
67
|
+
- !ruby/object:Gem::Dependency
|
68
|
+
name: json
|
69
|
+
requirement: !ruby/object:Gem::Requirement
|
70
|
+
requirements:
|
71
|
+
- - "~>"
|
72
|
+
- !ruby/object:Gem::Version
|
73
|
+
version: '2.5'
|
74
|
+
- - ">="
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '2.0'
|
77
|
+
type: :runtime
|
78
|
+
prerelease: false
|
79
|
+
version_requirements: !ruby/object:Gem::Requirement
|
80
|
+
requirements:
|
81
|
+
- - "~>"
|
82
|
+
- !ruby/object:Gem::Version
|
83
|
+
version: '2.5'
|
84
|
+
- - ">="
|
85
|
+
- !ruby/object:Gem::Version
|
86
|
+
version: '2.0'
|
87
|
+
- !ruby/object:Gem::Dependency
|
88
|
+
name: bundler
|
89
|
+
requirement: !ruby/object:Gem::Requirement
|
90
|
+
requirements:
|
91
|
+
- - ">="
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '1.2'
|
94
|
+
type: :development
|
95
|
+
prerelease: false
|
96
|
+
version_requirements: !ruby/object:Gem::Requirement
|
97
|
+
requirements:
|
98
|
+
- - ">="
|
99
|
+
- !ruby/object:Gem::Version
|
100
|
+
version: '1.2'
|
101
|
+
- !ruby/object:Gem::Dependency
|
102
|
+
name: factory_bot
|
103
|
+
requirement: !ruby/object:Gem::Requirement
|
104
|
+
requirements:
|
105
|
+
- - "~>"
|
106
|
+
- !ruby/object:Gem::Version
|
107
|
+
version: '6.2'
|
108
|
+
type: :development
|
109
|
+
prerelease: false
|
110
|
+
version_requirements: !ruby/object:Gem::Requirement
|
111
|
+
requirements:
|
112
|
+
- - "~>"
|
113
|
+
- !ruby/object:Gem::Version
|
114
|
+
version: '6.2'
|
115
|
+
- !ruby/object:Gem::Dependency
|
116
|
+
name: fuubar
|
117
|
+
requirement: !ruby/object:Gem::Requirement
|
118
|
+
requirements:
|
119
|
+
- - "~>"
|
120
|
+
- !ruby/object:Gem::Version
|
121
|
+
version: '2.5'
|
122
|
+
type: :development
|
123
|
+
prerelease: false
|
124
|
+
version_requirements: !ruby/object:Gem::Requirement
|
125
|
+
requirements:
|
126
|
+
- - "~>"
|
127
|
+
- !ruby/object:Gem::Version
|
128
|
+
version: '2.5'
|
129
|
+
- !ruby/object:Gem::Dependency
|
130
|
+
name: pry
|
131
|
+
requirement: !ruby/object:Gem::Requirement
|
132
|
+
requirements:
|
133
|
+
- - "~>"
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0.14'
|
136
|
+
type: :development
|
137
|
+
prerelease: false
|
138
|
+
version_requirements: !ruby/object:Gem::Requirement
|
139
|
+
requirements:
|
140
|
+
- - "~>"
|
141
|
+
- !ruby/object:Gem::Version
|
142
|
+
version: '0.14'
|
143
|
+
- !ruby/object:Gem::Dependency
|
144
|
+
name: rake
|
145
|
+
requirement: !ruby/object:Gem::Requirement
|
146
|
+
requirements:
|
147
|
+
- - "~>"
|
148
|
+
- !ruby/object:Gem::Version
|
149
|
+
version: '13.0'
|
150
|
+
- - ">="
|
151
|
+
- !ruby/object:Gem::Version
|
152
|
+
version: 10.0.0
|
153
|
+
type: :development
|
154
|
+
prerelease: false
|
155
|
+
version_requirements: !ruby/object:Gem::Requirement
|
156
|
+
requirements:
|
157
|
+
- - "~>"
|
158
|
+
- !ruby/object:Gem::Version
|
159
|
+
version: '13.0'
|
160
|
+
- - ">="
|
161
|
+
- !ruby/object:Gem::Version
|
162
|
+
version: 10.0.0
|
163
|
+
- !ruby/object:Gem::Dependency
|
164
|
+
name: rspec
|
165
|
+
requirement: !ruby/object:Gem::Requirement
|
166
|
+
requirements:
|
167
|
+
- - "~>"
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '3.10'
|
170
|
+
type: :development
|
171
|
+
prerelease: false
|
172
|
+
version_requirements: !ruby/object:Gem::Requirement
|
173
|
+
requirements:
|
174
|
+
- - "~>"
|
175
|
+
- !ruby/object:Gem::Version
|
176
|
+
version: '3.10'
|
177
|
+
- !ruby/object:Gem::Dependency
|
178
|
+
name: rubocop
|
179
|
+
requirement: !ruby/object:Gem::Requirement
|
180
|
+
requirements:
|
181
|
+
- - "~>"
|
182
|
+
- !ruby/object:Gem::Version
|
183
|
+
version: '1.18'
|
184
|
+
type: :development
|
185
|
+
prerelease: false
|
186
|
+
version_requirements: !ruby/object:Gem::Requirement
|
187
|
+
requirements:
|
188
|
+
- - "~>"
|
189
|
+
- !ruby/object:Gem::Version
|
190
|
+
version: '1.18'
|
191
|
+
- !ruby/object:Gem::Dependency
|
192
|
+
name: rubocop-packaging
|
193
|
+
requirement: !ruby/object:Gem::Requirement
|
194
|
+
requirements:
|
195
|
+
- - "~>"
|
196
|
+
- !ruby/object:Gem::Version
|
197
|
+
version: '0.5'
|
198
|
+
type: :development
|
199
|
+
prerelease: false
|
200
|
+
version_requirements: !ruby/object:Gem::Requirement
|
201
|
+
requirements:
|
202
|
+
- - "~>"
|
203
|
+
- !ruby/object:Gem::Version
|
204
|
+
version: '0.5'
|
205
|
+
- !ruby/object:Gem::Dependency
|
206
|
+
name: rubocop-performance
|
207
|
+
requirement: !ruby/object:Gem::Requirement
|
208
|
+
requirements:
|
209
|
+
- - "~>"
|
210
|
+
- !ruby/object:Gem::Version
|
211
|
+
version: '1.11'
|
212
|
+
type: :development
|
213
|
+
prerelease: false
|
214
|
+
version_requirements: !ruby/object:Gem::Requirement
|
215
|
+
requirements:
|
216
|
+
- - "~>"
|
217
|
+
- !ruby/object:Gem::Version
|
218
|
+
version: '1.11'
|
219
|
+
- !ruby/object:Gem::Dependency
|
220
|
+
name: simplecov
|
221
|
+
requirement: !ruby/object:Gem::Requirement
|
222
|
+
requirements:
|
223
|
+
- - "~>"
|
224
|
+
- !ruby/object:Gem::Version
|
225
|
+
version: '0.21'
|
226
|
+
type: :development
|
227
|
+
prerelease: false
|
228
|
+
version_requirements: !ruby/object:Gem::Requirement
|
229
|
+
requirements:
|
230
|
+
- - "~>"
|
231
|
+
- !ruby/object:Gem::Version
|
232
|
+
version: '0.21'
|
233
|
+
description: A library to use Neoway auth features
|
234
|
+
email:
|
235
|
+
- danilo.carolino@qflash.com.br
|
236
|
+
executables: []
|
237
|
+
extensions: []
|
238
|
+
extra_rdoc_files: []
|
239
|
+
files:
|
240
|
+
- CHANGELOG.md
|
241
|
+
- LICENSE.txt
|
242
|
+
- README.md
|
243
|
+
- Rakefile
|
244
|
+
- lib/locales/en.yml
|
245
|
+
- lib/locales/pt-BR.yml
|
246
|
+
- lib/neoway/auth/authenticated_connection.rb
|
247
|
+
- lib/neoway/auth/authenticated_resource.rb
|
248
|
+
- lib/neoway/auth/authentication.rb
|
249
|
+
- lib/neoway/auth/authentication_error.rb
|
250
|
+
- lib/neoway/auth/bad_request_error.rb
|
251
|
+
- lib/neoway/auth/base_error.rb
|
252
|
+
- lib/neoway/auth/connection.rb
|
253
|
+
- lib/neoway/auth/invalid_credentials_error.rb
|
254
|
+
- lib/neoway/auth/result.rb
|
255
|
+
- lib/neoway/auth/server_error.rb
|
256
|
+
- lib/neoway/auth/unexpected_error.rb
|
257
|
+
- lib/neoway/auth/version.rb
|
258
|
+
- lib/neoway_auth.rb
|
259
|
+
- spec/neoway_auth_spec.rb
|
260
|
+
- spec/spec_helper.rb
|
261
|
+
homepage: https://github.com/Quasar-Flash/neoway-auth-ruby
|
262
|
+
licenses:
|
263
|
+
- MIT
|
264
|
+
metadata:
|
265
|
+
changelog_uri: https://github.com/Quasar-Flash/neoway-auth-ruby/blob/master/CHANGELOG.md
|
266
|
+
source_code_uri: https://github.com/Quasar-Flash/neoway-auth-ruby
|
267
|
+
bug_tracker_uri: https://github.com/Quasar-Flash/neoway-auth-ruby/issues
|
268
|
+
post_install_message:
|
269
|
+
rdoc_options: []
|
270
|
+
require_paths:
|
271
|
+
- lib
|
272
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
273
|
+
requirements:
|
274
|
+
- - ">="
|
275
|
+
- !ruby/object:Gem::Version
|
276
|
+
version: '2.5'
|
277
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
278
|
+
requirements:
|
279
|
+
- - ">="
|
280
|
+
- !ruby/object:Gem::Version
|
281
|
+
version: '0'
|
282
|
+
requirements: []
|
283
|
+
rubygems_version: 3.2.16
|
284
|
+
signing_key:
|
285
|
+
specification_version: 4
|
286
|
+
summary: Neoway Auth Library
|
287
|
+
test_files:
|
288
|
+
- spec/neoway_auth_spec.rb
|
289
|
+
- spec/spec_helper.rb
|