Class: Podio::Space
Overview
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
60
61
62
63
64
65
66
67
|
# File 'lib/podio/models/space.rb', line 60
def create(attributes)
response = Podio.connection.post do |req|
req.url '/space/'
req.body = attributes
end
response.body
end
|
.delete(id) ⇒ Object
74
75
76
|
# File 'lib/podio/models/space.rb', line 74
def delete(id)
Podio.connection.delete("/space/#{id}").status
end
|
.find(id, params = {}) ⇒ Object
79
80
81
|
# File 'lib/podio/models/space.rb', line 79
def find(id, params={})
member Podio.connection.get("/space/#{id}", params).body
end
|
.find_all_for_org(org_id) ⇒ Object
103
104
105
|
# File 'lib/podio/models/space.rb', line 103
def find_all_for_org(org_id)
list Podio.connection.get("/org/#{org_id}/space/").body
end
|
.find_all_spaces_for_org(org_id, options = {}) ⇒ Object
107
108
109
|
# File 'lib/podio/models/space.rb', line 107
def find_all_spaces_for_org(org_id, options={})
list Podio.connection.get("/org/#{org_id}/all_spaces/", options).body
end
|
.find_by_url(url) ⇒ Object
94
95
96
|
# File 'lib/podio/models/space.rb', line 94
def find_by_url(url)
member Podio.connection.get("/space/url?url=#{ERB::Util.url_encode(url)}").body
end
|
.find_by_url_slug(org_slug, space_slug, params = {}) ⇒ Object
98
99
100
101
|
# File 'lib/podio/models/space.rb', line 98
def find_by_url_slug(org_slug, space_slug, params={})
params = params.merge(:org_slug => org_slug, :space_slug => space_slug)
member Podio.connection.get("/space/url", params).body
end
|
.find_open_for_org(org_id) ⇒ Object
112
113
114
|
# File 'lib/podio/models/space.rb', line 112
def find_open_for_org(org_id)
list Podio.connection.get("/space/org/#{org_id}/available/").body
end
|
.get_available_seats(space_id) ⇒ Object
131
132
133
|
# File 'lib/podio/models/space.rb', line 131
def get_available_seats(space_id)
Podio.connection.get("/space/#{space_id}/available").body
end
|
.get_count(org_id) ⇒ Object
127
128
129
|
# File 'lib/podio/models/space.rb', line 127
def get_count(org_id)
Podio.connection.get("/space/org/#{org_id}/count").body['count']
end
|
.get_overdue_info(space_id) ⇒ Object
123
124
125
|
# File 'lib/podio/models/space.rb', line 123
def get_overdue_info(space_id)
Podio.connection.get("/space/#{space_id}/overdue").body
end
|
.join(space_id) ⇒ Object
84
85
86
|
# File 'lib/podio/models/space.rb', line 84
def join(space_id)
Podio.connection.post("/space/#{space_id}/join").body
end
|
.leave(space_id) ⇒ Object
89
90
91
|
# File 'lib/podio/models/space.rb', line 89
def leave(space_id)
Podio.connection.post("/space/#{space_id}/leave").status
end
|
.update(space_id, attributes) ⇒ Object
70
71
72
|
# File 'lib/podio/models/space.rb', line 70
def update(space_id, attributes)
Podio.connection.put("/space/#{space_id}", attributes).status
end
|
.validate_url_label(org_id, url_label) ⇒ Object
116
117
118
119
120
121
|
# File 'lib/podio/models/space.rb', line 116
def validate_url_label(org_id, url_label)
Podio.connection.post { |req|
req.url "/space/org/#{org_id}/url/validate"
req.body = {:url_label => url_label}
}.body
end
|
Instance Method Details
#create ⇒ Object
35
36
37
38
39
|
# File 'lib/podio/models/space.rb', line 35
def create
response = Space.create(:org_id => org_id, :name => name, :privacy => self.privacy, :auto_join => self.auto_join)
self.url = response['url']
self.space_id = response['space_id']
end
|
#delete ⇒ Object
54
55
56
|
# File 'lib/podio/models/space.rb', line 54
def delete
self.class.delete(self.id)
end
|
#update ⇒ Object
42
43
44
45
46
47
48
49
50
51
52
|
# File 'lib/podio/models/space.rb', line 42
def update
self.class.update(space_id,
:name => name,
:post_on_new_app => post_on_new_app,
:post_on_new_member => post_on_new_member,
:url_label => url_label,
:privacy => privacy,
:auto_join => auto_join,
:description => description
)
end
|