Module: Zaius

Defined in:
lib/zaius.rb,
lib/zaius/list.rb,
lib/zaius/util.rb,
lib/zaius/event.rb,
lib/zaius/errors.rb,
lib/zaius/version.rb,
lib/zaius/customer.rb,
lib/zaius/list_object.rb,
lib/zaius/api_resource.rb,
lib/zaius/subscription.rb,
lib/zaius/zaius_client.rb,
lib/zaius/zaius_object.rb,
lib/zaius/zaius_response.rb,
lib/zaius/api_operations/list.rb,
lib/zaius/api_operations/request.rb

Defined Under Namespace

Modules: APIOperations, Util Classes: APIError, APIResource, AuthenticationError, Customer, Event, List, ListObject, RequestLogContext, Subscription, ZaiusClient, ZaiusError, ZaiusObject, ZaiusResponse

Constant Summary collapse

LEVEL_DEBUG =

map to the same values as the standard library’s logger

Logger::DEBUG
LEVEL_ERROR =
Logger::ERROR
LEVEL_INFO =
Logger::INFO
VERSION =
"0.3.0".freeze

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.api_baseObject

Returns the value of attribute api_base.



30
31
32
# File 'lib/zaius.rb', line 30

def api_base
  @api_base
end

.api_keyObject

Returns the value of attribute api_key.



30
31
32
# File 'lib/zaius.rb', line 30

def api_key
  @api_key
end

Class Method Details

.log_levelObject

When set prompts the library to log some extra information to $stdout and $stderr about what it’s doing. For example, it’ll produce information about requests, responses, and errors that are received. Valid log levels are ‘debug` and `info`, with `debug` being a little more verbose in places.

Use of this configuration is only useful when ‘.logger` is not set. When it is, the decision what levels to print is entirely deferred to the logger.



45
46
47
# File 'lib/zaius.rb', line 45

def self.log_level
  @log_level
end

.log_level=(val) ⇒ Object



49
50
51
52
53
54
55
56
57
58
59
60
61
# File 'lib/zaius.rb', line 49

def self.log_level=(val)
  # Backwards compatibility for values that we briefly allowed
  if val == "debug"
    val = LEVEL_DEBUG
  elsif val == "info"
    val = LEVEL_INFO
  end

  if !val.nil? && ![LEVEL_DEBUG, LEVEL_ERROR, LEVEL_INFO].include?(val)
    raise ArgumentError, "log_level should only be set to `nil`, `debug` or `info`"
  end
  @log_level = val
end

.loggerObject

Sets a logger to which logging output will be sent. The logger should support the same interface as the ‘Logger` class that’s part of Ruby’s standard library (hint, anything in ‘Rails.logger` will likely be suitable).

If ‘.logger` is set, the value of `.log_level` is ignored. The decision on what levels to print is entirely deferred to the logger.



70
71
72
# File 'lib/zaius.rb', line 70

def self.logger
  @logger
end

.logger=(val) ⇒ Object



74
75
76
# File 'lib/zaius.rb', line 74

def self.logger=(val)
  @logger = val
end