class Todoist::Command

Attributes

object[RW]
temp_id[RW]
type[RW]
uuid[RW]

Public Class Methods

new(type, object, temp_id = nil, uuid = nil) click to toggle source
# File lib/todoist/command.rb, line 5
def initialize(type, object, temp_id = nil, uuid = nil)
  @type = type
  @object = object
  @temp_id = object.temp_id
  @uuid = uuid || SecureRandom.uuid
end

Public Instance Methods

arguments() click to toggle source
# File lib/todoist/command.rb, line 12
def arguments
  object.to_submittable_hash
end
to_hash() click to toggle source
# File lib/todoist/command.rb, line 16
def to_hash
  {
    type: type,
    uuid: uuid,
    args: object.to_submittable_hash
  }.merge(temp_id ? { temp_id: temp_id} : {})
end