Sha256: e7a9d4a2a083e02bbcc002a76e9e875e4821e9189382ba15793bcf2325a792c6

Contents?: true

Size: 1.32 KB

Versions: 1

Compression:

Stored size: 1.32 KB

Contents

module Todoist
  module Misc
    class Projects
        include Todoist::Util  
        
        # Get archived projects.  Returns projects as documented here.
        def get_archived_projects()
          result = NetworkHelper.getResponse(Config::TODOIST_PROJECTS_GET_ARCHIVED_COMMAND)
          return ParseHelper.make_objects_as_array(result)
        end
        
        # Gets project information including all notes.
        
        def get_project_info(project, all_data = true)
          result = NetworkHelper.getResponse(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_array(result["notes"]) : nil
          return {"project" => project, "notes" => notes}
        end
        
        # Gets a project's uncompleted items
        def get_project_data(project)
          result = NetworkHelper.getResponse(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_array(result["items"]) : nil
          return {"project" => project, "items" => items}
        end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
todoist-ruby-0.1.1 lib/todoist/misc/projects.rb