Class: Podio::Item
Overview
Instance Attribute Summary
#attributes
Class Method Summary
collapse
-
.bulk_delete(app_id, attributes) ⇒ Object
-
.calculate(app_id, config) ⇒ Object
-
.cleanup_field_values(app_id) ⇒ Object
-
.clone(item_id, options = {}) ⇒ Object
-
.create(app_id, attributes, options = {}) ⇒ Object
-
.delete(id, options = {}) ⇒ Object
-
.delete_ref(id) ⇒ Object
-
.export(app_id, exporter, options = {}) ⇒ Object
-
.find(id, options = {}) ⇒ Object
-
.find_all(app_id, options = {}) ⇒ Object
-
.find_all_by_external_id(app_id, external_id) ⇒ Object
-
.find_app_values(app_id) ⇒ Object
-
.find_basic(id, options = {}) ⇒ Object
-
.find_basic_by_field(item_id, field_id) ⇒ Object
-
.find_basic_hash_by_field(item_id, field_id) ⇒ Object
-
.find_by_app_item_id(app_id, app_item_id) ⇒ Object
-
.find_by_external_id(app_id, external_id) ⇒ Object
-
.find_by_filter_id(app_id, filter_id, attributes, options = {}) ⇒ Object
-
.find_by_filter_values(app_id, filter_values, attributes = {}, options = {}) ⇒ Object
-
.find_field_top(field_id, options = {:limit => 8}) ⇒ Object
-
.find_meeting_url(id) ⇒ Object
-
.find_references(item_id) ⇒ Object
-
.find_references_by_field(item_id, field_id, options = {}) ⇒ Object
-
.item_count(app_id) ⇒ Object
-
.rearrange(id, attributes, options = {}) ⇒ Object
-
.search_field(field_id, options = {}) ⇒ Object
-
.set_participation(id, status) ⇒ Object
-
.update(id, attributes, options = {}) ⇒ Object
-
.xlsx(app_id, options = {}) ⇒ Object
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
.bulk_delete(app_id, attributes) ⇒ Object
237
238
239
240
241
242
243
244
|
# File 'lib/podio/models/item.rb', line 237
def bulk_delete(app_id, attributes)
response = Podio.connection.post do |req|
req.url("/item/app/#{app_id}/delete")
req.body = attributes
end
response.body
end
|
.calculate(app_id, config) ⇒ Object
174
175
176
177
178
179
180
181
|
# File 'lib/podio/models/item.rb', line 174
def calculate(app_id, config)
response = Podio.connection.post do |req|
req.url "/item/app/#{app_id}/calculate"
req.body = config
end
response.body
end
|
.cleanup_field_values(app_id) ⇒ Object
278
279
280
|
# File 'lib/podio/models/item.rb', line 278
def cleanup_field_values(app_id)
Podio.connection.post("/item/app/#{app_id}/cleanup_field_values").body
end
|
.clone(item_id, options = {}) ⇒ Object
261
262
263
264
265
266
267
|
# File 'lib/podio/models/item.rb', line 261
def clone(item_id, options={})
response = Podio.connection.post do |req|
req.url("/item/#{item_id}/clone", options)
end
response.body['item_id']
end
|
.create(app_id, attributes, options = {}) ⇒ Object
218
219
220
221
222
223
224
225
|
# File 'lib/podio/models/item.rb', line 218
def create(app_id, attributes, options={})
response = Podio.connection.post do |req|
req.url("/item/app/#{app_id}/", options)
req.body = attributes
end
member response.body
end
|
.delete(id, options = {}) ⇒ Object
247
248
249
250
251
252
253
|
# File 'lib/podio/models/item.rb', line 247
def delete(id, options={})
response = Podio.connection.delete do |req|
req.url("/item/#{id}", options)
end
response.body
end
|
.delete_ref(id) ⇒ Object
256
257
258
|
# File 'lib/podio/models/item.rb', line 256
def delete_ref(id)
Podio.connection.delete("/item/#{id}/ref").body
end
|
.export(app_id, exporter, options = {}) ⇒ Object
203
204
205
206
207
208
|
# File 'lib/podio/models/item.rb', line 203
def export(app_id, exporter, options={})
response = Podio.connection.post { |req|
req.url "/item/app/#{app_id}/export/#{exporter}"
req.body = options
}.body
end
|
.find(id, options = {}) ⇒ Object
93
94
95
96
97
|
# File 'lib/podio/models/item.rb', line 93
def find(id, options = {})
member Podio.connection.get { |req|
req.url("/item/#{id}", options)
}.body
end
|
.find_all(app_id, options = {}) ⇒ Object
127
128
129
130
131
|
# File 'lib/podio/models/item.rb', line 127
def find_all(app_id, options={})
collection Podio.connection.get { |req|
req.url("/item/app/#{app_id}/", options)
}.body
end
|
.find_all_by_external_id(app_id, external_id) ⇒ Object
122
123
124
|
# File 'lib/podio/models/item.rb', line 122
def find_all_by_external_id(app_id, external_id)
collection Podio.connection.get("/item/app/#{app_id}/v2/?external_id=#{external_id}").body
end
|
.find_app_values(app_id) ⇒ Object
151
152
153
154
155
156
|
# File 'lib/podio/models/item.rb', line 151
def find_app_values(app_id)
response = Podio.connection.get { |req|
req.url("/item/app/#{app_id}/values")
}
response.body
end
|
.find_basic(id, options = {}) ⇒ Object
104
105
106
107
108
|
# File 'lib/podio/models/item.rb', line 104
def find_basic(id, options={})
member Podio.connection.get { |req|
req.url("/item/#{id}/basic", options)
}.body
end
|
.find_basic_by_field(item_id, field_id) ⇒ Object
110
111
112
|
# File 'lib/podio/models/item.rb', line 110
def find_basic_by_field(item_id, field_id)
member Podio.connection.get("/item/#{item_id}/reference/#{field_id}/preview").body
end
|
.find_basic_hash_by_field(item_id, field_id) ⇒ Object
114
115
116
|
# File 'lib/podio/models/item.rb', line 114
def find_basic_hash_by_field(item_id, field_id)
Podio.connection.get("/item/#{item_id}/reference/#{field_id}/preview").body
end
|
.find_by_app_item_id(app_id, app_item_id) ⇒ Object
99
100
101
|
# File 'lib/podio/models/item.rb', line 99
def find_by_app_item_id(app_id, app_item_id)
member Podio.connection.get("/app/#{app_id}/item/#{app_item_id}").body
end
|
.find_by_external_id(app_id, external_id) ⇒ Object
118
119
120
|
# File 'lib/podio/models/item.rb', line 118
def find_by_external_id(app_id, external_id)
member Podio.connection.get("/item/app/#{app_id}/external_id/#{external_id}").body
end
|
.find_by_filter_id(app_id, filter_id, attributes, options = {}) ⇒ Object
134
135
136
137
138
139
|
# File 'lib/podio/models/item.rb', line 134
def find_by_filter_id(app_id, filter_id, attributes, options={})
collection Podio.connection.post { |req|
req.url("/item/app/#{app_id}/filter/#{filter_id}/", options)
req.body = attributes
}.body
end
|
.find_by_filter_values(app_id, filter_values, attributes = {}, options = {}) ⇒ Object
142
143
144
145
146
147
148
|
# File 'lib/podio/models/item.rb', line 142
def find_by_filter_values(app_id, filter_values, attributes={}, options={})
attributes[:filters] = filter_values
collection Podio.connection.post { |req|
req.url("/item/app/#{app_id}/filter/", options)
req.body = attributes
}.body
end
|
.find_field_top(field_id, options = {:limit => 8}) ⇒ Object
183
184
185
186
187
|
# File 'lib/podio/models/item.rb', line 183
def find_field_top(field_id, options={:limit => 8})
list Podio.connection.get { |req|
req.url("/item/field/#{field_id}/top/", options)
}.body
end
|
.find_meeting_url(id) ⇒ Object
292
293
294
295
296
297
|
# File 'lib/podio/models/item.rb', line 292
def find_meeting_url(id)
response = Podio.connection.get { |req|
req.url("/item/#{id}/meeting/url")
}
response.body
end
|
.find_references(item_id) ⇒ Object
159
160
161
162
163
164
|
# File 'lib/podio/models/item.rb', line 159
def find_references(item_id)
response = Podio.connection.get { |req|
req.url("/item/#{item_id}/reference/")
}
response.body
end
|
.find_references_by_field(item_id, field_id, options = {}) ⇒ Object
167
168
169
170
171
|
# File 'lib/podio/models/item.rb', line 167
def find_references_by_field(item_id, field_id, options = {})
list Podio.connection.get { |req|
req.url("/item/#{item_id}/reference/field/#{field_id}", options)
}.body
end
|
.item_count(app_id) ⇒ Object
190
191
192
|
# File 'lib/podio/models/item.rb', line 190
def item_count(app_id)
Podio.connection.get("/item/app/#{app_id}/count/").body
end
|
.rearrange(id, attributes, options = {}) ⇒ Object
282
283
284
285
286
287
288
289
|
# File 'lib/podio/models/item.rb', line 282
def rearrange(id, attributes, options = {})
response = Podio.connection.post do |req|
req.url("/item/#{id}/rearrange", options)
req.body = attributes
end
member response.body
end
|
.search_field(field_id, options = {}) ⇒ Object
211
212
213
214
215
|
# File 'lib/podio/models/item.rb', line 211
def search_field(field_id, options={})
list Podio.connection.get { |req|
req.url("/item/field/#{field_id}/find", options)
}.body
end
|
.set_participation(id, status) ⇒ Object
270
271
272
273
274
275
276
|
# File 'lib/podio/models/item.rb', line 270
def set_participation(id, status)
response = Podio.connection.put do |req|
req.url "/item/#{id}/participation"
req.body = { :status => status }
end
response.status
end
|
.update(id, attributes, options = {}) ⇒ Object
228
229
230
231
232
233
234
|
# File 'lib/podio/models/item.rb', line 228
def update(id, attributes, options={})
response = Podio.connection.put do |req|
req.url("/item/#{id}", options)
req.body = attributes
end
response.status
end
|
.xlsx(app_id, options = {}) ⇒ Object
195
196
197
198
199
200
|
# File 'lib/podio/models/item.rb', line 195
def xlsx(app_id, options={})
response = Podio.connection.get { |req|
req.url("/item/app/#{app_id}/xlsx/", options)
}
response.body
end
|
Instance Method Details
#create ⇒ Object
66
67
68
69
70
|
# File 'lib/podio/models/item.rb', line 66
def create
model = self.class.create(self.app_id, prepare_item_values(self))
self.attributes = model.attributes
self
end
|
#destroy ⇒ Object
73
74
75
|
# File 'lib/podio/models/item.rb', line 73
def destroy
self.class.delete(self.id)
end
|
#update ⇒ Object
78
79
80
|
# File 'lib/podio/models/item.rb', line 78
def update
self.class.update(self.id, prepare_item_values(self))
end
|