Class: IronAdmin::Adapters::Http::Configuration
- Inherits:
-
Object
- Object
- IronAdmin::Adapters::Http::Configuration
- Defined in:
- lib/iron_admin/adapters/http/configuration.rb
Overview
Configuration for an HTTP resource's API connection.
Stores base URL, resource path, and headers. Each HTTP resource can override the global configuration.
Instance Attribute Summary collapse
-
#base_url ⇒ Object
Returns the value of attribute base_url.
-
#headers ⇒ Object
Returns the value of attribute headers.
-
#resource_path ⇒ Object
Returns the value of attribute resource_path.
Instance Method Summary collapse
- #full_url ⇒ Object
-
#initialize ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize ⇒ Configuration
Returns a new instance of Configuration.
13 14 15 16 17 |
# File 'lib/iron_admin/adapters/http/configuration.rb', line 13 def initialize @base_url = nil @resource_path = nil @headers = {} end |
Instance Attribute Details
#base_url ⇒ Object
Returns the value of attribute base_url.
11 12 13 |
# File 'lib/iron_admin/adapters/http/configuration.rb', line 11 def base_url @base_url end |
#headers ⇒ Object
Returns the value of attribute headers.
11 12 13 |
# File 'lib/iron_admin/adapters/http/configuration.rb', line 11 def headers @headers end |
#resource_path ⇒ Object
Returns the value of attribute resource_path.
11 12 13 |
# File 'lib/iron_admin/adapters/http/configuration.rb', line 11 def resource_path @resource_path end |
Instance Method Details
#full_url ⇒ Object
19 20 21 22 23 |
# File 'lib/iron_admin/adapters/http/configuration.rb', line 19 def full_url base = @base_url&.chomp("/") || "" path = @resource_path&.start_with?("/") ? @resource_path : "/#{@resource_path}" "#{base}#{path}" end |