Sha256: ba690a07b0d8eb59f84cf16b33879b302af120b65e4e444631c954a7b385ea27

Contents?: true

Size: 725 Bytes

Versions: 2

Compression:

Stored size: 725 Bytes

Contents

require "tsks/storage"

module Tsks
  class Actions
    def self.update_tsks_with_uuid uuid
      current_tsks = Tsks::Storage.select_all

      for tsk in current_tsks
        Tsks::Storage.update tsk[:local_id], {user_id: uuid}
      end
    end

    def self.update_server_for_removed_tsks token
      tsks_uuids = Tsks::Storage.select_removed_uuids

      if !tsks_uuids.empty?
        for id in tsks_uuids
          Tsks::Request.delete "/tsks/#{id}", token
        end
      end
    end

    def self.get_tsk_status status
      available_status = {
        todo: '+',
        done: '-',
        doing: '*',
        freezed: '||',
        archived: 'x',
      }

      available_status[status.to_sym]
    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
tsks-0.0.9 lib/tsks/actions.rb
tsks-0.0.8 lib/tsks/actions.rb