Class: Mintsoft::AuthClient
- Inherits:
-
Object
- Object
- Mintsoft::AuthClient
- Defined in:
- lib/mintsoft/auth_client.rb
Defined Under Namespace
Classes: AuthResource, AuthenticationError
Constant Summary collapse
- BASE_URL =
"https://api.mintsoft.co.uk"
Instance Attribute Summary collapse
-
#base_url ⇒ Object
readonly
Returns the value of attribute base_url.
-
#conn_opts ⇒ Object
readonly
Returns the value of attribute conn_opts.
Instance Method Summary collapse
- #auth ⇒ Object
- #connection ⇒ Object
-
#initialize(base_url: BASE_URL, conn_opts: {}) ⇒ AuthClient
constructor
A new instance of AuthClient.
Constructor Details
#initialize(base_url: BASE_URL, conn_opts: {}) ⇒ AuthClient
Returns a new instance of AuthClient.
15 16 17 18 |
# File 'lib/mintsoft/auth_client.rb', line 15 def initialize(base_url: BASE_URL, conn_opts: {}) @base_url = base_url @conn_opts = conn_opts end |
Instance Attribute Details
#base_url ⇒ Object (readonly)
Returns the value of attribute base_url.
13 14 15 |
# File 'lib/mintsoft/auth_client.rb', line 13 def base_url @base_url end |
#conn_opts ⇒ Object (readonly)
Returns the value of attribute conn_opts.
13 14 15 |
# File 'lib/mintsoft/auth_client.rb', line 13 def conn_opts @conn_opts end |
Instance Method Details
#auth ⇒ Object
30 31 32 |
# File 'lib/mintsoft/auth_client.rb', line 30 def auth @auth ||= AuthResource.new(self) end |
#connection ⇒ Object
20 21 22 23 24 25 26 27 28 |
# File 'lib/mintsoft/auth_client.rb', line 20 def connection @connection ||= Faraday.new do |conn| conn.url_prefix = @base_url conn..merge!(@conn_opts) conn.request :json conn.adapter Faraday.default_adapter end end |