Method: InterFAX::Client#initialize

Defined in:
lib/interfax/client.rb

#initialize(options = {}) ⇒ Client

Returns a new instance of Client.



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/interfax/client.rb', line 18

def initialize(options = {})
  self.username = options.fetch(:username) do
    ENV['INTERFAX_USERNAME'] || raise(KeyError, "Missing required argument: username")
  end

  self.password = options.fetch(:password) do
    ENV['INTERFAX_PASSWORD'] || raise(KeyError, "Missing required argument: password")
  end

  self.host = options.fetch(:host) do
    ENV['INTERFAX_HOST'] || HOST
  end

  self.http = Net::HTTP.new(host, Net::HTTP.https_default_port)
  http.set_debug_output $stdout if options[:debug]
  http.use_ssl = true
end