Class: Zerobounce::Configuration

Inherits:
Object
  • Object
show all
Defined in:
lib/zerobounce/configuration.rb

Overview

Configuration object for Zerobounce.

Author:

  • Aaron Frase

Instance Attribute Summary collapse

Instance Method Summary collapse

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

#apikeyString

A Zerobounce API key.

Returns:

  • (String)

    the current value of apikey



22
23
24
# File 'lib/zerobounce/configuration.rb', line 22

def apikey
  @apikey
end

#headersHash

Headers to use in all requests.

Returns:

  • (Hash)

    the current value of headers



22
23
24
# File 'lib/zerobounce/configuration.rb', line 22

def headers
  @headers
end

#hostString

The Zerobounce API host.

Returns:

  • (String)

    the current value of host



22
23
24
# File 'lib/zerobounce/configuration.rb', line 22

def host
  @host
end

#mockObject

Returns the value of attribute mock.



27
28
29
# File 'lib/zerobounce/configuration.rb', line 27

def mock
  @mock
end

#valid_statuesArray<Symbol>

The statuses that are considered valid by Response#valid?.

Returns:

  • (Array<Symbol>)

    the current value of valid_statues



22
23
24
# File 'lib/zerobounce/configuration.rb', line 22

def valid_statues
  @valid_statues
end

#valid_statusesObject

Returns the value of attribute valid_statuses.



26
27
28
# File 'lib/zerobounce/configuration.rb', line 26

def valid_statuses
  @valid_statuses
end