class ThreeScale::AuthorizeResponse
Constants
- LIMITS_EXCEEDED
These 2 constants are defined according to what the 3scale backend returns in the response of authorize calls.
- LIMITS_EXCEEDED_MSG
Attributes
app_key[RW]
hierarchy[R]
plan[RW]
redirect_url[RW]
service_id[RW]
usage_reports[R]
Public Class Methods
new()
click to toggle source
Calls superclass method
# File lib/3scale/authorize_response.rb, line 44 def initialize super @usage_reports = [] # hierarchy is a hash where the keys are metric names, and the values # their children (array of metric names). # Only metrics that have at least one child appear as keys. @hierarchy = {} end
Public Instance Methods
add_metric_to_hierarchy(metric_name, children)
click to toggle source
# File lib/3scale/authorize_response.rb, line 58 def add_metric_to_hierarchy(metric_name, children) @hierarchy[metric_name] = children end
add_usage_report(options)
click to toggle source
# File lib/3scale/authorize_response.rb, line 54 def add_usage_report(options) @usage_reports << UsageReport.new(options) end
limits_exceeded?()
click to toggle source
The response already specifies whether any usage report (if present) is over the limits, so use that instead of scanning the reports.
# File lib/3scale/authorize_response.rb, line 64 def limits_exceeded? error_code == LIMITS_EXCEEDED || error_message == LIMITS_EXCEEDED_MSG end