Class: Podio::Item
Instance Attribute Summary
#attributes, #error_code, #error_message, #error_parameters, #error_propagate
Class Method Summary
collapse
-
.create(app_id, attributes) ⇒ Object
-
.delete(id) ⇒ Object
-
.find(id) ⇒ 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) ⇒ Object
-
.find_basic_hash(id) ⇒ Object
-
.find_by_filter_id(app_id, filter_id, attributes) ⇒ Object
-
.find_by_filter_values(app_id, filter_values, attributes = {}) ⇒ Object
-
.find_field_top(field_id, options = {:limit => 8}) ⇒ Object
-
.find_next(current_item_id, time = nil) ⇒ Object
-
.find_previous(current_item_id, time = nil) ⇒ Object
-
.search_field(field_id, options = {}) ⇒ Object
-
.update(id, attributes) ⇒ Object
-
.xlsx(app_id, options = {}) ⇒ Object
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(app_id, attributes) ⇒ Object
133
134
135
136
137
138
139
140
|
# File 'lib/podio/models/item.rb', line 133
def create(app_id, attributes)
response = Podio.connection.post do |req|
req.url "/item/app/#{app_id}/"
req.body = attributes
end
response.body['item_id']
end
|
.delete(id) ⇒ Object
150
151
152
|
# File 'lib/podio/models/item.rb', line 150
def delete(id)
Podio.connection.delete("/item/#{id}").body
end
|
.find(id) ⇒ Object
62
63
64
|
# File 'lib/podio/models/item.rb', line 62
def find(id)
member Podio.connection.get("/item/#{id}").body
end
|
.find_all(app_id, options = {}) ⇒ Object
78
79
80
81
82
|
# File 'lib/podio/models/item.rb', line 78
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
74
75
76
|
# File 'lib/podio/models/item.rb', line 74
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
107
108
109
110
111
112
|
# File 'lib/podio/models/item.rb', line 107
def find_app_values(app_id)
response = Podio.connection.get { |req|
req.url("/item/app/#{app_id}/values")
}
response.body
end
|
.find_basic(id) ⇒ Object
66
67
68
|
# File 'lib/podio/models/item.rb', line 66
def find_basic(id)
member Podio.connection.get("/item/#{id}/basic").body
end
|
.find_basic_hash(id) ⇒ Object
70
71
72
|
# File 'lib/podio/models/item.rb', line 70
def find_basic_hash(id)
Podio.connection.get("/item/#{id}/basic").body
end
|
.find_by_filter_id(app_id, filter_id, attributes) ⇒ Object
84
85
86
87
88
89
|
# File 'lib/podio/models/item.rb', line 84
def find_by_filter_id(app_id, filter_id, attributes)
collection Podio.connection.post { |req|
req.url "/item/app/#{app_id}/filter/#{filter_id}/"
req.body = attributes
}.body
end
|
.find_by_filter_values(app_id, filter_values, attributes = {}) ⇒ Object
91
92
93
94
95
96
97
|
# File 'lib/podio/models/item.rb', line 91
def find_by_filter_values(app_id, filter_values, attributes={})
attributes[:filters] = filter_values
collection Podio.connection.post { |req|
req.url "/item/app/#{app_id}/filter/"
req.body = attributes
}.body
end
|
.find_field_top(field_id, options = {:limit => 8}) ⇒ Object
114
115
116
117
118
|
# File 'lib/podio/models/item.rb', line 114
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_next(current_item_id, time = nil) ⇒ Object
99
100
101
|
# File 'lib/podio/models/item.rb', line 99
def find_next(current_item_id, time = nil)
find_next_or_previous(:next, current_item_id, time)
end
|
.find_previous(current_item_id, time = nil) ⇒ Object
103
104
105
|
# File 'lib/podio/models/item.rb', line 103
def find_previous(current_item_id, time = nil)
find_next_or_previous(:previous, current_item_id, time)
end
|
.search_field(field_id, options = {}) ⇒ Object
127
128
129
130
131
|
# File 'lib/podio/models/item.rb', line 127
def search_field(field_id, options={})
list Podio.connection.get { |req|
req.url("/item/field/#{field_id}/find", options)
}.body
end
|
.update(id, attributes) ⇒ Object
142
143
144
145
146
147
148
|
# File 'lib/podio/models/item.rb', line 142
def update(id, attributes)
response = Podio.connection.put do |req|
req.url "/item/#{id}"
req.body = attributes
end
response.status
end
|
.xlsx(app_id, options = {}) ⇒ Object
120
121
122
123
124
125
|
# File 'lib/podio/models/item.rb', line 120
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
38
39
40
|
# File 'lib/podio/models/item.rb', line 38
def create
self.item_id = Item.create(self.app_id, prepare_item_values(self))
end
|
#destroy ⇒ Object
42
43
44
|
# File 'lib/podio/models/item.rb', line 42
def destroy
Item.delete(self.id)
end
|
#update ⇒ Object
46
47
48
|
# File 'lib/podio/models/item.rb', line 46
def update
Item.update(self.id, prepare_item_values(self))
end
|