Class: Podio::TaskLabel
Overview
Constant Summary
collapse
- DEFAULT_COLOR_FOR_NEW_LABELS =
'E9E9E9'
Instance Attribute Summary
#attributes
Class Method Summary
collapse
Instance Method Summary
collapse
#remove_nil_values, #update_attributes
#==, #[], #[]=, #api_friendly_ref_type, #as_json, collection, delegate_to_hash, has_many, has_one, #hash, #initialize, #initialize_attributes, klass_from_string, list, member, #new_record?, output_attribute_as_json, #parent_model, #persisted?, property, #to_param
Class Method Details
.create(attributes) ⇒ Object
39
40
41
42
43
44
45
46
|
# 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) ⇒ Object
49
50
51
|
# 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 ⇒ Object
32
33
34
35
36
|
# 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) ⇒ Object
54
55
56
|
# File 'lib/podio/models/task_label.rb', line 54
def update(label_id, attributes)
Podio.connection.put("/task/label/#{label_id}", attributes).status
end
|
Instance Method Details
#create ⇒ Object
12
13
14
15
16
17
18
|
# 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 ⇒ Object
21
22
23
|
# File 'lib/podio/models/task_label.rb', line 21
def destroy
self.class.delete(self.label_id)
end
|
#update ⇒ Object
26
27
28
|
# File 'lib/podio/models/task_label.rb', line 26
def update
self.class.update(self.label_id, self.attributes)
end
|