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.



11
12
13
14
15
# File 'lib/3scale/authorize_response.rb', line 11

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.



8
9
10
# File 'lib/3scale/authorize_response.rb', line 8

def current_value
  @current_value
end

#max_valueObject (readonly)

Returns the value of attribute max_value.



9
10
11
# File 'lib/3scale/authorize_response.rb', line 9

def max_value
  @max_value
end

#metricObject (readonly)

Returns the value of attribute metric.



6
7
8
# File 'lib/3scale/authorize_response.rb', line 6

def metric
  @metric
end

#periodObject (readonly)

Returns the value of attribute period.



7
8
9
# File 'lib/3scale/authorize_response.rb', line 7

def period
  @period
end

Instance Method Details

#exceeded?Boolean

Returns:

  • (Boolean)


25
26
27
# File 'lib/3scale/authorize_response.rb', line 25

def exceeded?
  current_value > max_value
end

#period_endObject



21
22
23
# File 'lib/3scale/authorize_response.rb', line 21

def period_end
  @parsed_period_end ||= @period_end && Time.parse(@period_end)
end

#period_startObject



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

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