Sha256: 5c8f972728c44cc84d0d52409155a29403ce375c74b334fa5e433a7ea5d600fe

Contents?: true

Size: 610 Bytes

Versions: 31

Compression:

Stored size: 610 Bytes

Contents

module Rhosync  
  class ReadState < Model
    field :refresh_time,:integer
  
    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
      super(fields,{})
    end
  
    def self.load(params)
      super(get_id(params),{})
    end
    
    def self.delete(app_id)
      Store.flash_data("#{class_prefix(self)}:#{app_id}:*")
    end

    private
    def self.get_id(params)
      "#{params[:app_id]}:#{params[:user_id]}:#{params[:source_name]}"
    end
  end
end

Version data entries

31 entries across 31 versions & 1 rubygems

Version Path
rhosync-2.1.6 lib/rhosync/read_state.rb
rhosync-2.1.3 lib/rhosync/read_state.rb
rhosync-2.1.2 lib/rhosync/read_state.rb
rhosync-2.1.1 lib/rhosync/read_state.rb
rhosync-2.1.0 lib/rhosync/read_state.rb
rhosync-2.1.0.beta.2 lib/rhosync/read_state.rb
rhosync-2.1.0.beta.1 lib/rhosync/read_state.rb
rhosync-2.0.9 lib/rhosync/read_state.rb
rhosync-2.0.8 lib/rhosync/read_state.rb
rhosync-2.0.7 lib/rhosync/read_state.rb
rhosync-2.0.6 lib/rhosync/read_state.rb
rhosync-2.0.5 lib/rhosync/read_state.rb
rhosync-2.0.4 lib/rhosync/read_state.rb
rhosync-2.0.3 lib/rhosync/read_state.rb
rhosync-2.0.2 lib/rhosync/read_state.rb
rhosync-2.0.1 lib/rhosync/read_state.rb
rhosync-2.0.0 lib/rhosync/read_state.rb
rhosync-2.0.0.rc2 lib/rhosync/read_state.rb
rhosync-2.0.0.rc1 lib/rhosync/read_state.rb
rhosync-2.0.0.beta13 lib/rhosync/read_state.rb