Class: Podio::Meeting
Instance Attribute Summary
#attributes, #error_code, #error_message, #error_parameters, #error_propagate
Class Method Summary
collapse
Instance Method Summary
collapse
#==, #[], #[]=, #api_friendly_ref_type, #as_json, collection, delegate_to_hash, handle_api_errors_for, has_many, has_one, #hash, #initialize, list, member, #new_record?, #persisted?, property, #to_param
Class Method Details
.create(attributes) ⇒ Object
70
71
72
73
74
75
76
77
|
# File 'lib/podio/models/meeting.rb', line 70
def create(attributes)
response = Podio.connection.post do |req|
req.url "/meeting/"
req.body = attributes
end
member response.body
end
|
.create_with_ref(ref_type, ref_id, attributes) ⇒ Object
79
80
81
82
83
84
85
86
|
# File 'lib/podio/models/meeting.rb', line 79
def create_with_ref(ref_type, ref_id, attributes)
response = Podio.connection.post do |req|
req.url "/meeting/#{ref_type}/#{ref_id}/"
req.body = attributes
end
member response.body
end
|
.delete(id) ⇒ Object
97
98
99
|
# File 'lib/podio/models/meeting.rb', line 97
def delete(id)
Podio.connection.delete("/meeting/#{id}").status
end
|
.find(id) ⇒ Object
101
102
103
|
# File 'lib/podio/models/meeting.rb', line 101
def find(id)
member Podio.connection.get("/meeting/#{id}").body
end
|
.find_all(options = {}) ⇒ Object
111
112
113
114
115
|
# File 'lib/podio/models/meeting.rb', line 111
def find_all(options={})
list Podio.connection.get { |req|
req.url('/meeting/', options)
}.body
end
|
.find_for_reference(ref_type, ref_id, options = {}) ⇒ Object
105
106
107
108
109
|
# File 'lib/podio/models/meeting.rb', line 105
def find_for_reference(ref_type, ref_id, options={})
list Podio.connection.get { |req|
req.url("/meeting/#{ref_type}/#{ref_id}/", options)
}.body
end
|
.find_personal_summary ⇒ Object
133
134
135
136
137
138
139
|
# File 'lib/podio/models/meeting.rb', line 133
def find_personal_summary
response = Podio.connection.get("/meeting/personal/summary").body
response['past']['tasks'] = list(response['past']['meetings'])
response['today']['tasks'] = list(response['today']['meetings'])
response['future']['tasks'] = list(response['future']['meetings'])
response
end
|
.find_summary ⇒ Object
117
118
119
120
121
122
123
|
# File 'lib/podio/models/meeting.rb', line 117
def find_summary
response = Podio.connection.get("/meeting/summary").body
response['past']['tasks'] = list(response['past']['meetings'])
response['today']['tasks'] = list(response['today']['meetings'])
response['future']['tasks'] = list(response['future']['meetings'])
response
end
|
.find_summary_for_reference(ref_type, ref_id) ⇒ Object
125
126
127
128
129
130
131
|
# File 'lib/podio/models/meeting.rb', line 125
def find_summary_for_reference(ref_type, ref_id)
response = Podio.connection.get("/meeting/#{ref_type}/#{ref_id}/summary").body
response['past']['tasks'] = list(response['past']['meetings'])
response['today']['tasks'] = list(response['today']['meetings'])
response['future']['tasks'] = list(response['future']['meetings'])
response
end
|
.set_participation_status(id, status) ⇒ Object
141
142
143
144
145
146
147
148
|
# File 'lib/podio/models/meeting.rb', line 141
def set_participation_status(id, status)
response = Podio.connection.post do |req|
req.url "/meeting/#{id}/status"
req.body = { :status => status }
end
response.status
end
|
.update(id, attributes) ⇒ Object
88
89
90
91
92
93
94
95
|
# File 'lib/podio/models/meeting.rb', line 88
def update(id, attributes)
response = Podio.connection.put do |req|
req.url "/meeting/#{id}"
req.body = attributes
end
member response.body
end
|
Instance Method Details
#create ⇒ Object
44
45
46
47
48
49
50
51
52
53
|
# File 'lib/podio/models/meeting.rb', line 44
def create
compacted_attributes = remove_nil_values(self.attributes)
created_model = if(self.ref_type.present? && self.ref_id.present?)
self.class.create_with_ref(self.ref_type, self.ref_id, compacted_attributes)
else
self.class.create(compacted_attributes)
end
self.attributes = created_model.attributes
end
|
#destroy ⇒ Object
63
64
65
|
# File 'lib/podio/models/meeting.rb', line 63
def destroy
self.class.delete(self.id)
end
|
#update ⇒ Object
55
56
57
58
59
60
61
|
# File 'lib/podio/models/meeting.rb', line 55
def update
updated_model = self.class.update(self.id, self.attributes)
self.attributes = updated_model.attributes
end
|