Class: Tsks::Actions

Inherits:
Object
  • Object
show all
Defined in:
lib/tsks/actions.rb

Class Method Summary collapse

Class Method Details

.get_tsk_status(status) ⇒ Object



23
24
25
26
27
28
29
30
31
32
33
# File 'lib/tsks/actions.rb', line 23

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

  available_status[status.to_sym]
end

.update_server_for_removed_tsks(token) ⇒ Object



13
14
15
16
17
18
19
20
21
# File 'lib/tsks/actions.rb', line 13

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

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

.update_tsks_with_user_id(user_id) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/tsks/actions.rb', line 5

def self.update_tsks_with_user_id user_id
  current_tsks = Tsks::Storage.select_all

  for tsk in current_tsks
    Tsks::Storage.update_by({rowid: tsk[:rowid]}, {user_id: user_id})
  end
end