From 4dff91eb61393cbc4b795e833c311080993f91ad Mon Sep 17 00:00:00 2001 From: Danilo Carolino Date: Mon, 30 Aug 2021 18:54:53 -0300 Subject: [PATCH] fix: auth base url value --- PUBLISHING.md | 2 +- README.md | 1 + lib/brl/auth/connection.rb | 2 +- lib/brl/auth/version.rb | 2 +- lib/brl_auth.rb | 2 +- spec/brl_auth_spec.rb | 5 ++--- 6 files changed, 7 insertions(+), 7 deletions(-) diff --git a/PUBLISHING.md b/PUBLISHING.md index c07f313..7decee8 100644 --- a/PUBLISHING.md +++ b/PUBLISHING.md @@ -3,7 +3,7 @@ After the Github and Rubygems authenticatication, push with the following command: ```sh -gem push --key github --host https://rubygems.pkg.github.com/quasar-flash brl_auth-0.2.0.gem +gem push --key github --host https://rubygems.pkg.github.com/quasar-flash brl_auth-0.1.0.1.gem ``` Don't forget to generate the release. diff --git a/README.md b/README.md index 6c8303b..c210154 100644 --- a/README.md +++ b/README.md @@ -30,6 +30,7 @@ Create the config/initializers/brl.rb file and define: ```ruby # Set the env variables BRL.configure do |config| + config.auth_url_value = "https://xxx.hmra.com.br" # optional; default: https://hom.api.acesso.hmra.com.br config.handshake = "XXXXXX-XXXXX-XXXX" config.secret_key = "xxxxxxxxx" end diff --git a/lib/brl/auth/connection.rb b/lib/brl/auth/connection.rb index 35777a7..c79c9bc 100644 --- a/lib/brl/auth/connection.rb +++ b/lib/brl/auth/connection.rb @@ -6,7 +6,7 @@ class Connection < Flash::Integration::Connection ACCEPT = "application/json" CONTENT_TYPE = "application/x-www-form-urlencoded" - def initialize(request_class: Faraday, base_url: BRL::Auth::BASE_URL) + def initialize(request_class: Faraday, base_url: BRL.configuration.auth_base_url) super(request_class: request_class, base_url: base_url) end diff --git a/lib/brl/auth/version.rb b/lib/brl/auth/version.rb index af1e1f0..355da83 100644 --- a/lib/brl/auth/version.rb +++ b/lib/brl/auth/version.rb @@ -9,6 +9,6 @@ module Auth # Major - Incremented for incompatible changes with previous release (or big enough new features) # Minor - Incremented for new backwards-compatible features + deprecations # Patch - Incremented for backwards-compatible bug fixes - VERSION = "0.1.0" + VERSION = "0.1.0.1" end end diff --git a/lib/brl_auth.rb b/lib/brl_auth.rb index c3e0434..ce631d6 100644 --- a/lib/brl_auth.rb +++ b/lib/brl_auth.rb @@ -44,7 +44,7 @@ class Configuration attr_writer :auth_base_url, :handshake, :secret_key def auth_base_url - @auth_base_url ||= ENV["BRL_AUTH_BASE_URL"] + @auth_base_url ||= BRL::Auth::BASE_URL end def handshake diff --git a/spec/brl_auth_spec.rb b/spec/brl_auth_spec.rb index b48c28e..58401b1 100644 --- a/spec/brl_auth_spec.rb +++ b/spec/brl_auth_spec.rb @@ -50,7 +50,7 @@ context "when configuration is not defined" do it { expect(subject).not_to be_nil } - it { expect(subject.auth_base_url).to be_nil } + it { expect(subject.auth_base_url).to eq(described_class::BASE_URL) } it { expect(subject.handshake).to be_nil } @@ -59,14 +59,13 @@ context "when its configured by envs" do before do - ENV["BRL_AUTH_BASE_URL"] = "auth_url_value" ENV["BRL_HANDSHAKE"] = "handshake_value" ENV["BRL_SECRET_KEY"] = "password_value" end it { expect(subject).not_to be_nil } - it { expect(subject.auth_base_url).to eq("auth_url_value") } + it { expect(subject.auth_base_url).to eq(described_class::BASE_URL) } it { expect(subject.handshake).to eq("handshake_value") }