Class: Rhoconnect::ReadState
Instance Attribute Summary
Attributes inherited from StoreOrm
#id
Class Method Summary
collapse
Methods inherited from StoreOrm
_field_key, _prefix, class_prefix, #decrement!, #delete, field, #field_key, fields, #increment!, #initialize, is_exist?, list, marshal_class_name, #next_id, populate_attributes, set, #store, store, #to_array, validates_presence_of
Class Method Details
.create(fields) ⇒ Object
7
8
9
10
11
12
13
14
15
16
|
# File 'lib/rhoconnect/read_state.rb', line 7
def self.create(fields)
fields[:id] = get_id(fields)
fields.delete(:app_id)
fields.delete(:user_id)
fields.delete(:source_name)
fields[:refresh_time] ||= Time.now.to_i
fields[:prev_refresh_time] ||= Time.now.to_i
fields[:retry_counter] ||= 0
super(fields,{})
end
|
.delete(app_id) ⇒ Object
22
23
24
|
# File 'lib/rhoconnect/read_state.rb', line 22
def self.delete(app_id)
Store.flush_data("#{class_prefix(self)}:#{app_id}:*")
end
|
.delete_user(params) ⇒ Object
26
27
28
|
# File 'lib/rhoconnect/read_state.rb', line 26
def self.delete_user(params)
Store.flush_data("#{class_prefix(self)}:#{params[:app_id]}:#{params[:user_id]}:#{params[:source_name]}:*")
end
|
.load(params) ⇒ Object
18
19
20
|
# File 'lib/rhoconnect/read_state.rb', line 18
def self.load(params)
super(get_id(params),{})
end
|