class UsageRecord

Constants

EVENTS
USAGE_TYPES

Attributes

addtl_fs_gb[RW]
event[RW]
gear_size[RW]
gear_uuid[RW]
sync_time[RW]
time[RW]
usage_type[RW]
user[RW]
user_id[RW]
uuid[RW]

Public Class Methods

new(event=nil, user=nil, time=nil, uuid=nil, usage_type=nil) click to toggle source
# File lib/stickshift-controller/app/models/usage_record.rb, line 14
def initialize(event=nil, user=nil, time=nil, uuid=nil, usage_type=nil)
  self.uuid = uuid ? uuid : StickShift::Model.gen_uuid
  self.event = event
  self.time = time ? time : Time.now.utc
  self.user = user
  self.usage_type = usage_type
  self.sync_time = nil
end

Public Instance Methods

delete() click to toggle source

Deletes the usage record from the datastore

# File lib/stickshift-controller/app/models/usage_record.rb, line 24
def delete
  super(user.login)
end
delete_by_gear_uuid() click to toggle source
# File lib/stickshift-controller/app/models/usage_record.rb, line 33
def delete_by_gear_uuid
  StickShift::DataStore.instance.delete_usage_record_by_gear_uuid(user.login, gear_uuid, usage_type)
end
save() click to toggle source

Saves the usage record to the datastore

# File lib/stickshift-controller/app/models/usage_record.rb, line 29
def save
  super(user.login)
end