Sha256: 1438ae7c829b9ae1eab759e1082f6a74fd5f454096b6aa90faf6a2e27d073a97

Contents?: true

Size: 978 Bytes

Versions: 1

Compression:

Stored size: 978 Bytes

Contents

# frozen_string_literal: true

require 'rest-client'
require 'dotenv'

module Zerobounce
  # Configuration object for Zerobounce.
  #
  # @author Aaron Frase
  #
  # @attr [String] host
  #   The Zerobounce API host.
  #
  # @attr [Hash] headers
  #   Headers to use in all requests.
  #
  # @attr [String] apikey
  #   A Zerobounce API key.
  #
  # @attr [Array<Symbol>] valid_statues
  #   The statuses that are considered valid by {Response#valid?}.
  class Configuration
    attr_accessor :host
    attr_accessor :headers
    attr_accessor :apikey
    attr_accessor :valid_statuses
    attr_accessor :mock

    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
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
zerobounce-sdk-1.1.1 lib/zerobounce/configuration.rb