Class: ThreeScale::AuthorizeResponse
- Defined in:
- lib/3scale/authorize_response.rb
Defined Under Namespace
Classes: UsageReport
Instance Attribute Summary collapse
-
#app_key ⇒ Object
Returns the value of attribute app_key.
-
#hierarchy ⇒ Object
readonly
Not part of the stable API.
-
#plan ⇒ Object
Returns the value of attribute plan.
-
#redirect_url ⇒ Object
Returns the value of attribute redirect_url.
-
#service_id ⇒ Object
Returns the value of attribute service_id.
-
#usage_reports ⇒ Object
readonly
Returns the value of attribute usage_reports.
Attributes inherited from Response
Instance Method Summary collapse
- #add_metric_to_hierarchy(metric_name, children) ⇒ Object
- #add_usage_report(options) ⇒ Object
-
#initialize ⇒ AuthorizeResponse
constructor
A new instance of AuthorizeResponse.
-
#limits_exceeded? ⇒ Boolean
The response already specifies whether any usage report (if present) is over the limits, so use that instead of scanning the reports.
Methods inherited from Response
Constructor Details
#initialize ⇒ AuthorizeResponse
Returns a new instance of AuthorizeResponse.
44 45 46 47 48 49 50 51 52 |
# 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 |
Instance Attribute Details
#app_key ⇒ Object
Returns the value of attribute app_key.
38 39 40 |
# File 'lib/3scale/authorize_response.rb', line 38 def app_key @app_key end |
#hierarchy ⇒ Object (readonly)
Not part of the stable API
42 43 44 |
# File 'lib/3scale/authorize_response.rb', line 42 def hierarchy @hierarchy end |
#plan ⇒ Object
Returns the value of attribute plan.
37 38 39 |
# File 'lib/3scale/authorize_response.rb', line 37 def plan @plan end |
#redirect_url ⇒ Object
Returns the value of attribute redirect_url.
39 40 41 |
# File 'lib/3scale/authorize_response.rb', line 39 def redirect_url @redirect_url end |
#service_id ⇒ Object
Returns the value of attribute service_id.
40 41 42 |
# File 'lib/3scale/authorize_response.rb', line 40 def service_id @service_id end |
#usage_reports ⇒ Object (readonly)
Returns the value of attribute usage_reports.
41 42 43 |
# File 'lib/3scale/authorize_response.rb', line 41 def usage_reports @usage_reports end |
Instance Method Details
#add_metric_to_hierarchy(metric_name, children) ⇒ Object
58 59 60 |
# 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) ⇒ Object
54 55 56 |
# File 'lib/3scale/authorize_response.rb', line 54 def add_usage_report() @usage_reports << UsageReport.new() end |
#limits_exceeded? ⇒ Boolean
The response already specifies whether any usage report (if present) is over the limits, so use that instead of scanning the reports.
64 65 66 |
# File 'lib/3scale/authorize_response.rb', line 64 def limits_exceeded? error_code == LIMITS_EXCEEDED || == LIMITS_EXCEEDED_MSG end |