Class: Intelipost::Api
- Inherits:
-
Object
- Object
- Intelipost::Api
- Defined in:
- lib/intelipost/api.rb
Instance Attribute Summary collapse
-
#api_key ⇒ Object
Returns the value of attribute api_key.
Instance Method Summary collapse
- #CepLocation ⇒ Object
-
#initialize(api_key, environment = nil) ⇒ Api
constructor
A new instance of Api.
- #log_env(environment) ⇒ Object
- #Quote ⇒ Object
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_key ⇒ Object
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
#CepLocation ⇒ Object
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 |
#Quote ⇒ Object
15 16 17 |
# File 'lib/intelipost/api.rb', line 15 def Quote ApiComponents::Quote.new(self.api_key) end |