Class: Namira::Config
- Inherits:
-
OpenStruct
- Object
- OpenStruct
- Namira::Config
- Defined in:
- lib/namira/config.rb
Overview
Instance Attribute Summary collapse
-
#async_adapter ⇒ Symbol
The preferred async adapter to use.
-
#async_queue_name ⇒ Symbol
The queue name that async requests should be added too.
-
#backend ⇒ Namira::Backend
The backend Namira will use to send the request.
-
#headers ⇒ Hash
readonly
Default headers to send with each request.
-
#log_requests ⇒ Bool
Log requests using puts or Rails.logger.debug if it’s defined.
-
#max_redirect ⇒ Integer
The maximum number of redirects to follow before throwing a Errors::RedirectError.
-
#timeout ⇒ Float
The max length of time (in seconds) Namira will wait before canceling the request and throwing a Errors::TimeoutError.
-
#user_agent ⇒ String
The string to send for the “User-Agent” header.
Instance Method Summary collapse
-
#initialize ⇒ Config
constructor
A new instance of Config.
Constructor Details
#initialize ⇒ Config
Returns a new instance of Config.
68 69 70 |
# File 'lib/namira/config.rb', line 68 def initialize super(DEFAULT_SETTINGS) end |
Instance Attribute Details
#async_adapter ⇒ Symbol
The preferred async adapter to use. Possible Values: :active_job, :sidekiq
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/namira/config.rb', line 47 class Config < OpenStruct ## # The # attr_accessor :max_redirect # attr_accessor :timeout # attr_accessor :backend # attr_accessor :user_agent DEFAULT_SETTINGS = { max_redirect: 3, timeout: 5.0, backend: nil, user_agent: "Namira/#{Namira::VERSION}", headers: {}, log_requests: true, async_queue_name: :default, async_adapter: :active_job }.freeze private_constant :DEFAULT_SETTINGS def initialize super(DEFAULT_SETTINGS) end end |
#async_queue_name ⇒ Symbol
The queue name that async requests should be added too.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/namira/config.rb', line 47 class Config < OpenStruct ## # The # attr_accessor :max_redirect # attr_accessor :timeout # attr_accessor :backend # attr_accessor :user_agent DEFAULT_SETTINGS = { max_redirect: 3, timeout: 5.0, backend: nil, user_agent: "Namira/#{Namira::VERSION}", headers: {}, log_requests: true, async_queue_name: :default, async_adapter: :active_job }.freeze private_constant :DEFAULT_SETTINGS def initialize super(DEFAULT_SETTINGS) end end |
#backend ⇒ Namira::Backend
The backend Namira will use to send the request.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/namira/config.rb', line 47 class Config < OpenStruct ## # The # attr_accessor :max_redirect # attr_accessor :timeout # attr_accessor :backend # attr_accessor :user_agent DEFAULT_SETTINGS = { max_redirect: 3, timeout: 5.0, backend: nil, user_agent: "Namira/#{Namira::VERSION}", headers: {}, log_requests: true, async_queue_name: :default, async_adapter: :active_job }.freeze private_constant :DEFAULT_SETTINGS def initialize super(DEFAULT_SETTINGS) end end |
#headers ⇒ Hash (readonly)
Default headers to send with each request
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/namira/config.rb', line 47 class Config < OpenStruct ## # The # attr_accessor :max_redirect # attr_accessor :timeout # attr_accessor :backend # attr_accessor :user_agent DEFAULT_SETTINGS = { max_redirect: 3, timeout: 5.0, backend: nil, user_agent: "Namira/#{Namira::VERSION}", headers: {}, log_requests: true, async_queue_name: :default, async_adapter: :active_job }.freeze private_constant :DEFAULT_SETTINGS def initialize super(DEFAULT_SETTINGS) end end |
#log_requests ⇒ Bool
Log requests using puts or Rails.logger.debug if it’s defined
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/namira/config.rb', line 47 class Config < OpenStruct ## # The # attr_accessor :max_redirect # attr_accessor :timeout # attr_accessor :backend # attr_accessor :user_agent DEFAULT_SETTINGS = { max_redirect: 3, timeout: 5.0, backend: nil, user_agent: "Namira/#{Namira::VERSION}", headers: {}, log_requests: true, async_queue_name: :default, async_adapter: :active_job }.freeze private_constant :DEFAULT_SETTINGS def initialize super(DEFAULT_SETTINGS) end end |
#max_redirect ⇒ Integer
The maximum number of redirects to follow before throwing a Errors::RedirectError
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/namira/config.rb', line 47 class Config < OpenStruct ## # The # attr_accessor :max_redirect # attr_accessor :timeout # attr_accessor :backend # attr_accessor :user_agent DEFAULT_SETTINGS = { max_redirect: 3, timeout: 5.0, backend: nil, user_agent: "Namira/#{Namira::VERSION}", headers: {}, log_requests: true, async_queue_name: :default, async_adapter: :active_job }.freeze private_constant :DEFAULT_SETTINGS def initialize super(DEFAULT_SETTINGS) end end |
#timeout ⇒ Float
The max length of time (in seconds) Namira will wait before canceling the request and throwing a Errors::TimeoutError
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/namira/config.rb', line 47 class Config < OpenStruct ## # The # attr_accessor :max_redirect # attr_accessor :timeout # attr_accessor :backend # attr_accessor :user_agent DEFAULT_SETTINGS = { max_redirect: 3, timeout: 5.0, backend: nil, user_agent: "Namira/#{Namira::VERSION}", headers: {}, log_requests: true, async_queue_name: :default, async_adapter: :active_job }.freeze private_constant :DEFAULT_SETTINGS def initialize super(DEFAULT_SETTINGS) end end |
#user_agent ⇒ String
The string to send for the “User-Agent” header. The value set here will be overriden if a user agent is specified on the request itself.
47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 |
# File 'lib/namira/config.rb', line 47 class Config < OpenStruct ## # The # attr_accessor :max_redirect # attr_accessor :timeout # attr_accessor :backend # attr_accessor :user_agent DEFAULT_SETTINGS = { max_redirect: 3, timeout: 5.0, backend: nil, user_agent: "Namira/#{Namira::VERSION}", headers: {}, log_requests: true, async_queue_name: :default, async_adapter: :active_job }.freeze private_constant :DEFAULT_SETTINGS def initialize super(DEFAULT_SETTINGS) end end |