Module: PriceHubble::Utils::Decision
- Extended by:
- ActiveSupport::Concern
- Included in:
- Client::Base
- Defined in:
- lib/pricehubble/utils/decision.rb
Overview
Provides an easy to use decision DSL which works like a flow control. (eg. if conditions, or a switch statement) It should DRY out the processing logic on clients, while make decisions about the status of the response. The decision helper evaluates the answers to: Should we raise an error or return a default value? Was the response any good?
Example:
decision(bang: true) do |result|
result.fail { nil }
result.bang { Hausgold::AuthenticationError.new(nil, res, res.body) }
result.good { Hausgold::Jwt.new(res.body).clear_changes }
successful?(res)
end
Defined Under Namespace
Classes: Runtime