Commit 7fa21c03e7fa82f63998389257d2d36984d184cd
- Diff rendering mode:
- inline
- side by side
Rakefile
(1 / 1)
|   | |||
| 21 | 21 | PROJ.name = 'todoist-ng' | |
| 22 | 22 | PROJ.authors = 'James Britt' | |
| 23 | 23 | PROJ.email = 'james.britt@gmail.com' | |
| 24 | PROJ.url = 'none' | ||
| 24 | PROJ.url = 'http://www.gitorious.com/projects/todoist-ng' | ||
| 25 | 25 | PROJ.version = Neurogami::Todoist::Setup::VERSION | |
| 26 | 26 | PROJ.rubyforge.name = 'todoist-ng' | |
| 27 | 27 |
lib/todoist-ng/project.rb
(16 / 3)
|   | |||
| 9 | 9 | class Project | |
| 10 | 10 | ||
| 11 | 11 | include Constants | |
| 12 | |||
| 12 | |||
| 13 | 13 | @@token = 'NO_TOKEN!' | |
| 14 | 14 | @@labels = nil | |
| 15 | 15 | @@projects = nil | |
| … | … | ||
| 18 | 18 | def self.token= t | |
| 19 | 19 | @@token = t | |
| 20 | 20 | end | |
| 21 | def self.token | ||
| 22 | @@token | ||
| 23 | end | ||
| 21 | 24 | ||
| 22 | 25 | def initialize details | |
| 23 | 26 | details.each { |k,v| eval "@#{k} = '#{v}'"} | |
| 24 | 27 | @items = nil | |
| 25 | 28 | end | |
| 26 | 29 | ||
| 27 | |||
| 28 | |||
| 29 | 30 | def uncompleted_items | |
| 30 | 31 | # http://todoist.com/API/getUncompletedItems?project_id=22073&token=fb5f22601ec566e48083213f7573e908a7a272e5 | |
| 31 | 32 | begin | |
| … | … | ||
| 151 | 151 | # http://todoist.com/API/getLabels?token=fb5f22601ec566e48083213f7573e908a7a272e5 | |
| 152 | 152 | return @@labels if @@labels && !reload | |
| 153 | 153 | @@labels = JSON.parse(open( "#{BASE_URL}/getLabels?token=#{@@token}").read) | |
| 154 | end | ||
| 155 | |||
| 156 | def self.label_from_id id | ||
| 157 | # The todoist returns labels as a hash, where the key is a string that points | ||
| 158 | # to another hash, and that other hash has a ID. | ||
| 159 | # When you get an Item, and ask for its labels, you get that ID instead | ||
| 160 | # of a simple string. :( | ||
| 161 | # So, this method gets you the label info for that ID | ||
| 162 | self.labels.each do |k, v| | ||
| 163 | return v if v['id'].to_i == id.to_i | ||
| 164 | end | ||
| 165 | nil | ||
| 154 | 166 | end | |
| 155 | 167 | ||
| 156 | 168 |
lib/version.rb
(1 / 1)
|   | |||
| 2 | 2 | module Todoist | |
| 3 | 3 | class Setup | |
| 4 | 4 | # :stopdoc: | |
| 5 | VERSION = '0.2.0' | ||
| 5 | VERSION = '0.2.1' | ||
| 6 | 6 | ||
| 7 | 7 | def self.version | |
| 8 | 8 | VERSION |

