Sha256: 4f6badc69a096cfb152a964a6340add1e76f6a019fe1bca8944b31e66cf9f812

Contents?: true

Size: 1.35 KB

Versions: 7

Compression:

Stored size: 1.35 KB

Contents

module Todoist
  module Misc
    class Projects < Todoist::Service
        include Todoist::Util  
        
        # Get archived projects.  Returns projects as documented here.
        def get_archived_projects()
          result = @client.api_helper.get_response(Config::TODOIST_PROJECTS_GET_ARCHIVED_COMMAND)
          return ParseHelper.make_objects_as_hash(result)
        end
        
        # Gets project information including all notes.
        
        def get_project_info(project, all_data = true)
          result = @client.api_helper.get_response(Config::TODOIST_PROJECTS_GET_COMMAND, {project_id: project.id, all_data: true})
          
          project = result["project"] ? ParseHelper.make_object(result["project"]) : nil
          notes = result["notes"] ? ParseHelper.make_objects_as_hash(result["notes"]) : nil
          return {"project" => project, "notes" => notes}
        end
        
        # Gets a project's uncompleted items
        def get_project_data(project)
          result = @client.api_helper.get_response(Config::TODOIST_PROJECTS_GET_DATA_COMMAND, {project_id: project.id})
          project = result["project"] ? ParseHelper.make_object(result["project"]) : nil
          items = result["items"] ? ParseHelper.make_objects_as_hash(result["items"]) : nil
          return {"project" => project, "items" => items}
        end
    end
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
todoist-ruby-0.2.7 lib/todoist/misc/projects.rb
todoist-ruby-0.2.6 lib/todoist/misc/projects.rb
todoist-ruby-0.2.5 lib/todoist/misc/projects.rb
todoist-ruby-0.2.4 lib/todoist/misc/projects.rb
todoist-ruby-0.2.3 lib/todoist/misc/projects.rb
todoist-ruby-0.2.2 lib/todoist/misc/projects.rb
todoist-ruby-0.2.1 lib/todoist/misc/projects.rb