Class: Zerobounce::Configuration
- Inherits:
-
Object
- Object
- Zerobounce::Configuration
- Defined in:
- lib/zerobounce/configuration.rb
Overview
Configuration object for Zerobounce.
Instance Attribute Summary collapse
-
#apikey ⇒ String
A Zerobounce API key.
-
#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.
29 30 31 32 33 34 35 36 |
# File 'lib/zerobounce/configuration.rb', line 29 def initialize(mock=false) if File.file?(".env") then Dotenv.load(".env") else Dotenv.load end self.host = 'https://api.zerobounce.net' self.apikey = ENV['ZEROBOUNCE_API_KEY'] self.valid_statuses = %i[valid catch_all] self.headers = { user_agent: "ZerobounceRubyGem/#{Zerobounce::VERSION}" } self.mock = mock end |
Instance Attribute Details
#apikey ⇒ String
A Zerobounce API key.
22 23 24 |
# File 'lib/zerobounce/configuration.rb', line 22 def apikey @apikey end |
#headers ⇒ Hash
Headers to use in all requests.
22 23 24 |
# File 'lib/zerobounce/configuration.rb', line 22 def headers @headers end |
#host ⇒ String
The Zerobounce API host.
22 23 24 |
# File 'lib/zerobounce/configuration.rb', line 22 def host @host end |
#mock ⇒ Object
Returns the value of attribute mock.
27 28 29 |
# File 'lib/zerobounce/configuration.rb', line 27 def mock @mock end |
#valid_statues ⇒ Array<Symbol>
The statuses that are considered valid by Response#valid?.
22 23 24 |
# File 'lib/zerobounce/configuration.rb', line 22 def valid_statues @valid_statues end |
#valid_statuses ⇒ Object
Returns the value of attribute valid_statuses.
26 27 28 |
# File 'lib/zerobounce/configuration.rb', line 26 def valid_statuses @valid_statuses end |