Class: KaveRestApi::RequestBase

Inherits:
Object
  • Object
show all
Defined in:
lib/kavenegar-ruby/requests/RequestBase.rb

Instance Method Summary collapse

Constructor Details

#initialize(args = {}) ⇒ RequestBase

Returns a new instance of RequestBase.

Raises:

  • (ArgumentError)


3
4
5
6
7
8
9
# File 'lib/kavenegar-ruby/requests/RequestBase.rb', line 3

def initialize(args = {})
    config = KaveRestApi.configuration
    raise(ArgumentError, 'not a valid configuration class') if config.nil? || config.api_key.nil? || config.default_sender.nil?
    @API_URL = "https://api.kavenegar.com/v1/#{config.api_key}"
    @DEFAULT_SENDER = config.default_sender.freeze
    @FORMAT= config.format rescue 'json'
end