Module: Genba
- Defined in:
- lib/genba.rb,
lib/genba/util.rb,
lib/genba/client.rb,
lib/genba/version.rb,
lib/genba/client/ping.rb,
lib/genba/client/orders.rb,
lib/genba/client/prices.rb,
lib/genba/order_request.rb,
lib/genba/action_request.rb,
lib/genba/client/products.rb,
lib/genba/client/promotions.rb,
lib/genba/activation_request.rb,
lib/genba/redemption_request.rb,
lib/genba/client/reservations.rb,
lib/genba/reservation_request.rb,
lib/genba/client/direct_entitlement.rb,
lib/genba/client/direct_entitlements/activations.rb,
lib/genba/client/direct_entitlements/redemptions.rb
Overview
Genba API module
Defined Under Namespace
Modules: Util Classes: ActionRequest, ActivationRequest, Client, OrderRequest, RedemptionRequest, ReservationRequest
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.2.0'.freeze
Class Method Summary collapse
- .client(credentials = {}) ⇒ Object
-
.log_level ⇒ Object
When set prompts the library to log some extra information to $stdout and $stderr about what it’s doing.
- .log_level=(val) ⇒ Object
-
.logger ⇒ Object
Sets a logger to which logging output will be sent.
- .logger=(val) ⇒ Object
Class Method Details
.client(credentials = {}) ⇒ Object
38 39 40 |
# File 'lib/genba.rb', line 38 def self.client(credentials = {}) Client.new(credentials) end |
.log_level ⇒ Object
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.
49 50 51 |
# File 'lib/genba.rb', line 49 def self.log_level @log_level end |
.log_level=(val) ⇒ Object
53 54 55 56 57 58 59 60 61 62 63 64 65 |
# File 'lib/genba.rb', line 53 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 |
.logger ⇒ Object
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.
74 75 76 |
# File 'lib/genba.rb', line 74 def self.logger @logger end |
.logger=(val) ⇒ Object
78 79 80 |
# File 'lib/genba.rb', line 78 def self.logger=(val) @logger = val end |