Class: Zerobounce::Configuration
- Inherits:
-
Object
- Object
- Zerobounce::Configuration
- Defined in:
- lib/zerobounce/configuration.rb
Overview
Configuration object for Zerobounce.
Instance Attribute Summary collapse
-
#api_root_url ⇒ String
The Zerobounce API root URL.
-
#apikey ⇒ String
A Zerobounce API key.
-
#bulk_api_root_url ⇒ String
The Zerobounce bulk API root URL.
-
#headers ⇒ Hash
Headers to use in all requests.
-
#host ⇒ String
The Zerobounce API host.
-
#mock ⇒ Object
Returns the value of attribute mock.
-
#valid_statues ⇒ Array<Symbol>
The statuses that are considered valid by Response#valid?.
-
#valid_statuses ⇒ Object
Returns the value of attribute valid_statuses.
Instance Method Summary collapse
-
#initialize(mock = false) ⇒ Configuration
constructor
A new instance of Configuration.
Constructor Details
#initialize(mock = false) ⇒ Configuration
Returns a new instance of Configuration.
32 33 34 35 36 37 38 39 40 |
# File 'lib/zerobounce/configuration.rb', line 32 def initialize(mock = false) File.file?('.env') ? Dotenv.load('.env') : Dotenv.load self.apikey = ENV['ZEROBOUNCE_API_KEY'] self.api_root_url = ENV['ZEROBOUNCE_API_URL'] || ApiUrls::DEFAULT_URL self.bulk_api_root_url = ENV['ZEROBOUNCE_BULK_API_URL'] || ApiUrls::BULK_DEFAULT_URL self.valid_statuses = %i[valid catch_all accept_all] self.headers = { user_agent: "ZerobounceRubyGem/#{Zerobounce::VERSION}" } self.mock = mock end |
Instance Attribute Details
#api_root_url ⇒ String
The Zerobounce API root URL. Defaults to ApiUrls::DEFAULT_URL.
29 30 31 |
# File 'lib/zerobounce/configuration.rb', line 29 def api_root_url @api_root_url end |
#apikey ⇒ String
A Zerobounce API key.
29 30 31 |
# File 'lib/zerobounce/configuration.rb', line 29 def apikey @apikey end |
#bulk_api_root_url ⇒ String
The Zerobounce bulk API root URL.
29 30 31 |
# File 'lib/zerobounce/configuration.rb', line 29 def bulk_api_root_url @bulk_api_root_url end |
#headers ⇒ Hash
Headers to use in all requests.
29 30 31 |
# File 'lib/zerobounce/configuration.rb', line 29 def headers @headers end |
#host ⇒ String
The Zerobounce API host.
29 30 31 |
# File 'lib/zerobounce/configuration.rb', line 29 def host @host end |
#mock ⇒ Object
Returns the value of attribute mock.
30 31 32 |
# File 'lib/zerobounce/configuration.rb', line 30 def mock @mock end |
#valid_statues ⇒ Array<Symbol>
The statuses that are considered valid by Response#valid?.
29 30 31 |
# File 'lib/zerobounce/configuration.rb', line 29 def valid_statues @valid_statues end |
#valid_statuses ⇒ Object
Returns the value of attribute valid_statuses.
30 31 32 |
# File 'lib/zerobounce/configuration.rb', line 30 def valid_statuses @valid_statuses end |