class Retained::GroupConfiguration

Constants

ReportingIntervals

Attributes

reporting_interval[R]

Public Class Methods

new(options = {}) click to toggle source
# File lib/retained/group_configuration.rb, line 7
def initialize(options = {})
  @reporting_interval = nil

  options.each do |key, value|
    send("#{key}=", value)
  end
end

Public Instance Methods

reporting_interval=(reporting_interval) click to toggle source
# File lib/retained/group_configuration.rb, line 15
def reporting_interval=(reporting_interval)
  reporting_interval = reporting_interval.to_sym

  if @reporting_interval && @reporting_interval != reporting_interval
    fail 'Group reporting_interval is immutable once set'
  elsif !ReportingIntervals.include?(reporting_interval)
    fail ArgumentError, "Invalid reporting_interval: `#{reporting_interval}`.  Must be one of #{ReportingIntervals}"
  end

  @reporting_interval = reporting_interval
end
set_defaults() click to toggle source
# File lib/retained/group_configuration.rb, line 27
def set_defaults
  @reporting_interval ||= :day
end
to_hash() click to toggle source

Returns the configuration as a hash of key/values

# File lib/retained/group_configuration.rb, line 32
def to_hash
  {
    reporting_interval: reporting_interval
  }
end