podio 0.8.0 → 1.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +3 -0
- data/Gemfile +9 -2
- data/README.md +1 -4
- data/examples/oauth_web_flow/Gemfile +4 -0
- data/examples/{sinatra.rb → oauth_web_flow/sinatra.rb} +7 -6
- data/lib/podio.rb +18 -3
- data/lib/podio/active_podio/base.rb +107 -62
- data/lib/podio/client.rb +30 -5
- data/lib/podio/error.rb +22 -10
- data/lib/podio/middleware/error_response.rb +23 -16
- data/lib/podio/middleware/json_response.rb +1 -1
- data/lib/podio/middleware/logger.rb +3 -0
- data/lib/podio/middleware/oauth2.rb +3 -0
- data/lib/podio/models/account_provider.rb +1 -0
- data/lib/podio/models/action.rb +19 -2
- data/lib/podio/models/activation_status.rb +8 -2
- data/lib/podio/models/app_store_category.rb +4 -1
- data/lib/podio/models/app_store_share.rb +29 -16
- data/lib/podio/models/application.rb +57 -2
- data/lib/podio/models/application_email.rb +5 -2
- data/lib/podio/models/application_field.rb +5 -2
- data/lib/podio/models/batch.rb +8 -0
- data/lib/podio/models/by_line.rb +2 -1
- data/lib/podio/models/calendar_event.rb +63 -3
- data/lib/podio/models/calendar_mute.rb +6 -1
- data/lib/podio/models/category.rb +1 -0
- data/lib/podio/models/comment.rb +29 -8
- data/lib/podio/models/condition.rb +8 -0
- data/lib/podio/models/condition_set.rb +40 -0
- data/lib/podio/models/contact.rb +13 -2
- data/lib/podio/models/contract.rb +85 -1
- data/lib/podio/models/contract_event.rb +17 -0
- data/lib/podio/models/contract_price.rb +3 -7
- data/lib/podio/models/contract_price_v2.rb +31 -0
- data/lib/podio/models/contract_user.rb +4 -0
- data/lib/podio/models/conversation.rb +114 -13
- data/lib/podio/models/conversation_event.rb +51 -0
- data/lib/podio/models/conversation_message.rb +2 -1
- data/lib/podio/models/conversation_participant.rb +3 -2
- data/lib/podio/models/date_election.rb +35 -0
- data/lib/podio/models/email_contact.rb +46 -0
- data/lib/podio/models/email_subscription_setting.rb +4 -23
- data/lib/podio/models/embed.rb +4 -4
- data/lib/podio/models/experiment.rb +71 -0
- data/lib/podio/models/external_file.rb +7 -2
- data/lib/podio/models/file_attachment.rb +23 -0
- data/lib/podio/models/form.rb +7 -0
- data/lib/podio/models/friend.rb +12 -0
- data/lib/podio/models/grant.rb +73 -0
- data/lib/podio/models/hook.rb +13 -6
- data/lib/podio/models/importer.rb +3 -0
- data/lib/podio/models/integration.rb +17 -6
- data/lib/podio/models/invoice.rb +30 -0
- data/lib/podio/models/item.rb +81 -14
- data/lib/podio/models/item_diff.rb +9 -5
- data/lib/podio/models/item_field.rb +11 -2
- data/lib/podio/models/item_revision.rb +5 -2
- data/lib/podio/models/linked_account.rb +1 -0
- data/lib/podio/models/live.rb +61 -0
- data/lib/podio/models/net_promoter_score.rb +28 -0
- data/lib/podio/models/notification.rb +9 -4
- data/lib/podio/models/notification_group.rb +5 -2
- data/lib/podio/models/o_auth.rb +4 -2
- data/lib/podio/models/o_auth_client.rb +1 -2
- data/lib/podio/models/organization.rb +22 -10
- data/lib/podio/models/organization_contact.rb +2 -1
- data/lib/podio/models/organization_member.rb +17 -3
- data/lib/podio/models/organization_profile.rb +8 -2
- data/lib/podio/models/pin.rb +27 -0
- data/lib/podio/models/profile.rb +19 -50
- data/lib/podio/models/promotion.rb +91 -0
- data/lib/podio/models/rating.rb +23 -5
- data/lib/podio/models/recurrence.rb +6 -3
- data/lib/podio/models/reference.rb +17 -1
- data/lib/podio/models/reminder.rb +8 -3
- data/lib/podio/models/search.rb +7 -1
- data/lib/podio/models/space.rb +41 -2
- data/lib/podio/models/space_contact.rb +1 -2
- data/lib/podio/models/space_invitation.rb +4 -5
- data/lib/podio/models/space_member.rb +37 -4
- data/lib/podio/models/status.rb +20 -8
- data/lib/podio/models/stream_activity_group.rb +40 -0
- data/lib/podio/models/stream_mute.rb +7 -8
- data/lib/podio/models/stream_object.rb +19 -11
- data/lib/podio/models/subscription.rb +7 -1
- data/lib/podio/models/tag.rb +6 -1
- data/lib/podio/models/tag_search.rb +2 -1
- data/lib/podio/models/task.rb +74 -18
- data/lib/podio/models/task_label.rb +10 -2
- data/lib/podio/models/user.rb +50 -6
- data/lib/podio/models/user_mail.rb +4 -0
- data/lib/podio/models/user_status.rb +7 -0
- data/lib/podio/models/view.rb +27 -7
- data/lib/podio/models/widget.rb +25 -3
- data/lib/podio/version.rb +1 -1
- data/podio.gemspec +13 -10
- data/script/config.example.rb +6 -0
- data/script/referenceGenerator.rb +87 -0
- data/test/active_podio_test.rb +44 -34
- data/test/client_test.rb +13 -2
- metadata +89 -36
- data/lib/podio/middleware/date_conversion.rb +0 -37
- data/lib/podio/models/bulletin.rb +0 -60
- data/lib/podio/models/connection.rb +0 -53
- data/lib/podio/models/news.rb +0 -85
@@ -0,0 +1,91 @@
|
|
1
|
+
class Podio::Promotion < ActivePodio::Base
|
2
|
+
property :promotion_id, :integer
|
3
|
+
property :name, :string
|
4
|
+
property :status, :string
|
5
|
+
property :display_type, :string
|
6
|
+
property :display_data, :hash
|
7
|
+
property :context, :string
|
8
|
+
property :contextual, :boolean
|
9
|
+
property :priority, :integer
|
10
|
+
property :max_views, :integer
|
11
|
+
property :max_uses, :integer
|
12
|
+
property :max_duration, :integer
|
13
|
+
property :sleep, :integer
|
14
|
+
property :condition_set_ids, :array
|
15
|
+
|
16
|
+
alias_method :id, :promotion_id
|
17
|
+
|
18
|
+
class << self
|
19
|
+
def find_all(options={})
|
20
|
+
list Podio.connection.get { |req|
|
21
|
+
req.url("/promotion/", options)
|
22
|
+
}.body
|
23
|
+
end
|
24
|
+
|
25
|
+
def find(promotion_id)
|
26
|
+
member Podio.connection.get("/promotion/#{promotion_id}").body
|
27
|
+
end
|
28
|
+
|
29
|
+
def create(attributes)
|
30
|
+
member Podio.connection.post { |req|
|
31
|
+
req.url("/promotion/")
|
32
|
+
req.body = attributes
|
33
|
+
}.body
|
34
|
+
end
|
35
|
+
|
36
|
+
def update(promotion_id, attributes)
|
37
|
+
member Podio.connection.put { |req|
|
38
|
+
req.url("/promotion/#{promotion_id}")
|
39
|
+
req.body = attributes
|
40
|
+
}.body
|
41
|
+
end
|
42
|
+
|
43
|
+
def enable(promotion_id)
|
44
|
+
member Podio.connection.post("/promotion/#{promotion_id}/enable").body
|
45
|
+
end
|
46
|
+
|
47
|
+
def disable(promotion_id)
|
48
|
+
member Podio.connection.post("/promotion/#{promotion_id}/disable").body
|
49
|
+
end
|
50
|
+
|
51
|
+
def delete(promotion_id)
|
52
|
+
Podio.connection.delete("/promotion/#{promotion_id}")
|
53
|
+
end
|
54
|
+
|
55
|
+
def stats(promotion_id)
|
56
|
+
Podio.connection.get("/promotion/#{promotion_id}/stats").body
|
57
|
+
end
|
58
|
+
|
59
|
+
def assign(promotion_id, user_id, body)
|
60
|
+
Podio.connection.post { |req|
|
61
|
+
req.url("/promotion/#{promotion_id}/assign/#{user_id}")
|
62
|
+
req.body = body
|
63
|
+
}
|
64
|
+
end
|
65
|
+
|
66
|
+
def find_for_context(context_name, options = {})
|
67
|
+
result = Podio.connection.get("/promotion/#{context_name}", options)
|
68
|
+
|
69
|
+
if result.body.present?
|
70
|
+
member(result.body)
|
71
|
+
else
|
72
|
+
nil
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
76
|
+
def end(promotion_id, body = nil)
|
77
|
+
Podio.connection.post { |req|
|
78
|
+
req.url "/promotion/#{promotion_id}/end"
|
79
|
+
req.body = body
|
80
|
+
}
|
81
|
+
end
|
82
|
+
|
83
|
+
def click(promotion_id, body = nil)
|
84
|
+
Podio.connection.post { |req|
|
85
|
+
req.url "/promotion/#{promotion_id}/click"
|
86
|
+
req.body = body
|
87
|
+
}
|
88
|
+
end
|
89
|
+
end
|
90
|
+
|
91
|
+
end
|
data/lib/podio/models/rating.rb
CHANGED
@@ -1,12 +1,14 @@
|
|
1
|
+
# @see https://developers.podio.com/doc/ratings
|
1
2
|
class Podio::Rating < ActivePodio::Base
|
2
3
|
|
3
4
|
property :rating_id, :integer
|
4
5
|
property :type, :string
|
5
6
|
property :value, :string
|
6
|
-
|
7
|
+
|
7
8
|
alias_method :id, :rating_id
|
8
|
-
|
9
|
+
|
9
10
|
class << self
|
11
|
+
# @see https://developers.podio.com/doc/ratings/add-rating-22377
|
10
12
|
def create(ref_type, ref_id, rating_type, value)
|
11
13
|
response = Podio.connection.post do |req|
|
12
14
|
req.url "/rating/#{ref_type}/#{ref_id}/#{rating_type}"
|
@@ -16,25 +18,41 @@ class Podio::Rating < ActivePodio::Base
|
|
16
18
|
response.body['rating_id']
|
17
19
|
end
|
18
20
|
|
21
|
+
# @see https://developers.podio.com/doc/ratings/get-all-ratings-22376
|
19
22
|
def find_all(ref_type, ref_id)
|
20
23
|
collection Podio.connection.get("/rating/#{ref_type}/#{ref_id}").body
|
21
24
|
end
|
22
|
-
|
25
|
+
|
26
|
+
# @see https://developers.podio.com/doc/ratings/get-rating-22407
|
23
27
|
def find(ref_type, ref_id, rating_type, user_id)
|
24
28
|
Podio.connection.get("/rating/#{ref_type}/#{ref_id}/#{rating_type}/#{user_id}").body['value']
|
25
29
|
end
|
26
30
|
|
31
|
+
# @see https://developers.podio.com/doc/ratings/get-rating-own-84128
|
27
32
|
def find_own(ref_type, ref_id, rating_type)
|
28
33
|
Podio.connection.get("/rating/#{ref_type}/#{ref_id}/#{rating_type}/self").body['value']
|
29
34
|
end
|
30
35
|
|
36
|
+
# @see https://developers.podio.com/doc/ratings/get-ratings-22375
|
31
37
|
def find_all_by_type(ref_type, ref_id, rating_type)
|
32
38
|
collection Podio.connection.get("/rating/#{ref_type}/#{ref_id}/#{rating_type}").body
|
33
39
|
end
|
34
40
|
|
41
|
+
# @see https://developers.podio.com/doc/ratings/remove-rating-22342
|
35
42
|
def delete(ref_type, ref_id, rating_type)
|
36
43
|
Podio.connection.delete("/rating/#{ref_type}/#{ref_id}/#{rating_type}").body
|
37
44
|
end
|
45
|
+
|
46
|
+
# @see https://developers.podio.com/doc/comments/get-who-liked-a-comment-29007011
|
47
|
+
def liked_by(ref_type, ref_id)
|
48
|
+
Podio.connection.get("/rating/#{ref_type}/#{ref_id}/liked_by/").body.map{|values| Podio::Contact.new(values)}
|
49
|
+
end
|
50
|
+
|
51
|
+
# @see https://developers.podio.com/doc/ratings/get-like-count-32161225
|
52
|
+
def like_count(ref_type, ref_id)
|
53
|
+
Podio.connection.get("/rating/#{ref_type}/#{ref_id}/like_count").body["like_count"]
|
54
|
+
end
|
55
|
+
|
38
56
|
end
|
39
|
-
|
40
|
-
end
|
57
|
+
|
58
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# @see https://developers.podio.com/doc/recurrence
|
1
2
|
class Podio::Recurrence < ActivePodio::Base
|
2
3
|
property :recurrence_id, :integer
|
3
4
|
property :name, :string
|
@@ -7,12 +8,14 @@ class Podio::Recurrence < ActivePodio::Base
|
|
7
8
|
|
8
9
|
alias_method :id, :recurrence_id
|
9
10
|
delegate_to_hash :config, :days, :repeat_on, :setter => true
|
10
|
-
|
11
|
+
|
11
12
|
class << self
|
13
|
+
# @see https://developers.podio.com/doc/recurrence/delete-recurrence-3349970
|
12
14
|
def delete(ref_type, ref_id)
|
13
15
|
Podio.connection.delete("/recurrence/#{ref_type}/#{ref_id}").body
|
14
16
|
end
|
15
|
-
|
17
|
+
|
18
|
+
# @see https://developers.podio.com/doc/recurrence/create-or-update-recurrence-3349957
|
16
19
|
def update(ref_type, ref_id, attributes)
|
17
20
|
response = Podio.connection.put do |req|
|
18
21
|
req.url "/recurrence/#{ref_type}/#{ref_id}"
|
@@ -21,5 +24,5 @@ class Podio::Recurrence < ActivePodio::Base
|
|
21
24
|
response.status
|
22
25
|
end
|
23
26
|
end
|
24
|
-
|
27
|
+
|
25
28
|
end
|
@@ -1,7 +1,9 @@
|
|
1
|
+
# @see https://developers.podio.com/doc/reference
|
1
2
|
class Podio::Reference < ActivePodio::Base
|
2
3
|
|
3
4
|
property :type, :string
|
4
5
|
property :id, :integer
|
6
|
+
property :type_name, :string
|
5
7
|
property :title, :string
|
6
8
|
property :link, :string
|
7
9
|
property :data, :hash
|
@@ -11,13 +13,15 @@ class Podio::Reference < ActivePodio::Base
|
|
11
13
|
has_one :created_via, :class => 'Via'
|
12
14
|
|
13
15
|
class << self
|
16
|
+
# @see https://developers.podio.com/doc/reference/get-reference-10661022
|
14
17
|
def find(ref_type, ref_id, options = {})
|
15
18
|
member Podio.connection.get { |req|
|
16
19
|
req.url("/reference/#{ref_type}/#{ref_id}", options)
|
17
20
|
}.body
|
18
21
|
end
|
19
22
|
|
20
|
-
|
23
|
+
# @see https://developers.podio.com/doc/reference/search-references-13312595
|
24
|
+
def search(target, query, limit, target_params = nil)
|
21
25
|
response = Podio.connection.post do |req|
|
22
26
|
req.url "/reference/search"
|
23
27
|
req.body = {
|
@@ -25,9 +29,21 @@ class Podio::Reference < ActivePodio::Base
|
|
25
29
|
:text => query,
|
26
30
|
:limit => limit
|
27
31
|
}
|
32
|
+
req.body[:target_params] = target_params if target_params.present?
|
28
33
|
end
|
29
34
|
response.body
|
30
35
|
end
|
31
36
|
|
37
|
+
# @see https://developers.podio.com/doc/reference/get-users-with-access-to-object-16681010
|
38
|
+
def find_users_with_access(ref_type, ref_id, options = {})
|
39
|
+
self.klass_from_string('Contact').list Podio.connection.get { |req|
|
40
|
+
req.url("/reference/#{ref_type}/#{ref_id}/accessible_by/", options)
|
41
|
+
}.body
|
42
|
+
end
|
43
|
+
|
44
|
+
# @see https://developers.podio.com/doc/reference/count-user-profiles-with-access-to-object-19190550
|
45
|
+
def count_users_with_access(ref_type, ref_id)
|
46
|
+
Podio.connection.get("/reference/#{ref_type}/#{ref_id}/accessible_by/count").body['count']
|
47
|
+
end
|
32
48
|
end
|
33
49
|
end
|
@@ -1,18 +1,22 @@
|
|
1
|
+
# @see https://developers.podio.com/doc/reminders
|
1
2
|
class Podio::Reminder < ActivePodio::Base
|
2
3
|
property :reminder_id, :integer
|
3
4
|
property :remind_delta, :integer
|
4
5
|
|
5
6
|
alias_method :id, :reminder_id
|
6
|
-
|
7
|
+
|
7
8
|
class << self
|
9
|
+
# @see https://developers.podio.com/doc/reminders/delete-reminder-3315117
|
8
10
|
def delete(ref_type, ref_id)
|
9
11
|
Podio.connection.delete("/reminder/#{ref_type}/#{ref_id}").body
|
10
12
|
end
|
11
|
-
|
13
|
+
|
14
|
+
# @see https://developers.podio.com/doc/reminders/snooze-reminder-3321049
|
12
15
|
def snooze(ref_type, ref_id)
|
13
16
|
Podio.connection.post("/reminder/#{ref_type}/#{ref_id}/snooze").body
|
14
17
|
end
|
15
18
|
|
19
|
+
# @see https://developers.podio.com/doc/reminders/create-or-update-reminder-3315055
|
16
20
|
def create(ref_type, ref_id, attributes)
|
17
21
|
response = Podio.connection.post do |req|
|
18
22
|
req.url "/reminder/#{ref_type}/#{ref_id}"
|
@@ -21,6 +25,7 @@ class Podio::Reminder < ActivePodio::Base
|
|
21
25
|
response.status
|
22
26
|
end
|
23
27
|
|
28
|
+
# @see https://developers.podio.com/doc/reminders/create-or-update-reminder-3315055
|
24
29
|
def update(ref_type, ref_id, attributes)
|
25
30
|
response = Podio.connection.put do |req|
|
26
31
|
req.url "/reminder/#{ref_type}/#{ref_id}"
|
@@ -29,5 +34,5 @@ class Podio::Reminder < ActivePodio::Base
|
|
29
34
|
response.status
|
30
35
|
end
|
31
36
|
end
|
32
|
-
|
37
|
+
|
33
38
|
end
|
data/lib/podio/models/search.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# @see https://developers.podio.com/doc/search
|
1
2
|
class Podio::Search < ActivePodio::Base
|
2
3
|
property :type, :string
|
3
4
|
property :id, :integer
|
@@ -13,15 +14,18 @@ class Podio::Search < ActivePodio::Base
|
|
13
14
|
has_one :space, :class => 'Space'
|
14
15
|
|
15
16
|
class << self
|
17
|
+
# @see https://developers.podio.com/doc/search/search-in-organization-22487
|
16
18
|
def in_org(org_id, words)
|
19
|
+
attributes[:query] = words
|
17
20
|
response = Podio.connection.post do |req|
|
18
21
|
req.url "/search/org/#{org_id}/"
|
19
|
-
req.body =
|
22
|
+
req.body = attributes
|
20
23
|
end
|
21
24
|
|
22
25
|
list response.body
|
23
26
|
end
|
24
27
|
|
28
|
+
# @see https://developers.podio.com/doc/search/search-globally-22488
|
25
29
|
def globally(words, attributes={})
|
26
30
|
attributes[:query] = words
|
27
31
|
response = Podio.connection.post do |req|
|
@@ -32,6 +36,7 @@ class Podio::Search < ActivePodio::Base
|
|
32
36
|
list response.body
|
33
37
|
end
|
34
38
|
|
39
|
+
# @see https://developers.podio.com/doc/search/search-in-space-22479
|
35
40
|
def in_space(space_id, words, attributes={})
|
36
41
|
attributes[:query] = words
|
37
42
|
response = Podio.connection.post do |req|
|
@@ -42,6 +47,7 @@ class Podio::Search < ActivePodio::Base
|
|
42
47
|
list response.body
|
43
48
|
end
|
44
49
|
|
50
|
+
# @see https://developers.podio.com/doc/search/search-in-app-4234651
|
45
51
|
def in_app(app_id, words, attributes={})
|
46
52
|
attributes[:query] = words
|
47
53
|
response = Podio.connection.post do |req|
|
data/lib/podio/models/space.rb
CHANGED
@@ -1,13 +1,16 @@
|
|
1
|
+
# @see https://developers.podio.com/doc/spaces
|
1
2
|
class Podio::Space < ActivePodio::Base
|
2
3
|
include ActivePodio::Updatable
|
3
4
|
|
4
5
|
property :space_id, :integer
|
5
6
|
property :name, :string
|
7
|
+
property :description, :string
|
6
8
|
property :url, :string
|
7
9
|
property :url_label, :string
|
8
10
|
property :org_id, :integer
|
9
11
|
property :contact_count, :integer
|
10
|
-
property :
|
12
|
+
property :member_count, :integer
|
13
|
+
property :app_count, :integer
|
11
14
|
property :role, :string
|
12
15
|
property :rights, :array
|
13
16
|
property :post_on_new_app, :boolean
|
@@ -19,19 +22,32 @@ class Podio::Space < ActivePodio::Base
|
|
19
22
|
property :premium, :boolean
|
20
23
|
property :last_activity_on, :datetime
|
21
24
|
property :created_on, :datetime
|
25
|
+
property :is_overdue, :boolean
|
26
|
+
property :push, :hash
|
22
27
|
|
23
28
|
has_one :created_by, :class => 'ByLine'
|
29
|
+
has_one :org, :class => 'Organization'
|
24
30
|
|
25
31
|
alias_method :id, :space_id
|
26
32
|
|
33
|
+
# @see https://developers.podio.com/doc/spaces/create-space-22390
|
27
34
|
def create
|
28
35
|
response = Space.create(:org_id => org_id, :name => name, :privacy => self.privacy, :auto_join => self.auto_join)
|
29
36
|
self.url = response['url']
|
30
37
|
self.space_id = response['space_id']
|
31
38
|
end
|
32
39
|
|
40
|
+
# @see https://developers.podio.com/doc/spaces/update-space-22391
|
33
41
|
def update
|
34
|
-
self.class.update(
|
42
|
+
self.class.update(space_id,
|
43
|
+
:name => name,
|
44
|
+
:post_on_new_app => post_on_new_app,
|
45
|
+
:post_on_new_member => post_on_new_member,
|
46
|
+
:url_label => url_label,
|
47
|
+
:privacy => privacy,
|
48
|
+
:auto_join => auto_join,
|
49
|
+
:description => description
|
50
|
+
)
|
35
51
|
end
|
36
52
|
|
37
53
|
def delete
|
@@ -39,6 +55,7 @@ class Podio::Space < ActivePodio::Base
|
|
39
55
|
end
|
40
56
|
|
41
57
|
class << self
|
58
|
+
# @see https://developers.podio.com/doc/spaces/create-space-22390
|
42
59
|
def create(attributes)
|
43
60
|
response = Podio.connection.post do |req|
|
44
61
|
req.url '/space/'
|
@@ -48,6 +65,7 @@ class Podio::Space < ActivePodio::Base
|
|
48
65
|
response.body
|
49
66
|
end
|
50
67
|
|
68
|
+
# @see https://developers.podio.com/doc/spaces/update-space-22391
|
51
69
|
def update(space_id, attributes)
|
52
70
|
Podio.connection.put("/space/#{space_id}", attributes).status
|
53
71
|
end
|
@@ -56,18 +74,30 @@ class Podio::Space < ActivePodio::Base
|
|
56
74
|
Podio.connection.delete("/space/#{id}").status
|
57
75
|
end
|
58
76
|
|
77
|
+
# @see https://developers.podio.com/doc/spaces/get-space-22389
|
59
78
|
def find(id)
|
60
79
|
member Podio.connection.get("/space/#{id}").body
|
61
80
|
end
|
62
81
|
|
82
|
+
# @see https://developers.podio.com/doc/space-members/join-space-1927286
|
63
83
|
def join(space_id)
|
64
84
|
Podio.connection.post("/space/#{space_id}/join").body
|
65
85
|
end
|
66
86
|
|
87
|
+
# @see https://developers.podio.com/doc/organizations/end-organization-membership-19410457
|
88
|
+
def leave(space_id)
|
89
|
+
Podio.connection.post("/space/#{space_id}/leave").status
|
90
|
+
end
|
91
|
+
|
92
|
+
# @see https://developers.podio.com/doc/spaces/get-space-by-url-22481
|
67
93
|
def find_by_url(url)
|
68
94
|
member Podio.connection.get("/space/url?url=#{ERB::Util.url_encode(url)}").body
|
69
95
|
end
|
70
96
|
|
97
|
+
def find_by_url_slug(org_slug, space_slug)
|
98
|
+
member Podio.connection.get("/space/url", :org_slug => org_slug, :space_slug => space_slug).body
|
99
|
+
end
|
100
|
+
|
71
101
|
def find_all_for_org(org_id)
|
72
102
|
list Podio.connection.get("/org/#{org_id}/space/").body
|
73
103
|
end
|
@@ -76,6 +106,7 @@ class Podio::Space < ActivePodio::Base
|
|
76
106
|
list Podio.connection.get("/org/#{org_id}/all_spaces/", options).body
|
77
107
|
end
|
78
108
|
|
109
|
+
# @see https://developers.podio.com/doc/spaces/get-available-spaces-1911961
|
79
110
|
def find_open_for_org(org_id)
|
80
111
|
list Podio.connection.get("/space/org/#{org_id}/available/").body
|
81
112
|
end
|
@@ -87,6 +118,14 @@ class Podio::Space < ActivePodio::Base
|
|
87
118
|
}.body
|
88
119
|
end
|
89
120
|
|
121
|
+
def get_overdue_info(space_id)
|
122
|
+
Podio.connection.get("/space/#{space_id}/overdue").body
|
123
|
+
end
|
124
|
+
|
125
|
+
def get_count(org_id)
|
126
|
+
Podio.connection.get("/space/org/#{org_id}").body['count']
|
127
|
+
end
|
128
|
+
|
90
129
|
end
|
91
130
|
end
|
92
131
|
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# @see https://developers.podio.com/doc/contacts
|
1
2
|
class Podio::SpaceContact < Podio::Profile
|
2
3
|
include ActivePodio::Updatable
|
3
4
|
|
@@ -18,6 +19,4 @@ class Podio::SpaceContact < Podio::Profile
|
|
18
19
|
def destroy
|
19
20
|
self.class.delete_contact(self.profile_id)
|
20
21
|
end
|
21
|
-
|
22
|
-
handle_api_errors_for :create, :update # Call must be made after the methods to handle have been defined
|
23
22
|
end
|
@@ -16,6 +16,7 @@ class Podio::SpaceInvitation < ActivePodio::Base
|
|
16
16
|
property :external_contacts, :hash
|
17
17
|
|
18
18
|
has_one :user, :class => 'User'
|
19
|
+
has_one :inviter, :class => 'Contact'
|
19
20
|
|
20
21
|
def save
|
21
22
|
self.class.create(self.space_id, self.role, self.attributes.except(:contacts))
|
@@ -29,8 +30,6 @@ class Podio::SpaceInvitation < ActivePodio::Base
|
|
29
30
|
self.class.accept(invite_code)
|
30
31
|
end
|
31
32
|
|
32
|
-
handle_api_errors_for :save, :save_member, :accept # Call must be made after the methods to handle have been defined
|
33
|
-
|
34
33
|
class << self
|
35
34
|
def create(space_id, role, attributes={})
|
36
35
|
response = Podio.connection.post do |req|
|
@@ -69,15 +68,15 @@ class Podio::SpaceInvitation < ActivePodio::Base
|
|
69
68
|
end
|
70
69
|
|
71
70
|
def find_member(invite_code)
|
72
|
-
member Podio.
|
71
|
+
member Podio.client.trusted_connection.get("/space/membership?invite_code=#{invite_code}").body
|
73
72
|
end
|
74
73
|
|
75
74
|
def decline_member(invite_code)
|
76
|
-
Podio.
|
75
|
+
Podio.client.trusted_connection.delete("/space/membership?invite_code=#{invite_code}").status
|
77
76
|
end
|
78
77
|
|
79
78
|
def claim_member(invite_code)
|
80
|
-
Podio.connection.post("/space/membership/claim?invite_code=#{invite_code}").
|
79
|
+
Podio.connection.post("/space/membership/claim?invite_code=#{invite_code}").body
|
81
80
|
end
|
82
81
|
end
|
83
82
|
end
|