Sha256: 21e7f5f74f48ca8229bca42a5fc931af552ae4e8e3741cd77d01cb63b0244a4a

Contents?: true

Size: 1.55 KB

Versions: 3

Compression:

Stored size: 1.55 KB

Contents

module Todoist
  module Misc
    class Activity < Todoist::Service
        include Todoist::Util  
        
        # Returns the activity logs for a user.  Full list of supported 
        # parameters outlined in the API here: https://developer.todoist.com/#activity
        # The following objects are converted into parameters as appropriate:
        #
        # * object
        # * parent_project
        # * parent_item
        # * initiator
        # * until
        # * since
        
        def get(params={})
          if params["until"]
            params["until"] = ParseHelper.format_time(params["until"])
          end
          
          if params["since"]
            params["since"] = ParseHelper.format_time(params["since"])
          end
          
          if params["object"]
            params["object_id"] = params["object"].id
            params.delete("object")
          end
          
          if params["parent_object"]
            params["parent_object_id"] = params["parent_object"].id
            params.delete("parent_object")
          end
          
          if params["parent_item"]
            params["parent_item_id"] = params["parent_item"].id
            params.delete("parent_item")
          end
          
          if params["initiator"]
            params["initiator_id"] = params["initiator"].id
            params.delete("initiator")
          end
            
          result = @client.api_helper.get_response(Config::TODOIST_ACTIVITY_GET_COMMAND, params)
          ParseHelper.make_objects_as_hash(result)
        end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
todoist-ruby-0.2.3 lib/todoist/misc/activity.rb
todoist-ruby-0.2.2 lib/todoist/misc/activity.rb
todoist-ruby-0.2.1 lib/todoist/misc/activity.rb