Class: EvadosTracker::Core

Inherits:
Object
  • Object
show all
Defined in:
lib/evados_tracker.rb,
lib/evados_tracker/core.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(key) ⇒ Core

Returns a new instance of Core.



8
9
10
11
12
13
# File 'lib/evados_tracker.rb', line 8

def initialize(key)
  @key = key
  @current_issue_id
  @pomodoro_id
  @numerated_list = {}
end

Instance Attribute Details

#current_isssue_idObject

Returns the value of attribute current_isssue_id.



3
4
5
# File 'lib/evados_tracker/core.rb', line 3

def current_isssue_id
  @current_isssue_id
end

#current_issue_idObject

Returns the value of attribute current_issue_id.



6
7
8
# File 'lib/evados_tracker.rb', line 6

def current_issue_id
  @current_issue_id
end

#keyObject

Returns the value of attribute key.



6
7
8
# File 'lib/evados_tracker.rb', line 6

def key
  @key
end

#numerated_listObject

Returns the value of attribute numerated_list.



6
7
8
# File 'lib/evados_tracker.rb', line 6

def numerated_list
  @numerated_list
end

#pomodoro_idObject

Returns the value of attribute pomodoro_id.



6
7
8
# File 'lib/evados_tracker.rb', line 6

def pomodoro_id
  @pomodoro_id
end

Instance Method Details

#commit_pomodoroObject



30
31
32
33
# File 'lib/evados_tracker.rb', line 30

def commit_pomodoro
  response = HTTParty.put("http://pm.evados.com/api/v1/issues/" + "#{@current_issue_id}" +
                "/pomodoros/" + "#{@pomodoro_id}" + ".json?auth_token=" + "#{@key}")
end

#create_pomodoroObject



23
24
25
26
27
28
# File 'lib/evados_tracker.rb', line 23

def create_pomodoro
  check_rescue do
    @pomodoro_id = HTTParty.post("http://pm.evados.com/api/v1/issues/" + "#{@current_issue_id}" +
                  "/pomodoros.json?auth_token=" + "#{@key}")
  end
end

#delete_pomodoroObject



35
36
37
38
39
40
# File 'lib/evados_tracker.rb', line 35

def delete_pomodoro
  check_rescue do
    response = HTTParty.delete("http://pm.evados.com/api/v1/issues/" + "#{@current_issue_id}" +
                  "/pomodoros/" + "#{@pomodoro_id}" + ".json?auth_token=" + "#{@key}")
  end
end

#get_tasksObject



15
16
17
18
19
20
21
# File 'lib/evados_tracker.rb', line 15

def get_tasks
  check_rescue do
    response = HTTParty.get("http://pm.evados.com/api/v1/issues.json?auth_token=" + "#{@key}")
    numerate_task_list response
    response
  end
end