Sha256: 26b1d772c407728fde9d53b91ccf93df776e7493174217f69626db107bf82761

Contents?: true

Size: 719 Bytes

Versions: 1

Compression:

Stored size: 719 Bytes

Contents

require 'bc3client'
require "net/http"
require "uri"
require "bc3client/resource"
require "json"

module Bc3client

  class ToDo < Resource

    def initialize(*args)
      args = args.flatten(1) unless !args[0].is_a?(Array)
      super(args)
      @project_id = args[3]
    end

    def all(todo_list_id)
      get build_uri(todos_path(@project_id, todo_list_id))
    end

    def find_by_id(todo_id)
      get build_uri(todo_path(todo_id))
    end

    private

      def todos_path(todo_list_id)
        "/#{@account_id}/buckets/#{@project_id}/todolists/#{todo_list_id}/todos.json"
      end
    
      def todo_path(todo_id)
        "/#{@account_id}/buckets/#{@project_id}/todos/#{todo_id}.json"
      end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
bc3client-0.1.0 lib/bc3client/todo.rb