Class: Rhoconnect::ApiToken

Inherits:
StoreOrm show all
Defined in:
lib/rhoconnect/api_token.rb

Instance Attribute Summary

Attributes inherited from StoreOrm

#id

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from StoreOrm

_field_key, _prefix, class_prefix, #decrement!, #delete, field, #field_key, fields, #increment!, #initialize, is_exist?, list, load, marshal_class_name, #next_id, populate_attributes, set, #store, store, #to_array, validates_presence_of

Constructor Details

This class inherits a constructor from Rhoconnect::StoreOrm

Class Method Details

.create(fields) ⇒ Object



7
8
9
10
11
# File 'lib/rhoconnect/api_token.rb', line 7

def self.create(fields)
  fields[:value] = fields[:value] || get_random_identifier
  fields[:id] = fields[:value]
  super(fields)
end

Instance Method Details

#userObject



13
14
15
# File 'lib/rhoconnect/api_token.rb', line 13

def user
  User.load(self.user_id)
end