Class: Intelipost::Api

Inherits:
Object
  • Object
show all
Defined in:
lib/intelipost/api.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(api_key, environment = nil) ⇒ Api



5
6
7
8
9
# File 'lib/intelipost/api.rb', line 5

def initialize(api_key, environment=nil)
  self.api_key = api_key
  $logger = Logging.logger(log_env(environment))
  $logger.level = :info
end

Instance Attribute Details

#api_keyObject

Returns the value of attribute api_key.



3
4
5
# File 'lib/intelipost/api.rb', line 3

def api_key
  @api_key
end

Instance Method Details

#CepLocationObject



11
12
13
# File 'lib/intelipost/api.rb', line 11

def CepLocation
  ApiComponents::CepLocation.new(self.api_key)
end

#log_env(environment) ⇒ Object



19
20
21
22
23
24
25
# File 'lib/intelipost/api.rb', line 19

def log_env(environment)
  if environment.nil?
    STDOUT
  else
    "logs/intelipost_#{environment}.log"
  end
end

#QuoteObject



15
16
17
# File 'lib/intelipost/api.rb', line 15

def Quote
  ApiComponents::Quote.new(self.api_key)
end