bigid_auth 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml ADDED
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: 2de69a3a8e79498bdbbd8f42581b050cefd23994aecc8eba211b96769ee7f713
4
+ data.tar.gz: 4874fbf692c691a47837623e08872f91a534125063bf110a5047faed6527f28c
5
+ SHA512:
6
+ metadata.gz: f84e0666522ac76565b3a5dfe1f36d5eec5f5962a30f8072ff0d737e73cff5bbe180124938b05c4adb22218acaeb3bb4b400805d6f97182008a4fe2f25341424
7
+ data.tar.gz: e1ce0d03e9ff4e70154410c0340af8c83018a699676ce9addc97ee62f2ba9f94d57406cd6459b49bdd192d91a9a07a41ba7290263156a9dcb52ed0c9a3d88029
data/CHANGELOG.md ADDED
@@ -0,0 +1,5 @@
1
+ # CHANGELOG
2
+
3
+ ## v0.1.0
4
+
5
+ * Initial release of Bigid Auth
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,90 @@
1
+ BigId Auth's Library for Ruby
2
+ ==============
3
+
4
+ [![Gem Version](https://badge.fury.io/rb/bigid_auth.svg)](https://badge.fury.io/rb/bigid_auth)
5
+ [![Build Status](https://travis-ci.com/Quasar-Flash/bigid-auth-ruby.svg?branch=master)](https://travis-ci.com/Quasar-Flash/bigid-auth-ruby)
6
+
7
+ Dev Requirements
8
+ -----------------
9
+
10
+ - Ruby: Any version
11
+ - Bundler
12
+
13
+ Global Installation
14
+ -----------------
15
+
16
+ gem install bigid_auth
17
+
18
+ Installation for Rails
19
+ -----------------
20
+
21
+ # Add to the Gemfile
22
+ gem 'bigid_auth', '~> 0.1.0'
23
+
24
+ Setting the BigID credentials
25
+ -----------------
26
+
27
+ # Set the env variables
28
+ ENV['BIGID_USERNAME'] = 'your_username'
29
+ ENV['BIGID_PASSWORD'] = 'your_password'
30
+
31
+ Setting the BigID credentials - Rails Project
32
+ -----------------
33
+
34
+ Create the config/initializers/bigid.rb file and define:
35
+
36
+ # Set the env variables
37
+ Bigid.configure do |config|
38
+ config.username = 'your_username'
39
+ config.password = 'your_password'
40
+ end
41
+
42
+ Applying an authentication
43
+ -----------------
44
+
45
+ require 'bigid_auth'
46
+
47
+ auth = Bigid::Auth::Authentication.new
48
+ auth.login
49
+
50
+ Result Example
51
+ -----------------
52
+
53
+ #<Bigid::Auth::Integration::Response:0x0000564181d2bef0
54
+ @request=#<Bigid::Auth::Integration::Request:0x0000564181d76a18
55
+ @method=:post,
56
+ @url="https://accesstoken.bigdatacorp.com.br/Generate",
57
+ @params={},
58
+ @headers={:"Content-Type"=>"application/json", :Accept=>"application/json"},
59
+ @body="{\"login\":\"username\",\"password\":\"crtvreru\",\"expires\":60000}",
60
+ @time=2021-04-18 18:55:24.678349974 UTC>,
61
+ @status=200,
62
+ @body="{\"expiration\":\"Mon, 21 Feb 2028 18:55:24 GMT\",\"message\":\"Token Generated\",\"success\":true,\"token\":\"xxxxxxxxxxxx\",\"tokenID\":\"0000000000\"}\n", @time=2021-04-18 18:55:24.995163484 UTC>
63
+
64
+ Problems?
65
+ -----------------
66
+
67
+ **Please do not directly email any committers with questions or problems.** A community is best served when discussions are held in public.
68
+
69
+ Searching the [issues](https://github.com/Quasar-Flash/bigid-auth-ruby/issues) for your problem is also a good idea.
70
+
71
+ Contributing
72
+ -----------------
73
+
74
+ - Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet;
75
+ - Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it;
76
+ - Fork the project;
77
+ - Start a feature/bugfix branch;
78
+ - Commit and push until you are happy with your contribution;
79
+ - Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.;
80
+ - 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.
81
+
82
+ License
83
+ -----------------
84
+
85
+ Please see [LICENSE](https://github.com/Quasar-Flash/bigid-auth-ruby/blob/master/LICENSE.txt) for licensing details.
86
+
87
+ Authors
88
+ -----------------
89
+
90
+ 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 = "bigid_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 ]
@@ -0,0 +1,43 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bigid
4
+ module Auth
5
+ class AuthenticatedConnection < Connection
6
+ COOKIE_CACHE_KEY = "BIG_ID_AUTHENTICATION_COOKIE_CACHE_KEY"
7
+
8
+ def initialize(authentication: Bigid::Auth::Authentication.new,
9
+ cache: defined?(Rails) ? Rails.cache : nil,
10
+ request_class: Faraday,
11
+ base_url: Bigid::BASE_URL,
12
+ token_expiration_time_in_seconds: Bigid::Auth::TOKEN_EXPIRATION)
13
+ super(request_class: request_class, base_url: base_url)
14
+ @authentication = authentication
15
+ @cache = cache
16
+ @token_expiration_time_in_seconds = token_expiration_time_in_seconds
17
+ end
18
+
19
+ def default_headers
20
+ super.merge(Authorization: (@cache ? cached_token : auth_token))
21
+ end
22
+
23
+ private
24
+ def auth_token
25
+ response = @authentication.login
26
+ extract_token(response.body)
27
+ end
28
+
29
+ def cached_token
30
+ @cache.fetch(COOKIE_CACHE_KEY, expires_in: @token_expiration_time_in_seconds.seconds) do
31
+ auth_token
32
+ end
33
+ end
34
+
35
+ def extract_token(value)
36
+ raise Bigid::Auth::AuthenticationError unless value
37
+
38
+ value_json = JSON.parse(value)
39
+ "Bearer #{value_json['token']}"
40
+ end
41
+ end
42
+ end
43
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bigid
4
+ module Auth
5
+ class AuthenticatedResource
6
+ def initialize(connection: AuthenticatedConnection.new)
7
+ @connection = connection
8
+ end
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,36 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bigid
4
+ module Auth
5
+ class Authentication
6
+ def initialize(connection: Connection.new,
7
+ username: Bigid.configuration.username,
8
+ password: Bigid.configuration.password,
9
+ token_expiration_time_in_seconds: Bigid::Auth::AUTH_ENDPOINT)
10
+ @connection = connection
11
+ @token_expiration_time_in_seconds = Bigid::Auth::TOKEN_EXPIRATION
12
+ @username = username
13
+ @password = password
14
+ end
15
+
16
+ def login
17
+ res = @connection.post(url: "Generate", body: login_body)
18
+
19
+ return res if res.status == 200
20
+
21
+ raise Bigid::Auth::InvalidCredentialsError if res.status == 401
22
+ raise Bigid::Auth::BadRequestError if res.status == 400
23
+ raise Bigid::Auth::ServerError if res.status == 500
24
+ end
25
+
26
+ private
27
+ def login_body
28
+ {
29
+ login: @username,
30
+ password: @password,
31
+ expires: @token_expiration_time_in_seconds.to_i
32
+ }.to_json
33
+ end
34
+ end
35
+ end
36
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bigid
4
+ module Auth
5
+ class AuthenticationError < BaseError
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bigid
4
+ module Auth
5
+ class BadRequestError < BaseError
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bigid
4
+ module Auth
5
+ class BaseError < StandardError
6
+ def initialize(message = self.class.default_message)
7
+ super
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,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bigid
4
+ module Auth
5
+ class Connection < Bigid::Auth::Integration::Connection
6
+ def initialize(request_class: Faraday, base_url: Bigid::Auth::AUTH_ENDPOINT)
7
+ super(request_class: request_class, base_url: base_url)
8
+ end
9
+
10
+ def default_headers
11
+ {
12
+ 'Content-Type': "application/json",
13
+ 'Accept': "application/json"
14
+ }
15
+ end
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,120 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bigid
4
+ module Auth
5
+ module Integration
6
+ class Connection
7
+ attr_reader :base_url
8
+
9
+ def initialize(base_url:, request_class: Faraday)
10
+ @request_class = request_class
11
+ @base_url = base_url
12
+ end
13
+
14
+ def get(url: "", params: {}, headers: {})
15
+ send_request(
16
+ method: :get,
17
+ url: url,
18
+ params: params,
19
+ headers: headers
20
+ )
21
+ end
22
+
23
+ def post(url: "", params: {}, headers: {}, body: {}, multipart: false)
24
+ send_request(
25
+ method: :post,
26
+ url: url,
27
+ params: params,
28
+ headers: headers,
29
+ body: body,
30
+ multipart: multipart
31
+ )
32
+ end
33
+
34
+ def put(url: "", params: {}, headers: {}, body: {})
35
+ send_request(
36
+ method: :put,
37
+ url: url,
38
+ params: params,
39
+ headers: headers,
40
+ body: body
41
+ )
42
+ end
43
+
44
+ def patch(url: "", params: {}, headers: {}, body: {})
45
+ send_request(
46
+ method: :patch,
47
+ url: url,
48
+ params: params,
49
+ headers: headers,
50
+ body: body
51
+ )
52
+ end
53
+
54
+ def delete(url: "", params: {}, headers: {}, body: {})
55
+ send_request(
56
+ method: :delete,
57
+ url: url,
58
+ params: params,
59
+ headers: headers,
60
+ body: body
61
+ )
62
+ end
63
+
64
+ def default_headers
65
+ {}
66
+ end
67
+
68
+ private
69
+ def send_request(method:, url:, params:, headers:, body: nil, multipart: false)
70
+ connection = multipart ? multipart_connection : @request_class.new(url: @base_url)
71
+
72
+ merged_headers = default_headers.merge(headers)
73
+
74
+ request = build_request(
75
+ method, connection.build_url(url).to_s, params, merged_headers, body
76
+ )
77
+
78
+ result =
79
+ connection.send(method) do |request|
80
+ request.url(url)
81
+ request.params = params
82
+ request.headers = merged_headers
83
+ request.body = body if body
84
+ end
85
+
86
+ build_response(request, result.status, result.headers, result.body)
87
+ end
88
+
89
+ def multipart_connection
90
+ @request_class.new(url: @base_url) do |conn|
91
+ conn.use Bigid::Auth::Integration::MultipartFlat
92
+ conn.request :url_encoded
93
+ conn.adapter @request_class.default_adapter
94
+ end
95
+ end
96
+
97
+ def build_request(method, url, params, headers, body)
98
+ Bigid::Auth::Integration::Request.new(
99
+ method: method,
100
+ url: url,
101
+ params: params,
102
+ headers: headers,
103
+ body: body,
104
+ time: Time.now.utc
105
+ )
106
+ end
107
+
108
+ def build_response(request, status, headers, body)
109
+ Bigid::Auth::Integration::Response.new(
110
+ request: request,
111
+ status: status,
112
+ headers: headers,
113
+ body: body,
114
+ time: Time.now.utc
115
+ )
116
+ end
117
+ end
118
+ end
119
+ end
120
+ end
@@ -0,0 +1,28 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bigid
4
+ module Auth
5
+ module Integration
6
+ class MultipartFlat < Faraday::Request::Multipart
7
+ self.mime_type = "multipart/form-data"
8
+ DEFAULT_BOUNDARY_PREFIX = "-----------RubyMultipartPost" unless defined? DEFAULT_BOUNDARY_PREFIX
9
+
10
+ def process_params(params, prefix = nil, pieces = nil, &block)
11
+ params.inject(pieces || []) do |all, (key, value)|
12
+ key = prefix.to_s if prefix
13
+
14
+ case value
15
+ when Array
16
+ values = value.inject([]) { |a, v| a << [nil, v] }
17
+ process_params(values, key, all, &block)
18
+ when Hash
19
+ process_params(value, key, all, &block)
20
+ else
21
+ all << block.call(key, value)
22
+ end
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
28
+ end
@@ -0,0 +1,20 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bigid
4
+ module Auth
5
+ module Integration
6
+ class Request
7
+ attr_reader :method, :url, :params, :headers, :body, :time
8
+
9
+ def initialize(attributes)
10
+ @method = attributes.fetch(:method)
11
+ @url = attributes.fetch(:url)
12
+ @params = attributes[:params] || {}
13
+ @headers = attributes[:headers] || {}
14
+ @body = attributes[:body] || {}
15
+ @time = attributes[:time] || Time.current
16
+ end
17
+ end
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,27 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bigid
4
+ module Auth
5
+ module Integration
6
+ class Response
7
+ attr_reader :request, :status, :headers, :body, :time
8
+
9
+ def initialize(attributes)
10
+ @request = attributes.fetch(:request)
11
+ @status = attributes.fetch(:status)
12
+ @headers = attributes[:headers] || {}
13
+ @body = attributes[:body] || {}
14
+ @time = attributes[:time] || Time.current
15
+ end
16
+
17
+ def success?
18
+ @status.between?(200, 299)
19
+ end
20
+
21
+ def error?
22
+ !success?
23
+ end
24
+ end
25
+ end
26
+ end
27
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bigid
4
+ module Auth
5
+ class InvalidCredentialsError < BaseError
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bigid
4
+ module Auth
5
+ class ServerError < BaseError
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,14 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Bigid
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"
13
+ end
14
+ end
data/lib/bigid_auth.rb ADDED
@@ -0,0 +1,62 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "faraday"
4
+ require "i18n"
5
+ require "json"
6
+
7
+ require "bigid/auth/version"
8
+
9
+ require "bigid/auth/integration/multipart_flat"
10
+ require "bigid/auth/integration/response"
11
+ require "bigid/auth/integration/request"
12
+ require "bigid/auth/integration/connection"
13
+
14
+ require "bigid/auth/connection"
15
+ require "bigid/auth/authentication"
16
+ require "bigid/auth/authenticated_resource"
17
+ require "bigid/auth/authenticated_connection"
18
+
19
+ require "bigid/auth/base_error"
20
+ require "bigid/auth/authentication_error"
21
+ require "bigid/auth/bad_request_error"
22
+ require "bigid/auth/invalid_credentials_error"
23
+ require "bigid/auth/server_error"
24
+
25
+ module Bigid
26
+ BASE_URL = "https://bigid.bigdatacorp.com.br"
27
+
28
+ class << self
29
+ attr_writer :configuration
30
+
31
+ def configuration
32
+ @configuration ||= Configuration.new
33
+ end
34
+ end
35
+
36
+ def self.configure
37
+ self.configuration ||= Configuration.new
38
+
39
+ yield(configuration)
40
+ end
41
+
42
+ class Configuration
43
+ attr_writer :username, :password
44
+
45
+ def username
46
+ @username ||= ENV["BIGID_USERNAME"]
47
+ end
48
+
49
+ def password
50
+ @password ||= ENV["BIGID_PASSWORD"]
51
+ end
52
+ end
53
+
54
+ module Auth
55
+ AUTH_ENDPOINT = "https://accesstoken.bigdatacorp.com.br"
56
+ TOKEN_EXPIRATION = 60_000
57
+
58
+ I18n.load_path << Dir["#{File.expand_path('config/locales')}/*.yml"]
59
+ I18n.config.available_locales = :en, :'pt-BR'
60
+ I18n.default_locale = :en
61
+ end
62
+ end
@@ -0,0 +1,87 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "spec_helper"
4
+ require "bigid_auth"
5
+
6
+ RSpec.describe Bigid::Auth do
7
+ describe "AUTH_ENDPOINT" do
8
+ subject { defined? Bigid::Auth::AUTH_ENDPOINT }
9
+
10
+ it { expect(subject).to be_truthy }
11
+ end
12
+
13
+ describe "TOKEN_EXPIRATION" do
14
+ subject { defined? Bigid::Auth::TOKEN_EXPIRATION }
15
+
16
+ it { expect(subject).to be_truthy }
17
+ end
18
+
19
+ describe ".configure" do
20
+ before do
21
+ described_class.configuration = nil
22
+ ENV.clear
23
+ end
24
+
25
+ subject { described_class.configuration }
26
+
27
+ context "when configuration is defined" do
28
+ before do
29
+ described_class.configure do |config|
30
+ config.username = "username_value"
31
+ config.password = "password_value"
32
+ end
33
+ end
34
+
35
+ it { expect(subject).not_to be_nil }
36
+
37
+ it { expect(subject.username).to eq("username_value") }
38
+
39
+ it { expect(subject.password).to eq("password_value") }
40
+ end
41
+
42
+ context "when configuration is not defined" do
43
+ it { expect(subject).not_to be_nil }
44
+
45
+ it { expect(subject.username).to be_nil }
46
+
47
+ it { expect(subject.password).to be_nil }
48
+ end
49
+
50
+ context "when its configured by envs" do
51
+ before do
52
+ ENV["BIGID_USERNAME"] = "username_value"
53
+ ENV["BIGID_PASSWORD"] = "password_value"
54
+ end
55
+
56
+ it { expect(subject).not_to be_nil }
57
+
58
+ it { expect(subject.username).to eq("username_value") }
59
+
60
+ it { expect(subject.password).to eq("password_value") }
61
+ end
62
+
63
+ context "when its envs configured and configs setted" do
64
+ before do
65
+ ENV["BIGID_USERNAME"] = "username_value"
66
+ ENV["BIGID_PASSWORD"] = "password_value"
67
+
68
+ described_class.configure do |config|
69
+ config.username = "username_value2"
70
+ config.password = "password_value2"
71
+ end
72
+ end
73
+
74
+ it { expect(subject).not_to be_nil }
75
+
76
+ it { expect(subject.username).to eq("username_value2") }
77
+
78
+ it { expect(subject.password).to eq("password_value2") }
79
+ end
80
+
81
+ describe "I18n calls" do
82
+ it { expect(I18n.default_locale).to eq(:en) }
83
+
84
+ it { expect(I18n.config.available_locales).to contain_exactly(:en, :'pt-BR') }
85
+ end
86
+ end
87
+ end
@@ -0,0 +1,25 @@
1
+ # frozen_string_literal: true
2
+
3
+ require "rubygems"
4
+ require "bundler"
5
+
6
+ begin
7
+ Bundler.setup(:default, :development, :test)
8
+ rescue Bundler::BundlerError => e
9
+ warn e.message
10
+ warn "Run `bundle install` to install missing gems"
11
+
12
+ exit e.status_code
13
+ end
14
+
15
+ require "simplecov"
16
+
17
+ SimpleCov.start do
18
+ add_filter "spec"
19
+ end
20
+
21
+ RSpec.configure do |config|
22
+ # some (optional) config here
23
+ end
24
+
25
+ # minitest/mock # Uncomment me to use minitest mocks
metadata ADDED
@@ -0,0 +1,272 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: bigid_auth
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-18 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.0
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.0
30
+ - - ">="
31
+ - !ruby/object:Gem::Version
32
+ version: '1.0'
33
+ - !ruby/object:Gem::Dependency
34
+ name: i18n
35
+ requirement: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - "~>"
38
+ - !ruby/object:Gem::Version
39
+ version: 1.8.0
40
+ - - ">="
41
+ - !ruby/object:Gem::Version
42
+ version: '1.0'
43
+ type: :runtime
44
+ prerelease: false
45
+ version_requirements: !ruby/object:Gem::Requirement
46
+ requirements:
47
+ - - "~>"
48
+ - !ruby/object:Gem::Version
49
+ version: 1.8.0
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '1.0'
53
+ - !ruby/object:Gem::Dependency
54
+ name: json
55
+ requirement: !ruby/object:Gem::Requirement
56
+ requirements:
57
+ - - "~>"
58
+ - !ruby/object:Gem::Version
59
+ version: 2.5.0
60
+ - - ">="
61
+ - !ruby/object:Gem::Version
62
+ version: '2.0'
63
+ type: :runtime
64
+ prerelease: false
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - "~>"
68
+ - !ruby/object:Gem::Version
69
+ version: 2.5.0
70
+ - - ">="
71
+ - !ruby/object:Gem::Version
72
+ version: '2.0'
73
+ - !ruby/object:Gem::Dependency
74
+ name: bundler
75
+ requirement: !ruby/object:Gem::Requirement
76
+ requirements:
77
+ - - ">="
78
+ - !ruby/object:Gem::Version
79
+ version: 1.2.0
80
+ type: :development
81
+ prerelease: false
82
+ version_requirements: !ruby/object:Gem::Requirement
83
+ requirements:
84
+ - - ">="
85
+ - !ruby/object:Gem::Version
86
+ version: 1.2.0
87
+ - !ruby/object:Gem::Dependency
88
+ name: factory_bot
89
+ requirement: !ruby/object:Gem::Requirement
90
+ requirements:
91
+ - - "~>"
92
+ - !ruby/object:Gem::Version
93
+ version: 6.1.0
94
+ type: :development
95
+ prerelease: false
96
+ version_requirements: !ruby/object:Gem::Requirement
97
+ requirements:
98
+ - - "~>"
99
+ - !ruby/object:Gem::Version
100
+ version: 6.1.0
101
+ - !ruby/object:Gem::Dependency
102
+ name: gemsurance
103
+ requirement: !ruby/object:Gem::Requirement
104
+ requirements:
105
+ - - "~>"
106
+ - !ruby/object:Gem::Version
107
+ version: '0.10'
108
+ type: :development
109
+ prerelease: false
110
+ version_requirements: !ruby/object:Gem::Requirement
111
+ requirements:
112
+ - - "~>"
113
+ - !ruby/object:Gem::Version
114
+ version: '0.10'
115
+ - !ruby/object:Gem::Dependency
116
+ name: pry
117
+ requirement: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - "~>"
120
+ - !ruby/object:Gem::Version
121
+ version: 0.14.0
122
+ type: :development
123
+ prerelease: false
124
+ version_requirements: !ruby/object:Gem::Requirement
125
+ requirements:
126
+ - - "~>"
127
+ - !ruby/object:Gem::Version
128
+ version: 0.14.0
129
+ - !ruby/object:Gem::Dependency
130
+ name: rake
131
+ requirement: !ruby/object:Gem::Requirement
132
+ requirements:
133
+ - - "~>"
134
+ - !ruby/object:Gem::Version
135
+ version: '13.0'
136
+ - - ">="
137
+ - !ruby/object:Gem::Version
138
+ version: 10.0.0
139
+ type: :development
140
+ prerelease: false
141
+ version_requirements: !ruby/object:Gem::Requirement
142
+ requirements:
143
+ - - "~>"
144
+ - !ruby/object:Gem::Version
145
+ version: '13.0'
146
+ - - ">="
147
+ - !ruby/object:Gem::Version
148
+ version: 10.0.0
149
+ - !ruby/object:Gem::Dependency
150
+ name: rspec
151
+ requirement: !ruby/object:Gem::Requirement
152
+ requirements:
153
+ - - "~>"
154
+ - !ruby/object:Gem::Version
155
+ version: 3.10.0
156
+ type: :development
157
+ prerelease: false
158
+ version_requirements: !ruby/object:Gem::Requirement
159
+ requirements:
160
+ - - "~>"
161
+ - !ruby/object:Gem::Version
162
+ version: 3.10.0
163
+ - !ruby/object:Gem::Dependency
164
+ name: rubocop
165
+ requirement: !ruby/object:Gem::Requirement
166
+ requirements:
167
+ - - "~>"
168
+ - !ruby/object:Gem::Version
169
+ version: 1.12.0
170
+ type: :development
171
+ prerelease: false
172
+ version_requirements: !ruby/object:Gem::Requirement
173
+ requirements:
174
+ - - "~>"
175
+ - !ruby/object:Gem::Version
176
+ version: 1.12.0
177
+ - !ruby/object:Gem::Dependency
178
+ name: rubocop-packaging
179
+ requirement: !ruby/object:Gem::Requirement
180
+ requirements:
181
+ - - "~>"
182
+ - !ruby/object:Gem::Version
183
+ version: 0.5.0
184
+ type: :development
185
+ prerelease: false
186
+ version_requirements: !ruby/object:Gem::Requirement
187
+ requirements:
188
+ - - "~>"
189
+ - !ruby/object:Gem::Version
190
+ version: 0.5.0
191
+ - !ruby/object:Gem::Dependency
192
+ name: rubocop-performance
193
+ requirement: !ruby/object:Gem::Requirement
194
+ requirements:
195
+ - - "~>"
196
+ - !ruby/object:Gem::Version
197
+ version: 1.10.0
198
+ type: :development
199
+ prerelease: false
200
+ version_requirements: !ruby/object:Gem::Requirement
201
+ requirements:
202
+ - - "~>"
203
+ - !ruby/object:Gem::Version
204
+ version: 1.10.0
205
+ - !ruby/object:Gem::Dependency
206
+ name: simplecov
207
+ requirement: !ruby/object:Gem::Requirement
208
+ requirements:
209
+ - - "~>"
210
+ - !ruby/object:Gem::Version
211
+ version: 0.21.0
212
+ type: :development
213
+ prerelease: false
214
+ version_requirements: !ruby/object:Gem::Requirement
215
+ requirements:
216
+ - - "~>"
217
+ - !ruby/object:Gem::Version
218
+ version: 0.21.0
219
+ description: A library to use BigData Corps auth features
220
+ email:
221
+ - danilo.carolino@qflash.com.br
222
+ executables: []
223
+ extensions: []
224
+ extra_rdoc_files: []
225
+ files:
226
+ - CHANGELOG.md
227
+ - LICENSE.txt
228
+ - README.md
229
+ - Rakefile
230
+ - lib/bigid/auth/authenticated_connection.rb
231
+ - lib/bigid/auth/authenticated_resource.rb
232
+ - lib/bigid/auth/authentication.rb
233
+ - lib/bigid/auth/authentication_error.rb
234
+ - lib/bigid/auth/bad_request_error.rb
235
+ - lib/bigid/auth/base_error.rb
236
+ - lib/bigid/auth/connection.rb
237
+ - lib/bigid/auth/integration/connection.rb
238
+ - lib/bigid/auth/integration/multipart_flat.rb
239
+ - lib/bigid/auth/integration/request.rb
240
+ - lib/bigid/auth/integration/response.rb
241
+ - lib/bigid/auth/invalid_credentials_error.rb
242
+ - lib/bigid/auth/server_error.rb
243
+ - lib/bigid/auth/version.rb
244
+ - lib/bigid_auth.rb
245
+ - spec/bigid_auth_spec.rb
246
+ - spec/spec_helper.rb
247
+ homepage: https://github.com/Quasar-Flash/bigid-auth-ruby
248
+ licenses:
249
+ - MIT
250
+ metadata: {}
251
+ post_install_message:
252
+ rdoc_options: []
253
+ require_paths:
254
+ - lib
255
+ required_ruby_version: !ruby/object:Gem::Requirement
256
+ requirements:
257
+ - - ">="
258
+ - !ruby/object:Gem::Version
259
+ version: '0'
260
+ required_rubygems_version: !ruby/object:Gem::Requirement
261
+ requirements:
262
+ - - ">="
263
+ - !ruby/object:Gem::Version
264
+ version: '0'
265
+ requirements: []
266
+ rubygems_version: 3.1.4
267
+ signing_key:
268
+ specification_version: 4
269
+ summary: Bigid Auth Library
270
+ test_files:
271
+ - spec/bigid_auth_spec.rb
272
+ - spec/spec_helper.rb