Class: ThreeScale::AuthorizeResponse::UsageReport

Inherits:
Object
  • Object
show all
Defined in:
lib/3scale/authorize_response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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(options = {})
  options.each do |name, value|
    instance_variable_set("@#{name}", value)
  end
end

Instance Attribute Details

#current_valueObject (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_valueObject (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

#metricObject (readonly)

Returns the value of attribute metric.



16
17
18
# File 'lib/3scale/authorize_response.rb', line 16

def metric
  @metric
end

#periodObject (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

Returns:

  • (Boolean)


35
36
37
# File 'lib/3scale/authorize_response.rb', line 35

def exceeded?
  current_value > max_value
end

#period_endObject



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_startObject



27
28
29
# File 'lib/3scale/authorize_response.rb', line 27

def period_start
  @parsed_period_start ||= @period_start && Time.parse(@period_start)
end