Class: ThreeScale::AuthorizeResponse::UsageReport
- Inherits:
-
Object
- Object
- ThreeScale::AuthorizeResponse::UsageReport
- Defined in:
- lib/3scale/authorize_response.rb
Instance Attribute Summary collapse
-
#current_value ⇒ Object
readonly
Returns the value of attribute current_value.
-
#max_value ⇒ Object
readonly
Returns the value of attribute max_value.
-
#metric ⇒ Object
readonly
Returns the value of attribute metric.
-
#period ⇒ Object
readonly
Returns the value of attribute period.
Instance Method Summary collapse
- #exceeded? ⇒ Boolean
-
#initialize(options = {}) ⇒ UsageReport
constructor
A new instance of UsageReport.
- #period_end ⇒ Object
- #period_start ⇒ Object
Constructor Details
#initialize(options = {}) ⇒ UsageReport
Returns a new instance of UsageReport.
21 22 23 24 25 |
# File 'lib/3scale/authorize_response.rb', line 21 def initialize( = {}) .each do |name, value| instance_variable_set("@#{name}", value) end end |
Instance Attribute Details
#current_value ⇒ Object (readonly)
Returns the value of attribute current_value.
18 19 20 |
# File 'lib/3scale/authorize_response.rb', line 18 def current_value @current_value end |
#max_value ⇒ Object (readonly)
Returns the value of attribute max_value.
19 20 21 |
# File 'lib/3scale/authorize_response.rb', line 19 def max_value @max_value end |
#metric ⇒ Object (readonly)
Returns the value of attribute metric.
16 17 18 |
# File 'lib/3scale/authorize_response.rb', line 16 def metric @metric end |
#period ⇒ Object (readonly)
Returns the value of attribute period.
17 18 19 |
# File 'lib/3scale/authorize_response.rb', line 17 def period @period end |
Instance Method Details
#exceeded? ⇒ Boolean
35 36 37 |
# File 'lib/3scale/authorize_response.rb', line 35 def exceeded? current_value > max_value end |
#period_end ⇒ Object
31 32 33 |
# File 'lib/3scale/authorize_response.rb', line 31 def period_end @parsed_period_end ||= @period_end && Time.parse(@period_end) end |
#period_start ⇒ Object
27 28 29 |
# File 'lib/3scale/authorize_response.rb', line 27 def period_start @parsed_period_start ||= @period_start && Time.parse(@period_start) end |