Class: Todoist::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/todoist/client.rb

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.create_client_by_login(email, password) ⇒ Object

TODO: Need to write a unit test for this



11
12
13
14
15
16
17
# File 'lib/todoist/client.rb', line 11

def self.(email, password)
  client = Client.new
  result = client.api_helper.get_response(Config::TODOIST_USER_LOGIN_COMMAND, {email: email, password: password}, false)
  user = Todoist::Util::ParseHelper.make_object(result)
  client.token = user.token
  client
end

.create_client_by_token(token) ⇒ Object



4
5
6
7
8
# File 'lib/todoist/client.rb', line 4

def self.create_client_by_token(token)
  client = Client.new
  client.token = token
  client
end

Instance Method Details

#api_helperObject



106
107
108
# File 'lib/todoist/client.rb', line 106

def api_helper
  @api_helper
end

#misc_activityObject



31
32
33
34
# File 'lib/todoist/client.rb', line 31

def misc_activity
  @misc_activity = Todoist::Misc::Activity.new(self) unless @misc_activity
  @misc_activity
end

#misc_backupsObject



36
37
38
39
# File 'lib/todoist/client.rb', line 36

def misc_backups
  @misc_backups = Todoist::Misc::Backups.new(self) unless @misc_backups
  @misc_backups
end

#misc_completedObject



41
42
43
44
# File 'lib/todoist/client.rb', line 41

def misc_completed
  @misc_completed = Todoist::Misc::Completed.new(self) unless @misc_completed
  @misc_completed
end

#misc_itemsObject



46
47
48
49
# File 'lib/todoist/client.rb', line 46

def misc_items
  @misc_items = Todoist::Misc::Items.new(self) unless @misc_items
  @misc_items
end

#misc_projectsObject



51
52
53
54
# File 'lib/todoist/client.rb', line 51

def misc_projects
  @misc_projects = Todoist::Misc::Projects.new(self) unless @misc_projects
  @misc_projects
end

#misc_queryObject



56
57
58
59
# File 'lib/todoist/client.rb', line 56

def misc_query
  @misc_query = Todoist::Misc::Query.new(self) unless @misc_query
  @misc_query
end

#misc_quickObject



61
62
63
64
# File 'lib/todoist/client.rb', line 61

def misc_quick
  @misc_quick = Todoist::Misc::Quick.new(self) unless @misc_quick
  @misc_quick
end

#misc_templatesObject



66
67
68
69
# File 'lib/todoist/client.rb', line 66

def misc_templates
  @misc_templates = Todoist::Misc::Templates.new(self) unless @misc_templates
  @misc_templates
end

#misc_uploadsObject



71
72
73
74
# File 'lib/todoist/client.rb', line 71

def misc_uploads
  @misc_uploads = Todoist::Misc::Uploads.new(self) unless @misc_uploads
  @misc_uploads
end

#syncObject



27
28
29
# File 'lib/todoist/client.rb', line 27

def sync
  @api_helper.sync
end

#sync_filtersObject



76
77
78
79
# File 'lib/todoist/client.rb', line 76

def sync_filters
  @sync_filters = Todoist::Sync::Filters.new(self) unless @sync_filters
  @sync_filters
end

#sync_itemsObject



81
82
83
84
# File 'lib/todoist/client.rb', line 81

def sync_items
  @sync_items = Todoist::Sync::Items.new(self) unless @sync_items
  @sync_items
end

#sync_labelsObject



86
87
88
89
# File 'lib/todoist/client.rb', line 86

def sync_labels
  @sync_labels = Todoist::Sync::Labels.new(self) unless @sync_labels
  @sync_labels
end

#sync_notesObject



91
92
93
94
# File 'lib/todoist/client.rb', line 91

def sync_notes
  @sync_notes = Todoist::Sync::Notes.new(self) unless @sync_notes
  @sync_notes
end

#sync_projectsObject



96
97
98
99
# File 'lib/todoist/client.rb', line 96

def sync_projects
  @sync_projects = Todoist::Sync::Projects.new(self) unless @sync_projects
  @sync_projects
end

#sync_remindersObject



101
102
103
104
# File 'lib/todoist/client.rb', line 101

def sync_reminders
  @sync_reminders = Todoist::Sync::Reminders.new(self) unless @sync_reminders
  @sync_reminders
end

#tokenObject



23
24
25
# File 'lib/todoist/client.rb', line 23

def token
  @token
end

#token=(token) ⇒ Object



19
20
21
# File 'lib/todoist/client.rb', line 19

def token=(token)
  @token = token.chomp
end