class Podio::TaskLabel

@see developers.podio.com/doc/tasks

Constants

DEFAULT_COLOR_FOR_NEW_LABELS

Public Class Methods

create(attributes) click to toggle source

@see developers.podio.com/doc/tasks/create-label-151265

# File lib/podio/models/task_label.rb, line 39
def create(attributes)
  response = Podio.connection.post do |req|
    req.url "/task/label/"
    req.body = attributes
  end

  response.body['label_id']
end
delete(label_id) click to toggle source

@see developers.podio.com/doc/tasks/delete-label-151302

# File lib/podio/models/task_label.rb, line 49
def delete(label_id)
  Podio.connection.delete("/task/label/#{label_id}").status
end
find_all_labels() click to toggle source

@see developers.podio.com/doc/tasks/get-labels-151534

# File lib/podio/models/task_label.rb, line 32
def find_all_labels
  list Podio.connection.get { |req|
    req.url("/task/label/")
  }.body
end
update(label_id, attributes) click to toggle source

@see developers.podio.com/doc/tasks/update-label-151289

# File lib/podio/models/task_label.rb, line 54
def update(label_id, attributes)
  Podio.connection.put("/task/label/#{label_id}", attributes).status
end

Public Instance Methods

create() click to toggle source

@see developers.podio.com/doc/tasks/create-label-151265

# File lib/podio/models/task_label.rb, line 12
def create
  if self.color.nil? || self.color.empty?
    self.color = DEFAULT_COLOR_FOR_NEW_LABELS
  end

  self.label_id = self.class.create(self.attributes)
end
destroy() click to toggle source

@see developers.podio.com/doc/tasks/delete-label-151302

# File lib/podio/models/task_label.rb, line 21
def destroy
  self.class.delete(self.label_id)
end
update() click to toggle source

@see developers.podio.com/doc/tasks/update-label-151289

# File lib/podio/models/task_label.rb, line 26
def update
  self.class.update(self.label_id, self.attributes)
end