podio 0.8.0 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
@@ -1,9 +1,12 @@
|
|
|
1
1
|
# Encapsulates a user's membership of a space.
|
|
2
|
+
# @see https://developers.podio.com/doc/space-members
|
|
2
3
|
class Podio::SpaceMember < ActivePodio::Base
|
|
4
|
+
property :employee, :boolean
|
|
3
5
|
property :role, :string
|
|
4
6
|
property :invited_on, :datetime
|
|
5
7
|
property :started_on, :datetime
|
|
6
8
|
property :ended_on, :datetime
|
|
9
|
+
property :grants, :integer
|
|
7
10
|
|
|
8
11
|
has_one :user, :class => 'User'
|
|
9
12
|
has_one :contact, :class => 'Contact', :property => :profile
|
|
@@ -12,19 +15,29 @@ class Podio::SpaceMember < ActivePodio::Base
|
|
|
12
15
|
delegate :user_id, :name, :to => :contact
|
|
13
16
|
|
|
14
17
|
alias_method :id, :user_id
|
|
18
|
+
|
|
19
|
+
def employee?
|
|
20
|
+
employee
|
|
21
|
+
end
|
|
22
|
+
|
|
23
|
+
def external?
|
|
24
|
+
!employee
|
|
25
|
+
end
|
|
15
26
|
|
|
16
27
|
class << self
|
|
28
|
+
# @see https://developers.podio.com/doc/space-members/get-space-members-by-role-68043
|
|
17
29
|
def find_all_for_role(space_id, role)
|
|
18
30
|
list Podio.connection.get { |req|
|
|
19
31
|
req.url("/space/#{space_id}/member/#{role}/")
|
|
20
32
|
}.body
|
|
21
33
|
end
|
|
22
34
|
|
|
35
|
+
# @see https://developers.podio.com/doc/space-members/get-space-membership-22397
|
|
23
36
|
def find_membership(space_id, user_id)
|
|
24
37
|
response = Podio.connection.get { |req|
|
|
25
|
-
req.url("/space/#{space_id}/member/#{user_id}")
|
|
38
|
+
req.url("/space/#{space_id}/member/#{user_id}/v2")
|
|
26
39
|
}
|
|
27
|
-
response.body
|
|
40
|
+
member response.body
|
|
28
41
|
end
|
|
29
42
|
|
|
30
43
|
def find_all_ended(space_id)
|
|
@@ -33,10 +46,17 @@ class Podio::SpaceMember < ActivePodio::Base
|
|
|
33
46
|
}.body
|
|
34
47
|
end
|
|
35
48
|
|
|
49
|
+
# @see https://developers.podio.com/doc/space-members/get-active-members-of-space-22395
|
|
36
50
|
def find_all(space_id, options = {})
|
|
37
51
|
list Podio.connection.get("/space/#{space_id}/member/", options).body
|
|
38
52
|
end
|
|
39
53
|
|
|
54
|
+
# @see https://developers.podio.com/doc/space-members/get-space-members-v2-19350328
|
|
55
|
+
def find_all_for_space(space_id, options = {})
|
|
56
|
+
list Podio.connection.get("/space/#{space_id}/member/v2/", options).body
|
|
57
|
+
end
|
|
58
|
+
|
|
59
|
+
# @see https://developers.podio.com/doc/space-members/update-space-memberships-22398
|
|
40
60
|
def update_role(space_id, user_id, role)
|
|
41
61
|
response = Podio.connection.put do |req|
|
|
42
62
|
req.url "/space/#{space_id}/member/#{user_id}"
|
|
@@ -45,28 +65,41 @@ class Podio::SpaceMember < ActivePodio::Base
|
|
|
45
65
|
response.status
|
|
46
66
|
end
|
|
47
67
|
|
|
68
|
+
# @see https://developers.podio.com/doc/space-members/end-space-memberships-22399
|
|
48
69
|
def end_membership(space_id, user_id)
|
|
49
70
|
Podio.connection.delete("/space/#{space_id}/member/#{user_id}").status
|
|
50
71
|
end
|
|
51
72
|
|
|
52
|
-
|
|
53
|
-
|
|
73
|
+
# @see https://developers.podio.com/doc/space-members/get-top-users-on-space-22461
|
|
74
|
+
def find_top_contacts(space_id, options = {})
|
|
75
|
+
result = Podio.connection.get("/space/#{space_id}/member/top/", options).body
|
|
54
76
|
%w(employee external).each do |section|
|
|
55
77
|
result[section]['profiles'].map! { |profile| Contact.new(profile) } if result[section].present? && result[section]['profiles'].present?
|
|
56
78
|
end
|
|
57
79
|
result
|
|
58
80
|
end
|
|
59
81
|
|
|
82
|
+
def find_top_active(space_id, options = {})
|
|
83
|
+
response = Podio.connection.get("/space/#{space_id}/member/top_active/", options)
|
|
84
|
+
response.body.map { |profile| Contact.new(profile) }
|
|
85
|
+
end
|
|
86
|
+
|
|
60
87
|
def find_memberships_for_user_in_org(org_id, user_id)
|
|
61
88
|
list Podio.connection.get("/org/#{org_id}/member/#{user_id}/space_member/").body
|
|
62
89
|
end
|
|
63
90
|
|
|
91
|
+
# @see https://developers.podio.com/doc/space-members/request-space-membership-6146231
|
|
64
92
|
def request_membership(space_id)
|
|
65
93
|
Podio.connection.post("/space/#{space_id}/member_request/").status
|
|
66
94
|
end
|
|
67
95
|
|
|
96
|
+
# @see https://developers.podio.com/doc/space-members/accept-space-membership-request-6146271
|
|
68
97
|
def accept_membership_request(space_id, space_member_request_id)
|
|
69
98
|
Podio.connection.post("/space/#{space_id}/member_request/#{space_member_request_id}/accept").status
|
|
70
99
|
end
|
|
100
|
+
|
|
101
|
+
def get_members_count(space_id)
|
|
102
|
+
Podio.connection.get("/space/#{space_id}/member/total").body
|
|
103
|
+
end
|
|
71
104
|
end
|
|
72
105
|
end
|
data/lib/podio/models/status.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# @see https://developers.podio.com/doc/status
|
|
1
2
|
class Podio::Status < ActivePodio::Base
|
|
2
3
|
property :status_id, :integer
|
|
3
4
|
property :value, :string
|
|
@@ -7,14 +8,21 @@ class Podio::Status < ActivePodio::Base
|
|
|
7
8
|
property :alerts, :array
|
|
8
9
|
property :ratings, :hash
|
|
9
10
|
property :subscribed, :boolean
|
|
11
|
+
property :pinned, :boolean
|
|
10
12
|
property :user_ratings, :hash
|
|
13
|
+
property :rights, :array
|
|
14
|
+
property :is_liked, :boolean
|
|
15
|
+
property :like_count, :integer
|
|
16
|
+
property :subscribed_count, :integer
|
|
17
|
+
property :push, :hash
|
|
18
|
+
property :presence, :hash
|
|
11
19
|
|
|
12
20
|
# Properties for create
|
|
13
21
|
property :file_ids, :array
|
|
14
22
|
property :embed_id, :integer
|
|
15
23
|
property :embed_file_id, :integer
|
|
16
24
|
|
|
17
|
-
has_one :created_by, :class => '
|
|
25
|
+
has_one :created_by, :class => 'ByLine'
|
|
18
26
|
has_one :created_via, :class => 'Via'
|
|
19
27
|
has_one :embed, :class => 'Embed'
|
|
20
28
|
has_one :embed_file, :class => 'FileAttachment'
|
|
@@ -24,30 +32,34 @@ class Podio::Status < ActivePodio::Base
|
|
|
24
32
|
has_many :shares, :class => 'AppStoreShare'
|
|
25
33
|
has_many :files, :class => 'FileAttachment'
|
|
26
34
|
has_many :questions, :class => 'Question'
|
|
27
|
-
|
|
35
|
+
|
|
28
36
|
alias_method :id, :status_id
|
|
29
37
|
|
|
38
|
+
# @see https://developers.podio.com/doc/status/delete-a-status-message-22339
|
|
30
39
|
def destroy
|
|
31
40
|
Status.delete(self.id)
|
|
32
41
|
end
|
|
33
|
-
|
|
42
|
+
|
|
34
43
|
class << self
|
|
44
|
+
# @see https://developers.podio.com/doc/status/get-status-message-22337
|
|
35
45
|
def find(id)
|
|
36
46
|
member Podio.connection.get("/status/#{id}").body
|
|
37
47
|
end
|
|
38
48
|
|
|
39
|
-
|
|
49
|
+
# @see https://developers.podio.com/doc/status/add-new-status-message-22336
|
|
50
|
+
def create(space_id, attributes=[], options={})
|
|
40
51
|
response = Podio.connection.post do |req|
|
|
41
|
-
req.url
|
|
52
|
+
req.url("/status/space/#{space_id}/", options)
|
|
42
53
|
req.body = attributes
|
|
43
54
|
end
|
|
44
55
|
|
|
45
56
|
response.body['status_id']
|
|
46
57
|
end
|
|
47
|
-
|
|
58
|
+
|
|
59
|
+
# @see https://developers.podio.com/doc/status/delete-a-status-message-22339
|
|
48
60
|
def delete(id)
|
|
49
61
|
Podio.connection.delete("/status/#{id}").body
|
|
50
62
|
end
|
|
51
63
|
end
|
|
52
|
-
|
|
53
|
-
end
|
|
64
|
+
|
|
65
|
+
end
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# @see https://developers.podio.com/doc/stream
|
|
2
|
+
class Podio::StreamActivityGroup < ActivePodio::Base
|
|
3
|
+
|
|
4
|
+
property :group_id, :integer
|
|
5
|
+
property :kind, :string
|
|
6
|
+
property :type, :string
|
|
7
|
+
property :created_on, :datetime
|
|
8
|
+
property :activities, :array
|
|
9
|
+
|
|
10
|
+
has_one :data_ref, :class => 'Reference'
|
|
11
|
+
has_one :created_by, :class => 'ByLine'
|
|
12
|
+
has_one :created_via, :class => 'Via'
|
|
13
|
+
|
|
14
|
+
has_many :authors, :class => 'ByLine'
|
|
15
|
+
|
|
16
|
+
alias_method :id, :group_id
|
|
17
|
+
|
|
18
|
+
class << self
|
|
19
|
+
|
|
20
|
+
def find_by_ref(ref_type, ref_id, options = {})
|
|
21
|
+
list Podio.connection.get { |req|
|
|
22
|
+
req.url("/stream/#{ref_type}/#{ref_id}/activity_group", options)
|
|
23
|
+
}.body
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
def find_by_event_id(ref_type, ref_id, event_id, options={})
|
|
27
|
+
member Podio.connection.get { |req|
|
|
28
|
+
req.url("/stream/#{ref_type}/#{ref_id}/group/#{event_id}", options)
|
|
29
|
+
}.body
|
|
30
|
+
end
|
|
31
|
+
|
|
32
|
+
def find_for_data_ref(ref_type, ref_id, data_ref_type, data_ref_id, options={})
|
|
33
|
+
member Podio.connection.get { |req|
|
|
34
|
+
req.url("/stream/#{ref_type}/#{ref_id}/activity_group/#{data_ref_type}/#{data_ref_id}", options)
|
|
35
|
+
}.body
|
|
36
|
+
end
|
|
37
|
+
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
end
|
|
@@ -1,26 +1,25 @@
|
|
|
1
|
+
# @see https://developers.podio.com/doc/stream
|
|
1
2
|
class Podio::StreamMute < ActivePodio::Base
|
|
2
3
|
property :id, :integer
|
|
3
4
|
property :type, :string
|
|
4
5
|
property :title, :string
|
|
5
6
|
property :data, :hash
|
|
6
|
-
property :item, :boolean
|
|
7
|
-
property :status, :boolean
|
|
8
|
-
property :task, :boolean
|
|
9
7
|
|
|
10
8
|
class << self
|
|
9
|
+
# @see https://developers.podio.com/doc/stream/get-mutes-in-global-stream-62742
|
|
11
10
|
def find_all
|
|
12
|
-
list Podio.connection.get('/stream/mute/v2/').body
|
|
11
|
+
list Podio.connection.get('/stream/mute/v2/').body
|
|
13
12
|
end
|
|
14
13
|
|
|
15
|
-
|
|
14
|
+
# @see https://developers.podio.com/doc/stream/mute-object-from-global-stream-79424
|
|
15
|
+
def create(scope_type, scope_id)
|
|
16
16
|
path = "/stream/mute/#{scope_type}/#{scope_id}"
|
|
17
|
-
path += "/#{object_type}" unless object_type.nil?
|
|
18
17
|
Podio.connection.post(path).status
|
|
19
18
|
end
|
|
20
19
|
|
|
21
|
-
|
|
20
|
+
# @see https://developers.podio.com/doc/stream/unmute-objects-from-the-global-stream-79426
|
|
21
|
+
def delete(scope_type, scope_id)
|
|
22
22
|
path = "/stream/mute/#{scope_type}/#{scope_id}"
|
|
23
|
-
path += "/#{object_type}" unless object_type.nil?
|
|
24
23
|
Podio.connection.delete(path).status
|
|
25
24
|
end
|
|
26
25
|
end
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# @see https://developers.podio.com/doc/stream
|
|
1
2
|
class Podio::StreamObject < ActivePodio::Base
|
|
2
3
|
property :id, :integer
|
|
3
4
|
property :type, :string
|
|
@@ -15,7 +16,7 @@ class Podio::StreamObject < ActivePodio::Base
|
|
|
15
16
|
has_one :app, :class => 'Application'
|
|
16
17
|
has_one :space, :class => 'Space'
|
|
17
18
|
has_one :org, :class => 'Organization'
|
|
18
|
-
|
|
19
|
+
|
|
19
20
|
has_many :comments, :class => 'Comment'
|
|
20
21
|
has_many :files, :class => 'FileAttachment'
|
|
21
22
|
has_many :activity, :class => 'Activity'
|
|
@@ -23,44 +24,51 @@ class Podio::StreamObject < ActivePodio::Base
|
|
|
23
24
|
alias_method :activities, :activity
|
|
24
25
|
|
|
25
26
|
class << self
|
|
27
|
+
# @see https://developers.podio.com/doc/stream/get-global-stream-80012
|
|
26
28
|
def find_all(options={})
|
|
27
29
|
list Podio.connection.get { |req|
|
|
28
|
-
req.url("/stream/
|
|
29
|
-
}.body
|
|
30
|
+
req.url("/stream/", options)
|
|
31
|
+
}.body
|
|
30
32
|
end
|
|
31
33
|
|
|
34
|
+
# @see https://developers.podio.com/doc/stream/get-space-stream-80039
|
|
32
35
|
def find_all_by_space_id(space_id, options={})
|
|
33
36
|
list Podio.connection.get { |req|
|
|
34
37
|
req.url("/stream/space/#{space_id}/v2/", options)
|
|
35
|
-
}.body
|
|
38
|
+
}.body
|
|
36
39
|
end
|
|
37
40
|
|
|
41
|
+
# @see https://developers.podio.com/doc/stream/get-organization-stream-80038
|
|
38
42
|
def find_all_by_org_id(org_id, options={})
|
|
39
43
|
list Podio.connection.get { |req|
|
|
40
44
|
req.url("/stream/org/#{org_id}/v2/", options)
|
|
41
|
-
}.body
|
|
45
|
+
}.body
|
|
42
46
|
end
|
|
43
47
|
|
|
48
|
+
# @see https://developers.podio.com/doc/stream/get-app-stream-264673
|
|
44
49
|
def find_all_by_app_id(app_id, options={})
|
|
45
50
|
list Podio.connection.get { |req|
|
|
46
51
|
req.url("/stream/app/#{app_id}/", options)
|
|
47
|
-
}.body
|
|
52
|
+
}.body
|
|
48
53
|
end
|
|
49
54
|
|
|
55
|
+
# @see https://developers.podio.com/doc/stream/get-user-stream-1289318
|
|
50
56
|
def find_all_by_user_id(user_id, options={})
|
|
51
57
|
list Podio.connection.get { |req|
|
|
52
58
|
req.url("/stream/user/#{user_id}/", options)
|
|
53
|
-
}.body
|
|
59
|
+
}.body
|
|
54
60
|
end
|
|
55
|
-
|
|
61
|
+
|
|
62
|
+
# @see https://developers.podio.com/doc/stream/get-stream-object-80054
|
|
56
63
|
def find_by_ref(ref_type, ref_id)
|
|
57
64
|
member Podio.connection.get("/stream/#{ref_type}/#{ref_id}/v2").body
|
|
58
65
|
end
|
|
59
|
-
|
|
66
|
+
|
|
67
|
+
# @see https://developers.podio.com/doc/stream/get-personal-stream-1656647
|
|
60
68
|
def find_all_personal(options={})
|
|
61
69
|
list Podio.connection.get { |req|
|
|
62
70
|
req.url("/stream/personal/", options)
|
|
63
|
-
}.body
|
|
64
|
-
end
|
|
71
|
+
}.body
|
|
72
|
+
end
|
|
65
73
|
end
|
|
66
74
|
end
|
|
@@ -1,31 +1,37 @@
|
|
|
1
|
+
# @see https://developers.podio.com/doc/subscriptions
|
|
1
2
|
class Podio::Subscription < ActivePodio::Base
|
|
2
3
|
property :started_on, :datetime
|
|
3
4
|
property :notifications, :integer
|
|
4
5
|
property :ref, :hash
|
|
5
6
|
|
|
6
7
|
class << self
|
|
8
|
+
# @see https://developers.podio.com/doc/subscriptions/get-subscription-by-id-22446
|
|
7
9
|
def find(id)
|
|
8
10
|
member Podio.connection.get("/subscription/#{id}").body
|
|
9
11
|
end
|
|
10
12
|
|
|
13
|
+
# @see https://developers.podio.com/doc/subscriptions/get-subscription-by-reference-22408
|
|
11
14
|
def find_by_reference(ref_type, ref_id)
|
|
12
15
|
member Podio.connection.get("/subscription/#{ref_type}/#{ref_id}").body
|
|
13
16
|
end
|
|
14
17
|
|
|
18
|
+
# @see https://developers.podio.com/doc/subscriptions/subscribe-22409
|
|
15
19
|
def create(ref_type, ref_id)
|
|
16
20
|
Podio.connection.post("/subscription/#{ref_type}/#{ref_id}").body['subscription_id']
|
|
17
21
|
end
|
|
18
22
|
|
|
23
|
+
# @see https://developers.podio.com/doc/subscriptions/unsubscribe-by-id-22445
|
|
19
24
|
def delete(id)
|
|
20
25
|
Podio.connection.delete("/subscription/#{id}")
|
|
21
26
|
end
|
|
22
27
|
|
|
28
|
+
# @see https://developers.podio.com/doc/subscriptions/unsubscribe-by-reference-22410
|
|
23
29
|
def delete_by_reference(ref_type, ref_id)
|
|
24
30
|
Podio.connection.delete("/subscription/#{ref_type}/#{ref_id}")
|
|
25
31
|
end
|
|
26
32
|
|
|
27
33
|
def find_subscribers_by_reference(ref_type, ref_id)
|
|
28
|
-
User.list Podio.connection.get("/subscription/#{ref_type}/#{ref_id}/").body
|
|
34
|
+
User.list Podio.connection.get("/subscription/#{ref_type}/#{ref_id}/user").body
|
|
29
35
|
end
|
|
30
36
|
end
|
|
31
37
|
end
|
data/lib/podio/models/tag.rb
CHANGED
|
@@ -1,8 +1,10 @@
|
|
|
1
|
+
# @see https://developers.podio.com/doc/tags
|
|
1
2
|
class Podio::Tag < ActivePodio::Base
|
|
2
3
|
property :count, :integer
|
|
3
4
|
property :text, :string
|
|
4
|
-
|
|
5
|
+
|
|
5
6
|
class << self
|
|
7
|
+
# @see https://developers.podio.com/doc/tags/create-tags-22464
|
|
6
8
|
def create(tagable_type, tagable_id, attributes)
|
|
7
9
|
response = Podio.connection.post do |req|
|
|
8
10
|
req.url "/tag/#{tagable_type}/#{tagable_id}/"
|
|
@@ -12,6 +14,7 @@ class Podio::Tag < ActivePodio::Base
|
|
|
12
14
|
response.body
|
|
13
15
|
end
|
|
14
16
|
|
|
17
|
+
# @see https://developers.podio.com/doc/tags/update-tags-39859
|
|
15
18
|
def update(tagable_type, tagable_id, attributes)
|
|
16
19
|
response = Podio.connection.put do |req|
|
|
17
20
|
req.url "/tag/#{tagable_type}/#{tagable_id}/"
|
|
@@ -21,11 +24,13 @@ class Podio::Tag < ActivePodio::Base
|
|
|
21
24
|
response.body
|
|
22
25
|
end
|
|
23
26
|
|
|
27
|
+
# @see https://developers.podio.com/doc/tags/get-tags-on-app-22467
|
|
24
28
|
def find_by_app(app_id, limit, text)
|
|
25
29
|
text = CGI.escape(text) if text
|
|
26
30
|
list Podio.connection.get("/tag/app/#{app_id}/?limit=#{limit}&text=#{text}").body
|
|
27
31
|
end
|
|
28
32
|
|
|
33
|
+
# @see https://developers.podio.com/doc/tags/get-tags-on-app-top-68485
|
|
29
34
|
def find_top_by_app(app_id, limit, text)
|
|
30
35
|
text = CGI.escape(text) if text
|
|
31
36
|
Podio.connection.get("/tag/app/#{app_id}/top/?limit=#{limit}&text=#{text}").body
|
|
@@ -1,10 +1,11 @@
|
|
|
1
|
+
# @see https://developers.podio.com/doc/tags
|
|
1
2
|
class Podio::TagSearch < ActivePodio::Base
|
|
2
3
|
property :id, :integer
|
|
3
4
|
property :type, :string
|
|
4
5
|
property :title, :string
|
|
5
6
|
property :link, :string
|
|
6
7
|
property :created_on, :datetime
|
|
7
|
-
|
|
8
|
+
|
|
8
9
|
class << self
|
|
9
10
|
def search_by_space(space_id, text)
|
|
10
11
|
text = CGI.escape(text) if text
|
data/lib/podio/models/task.rb
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
# @see https://developers.podio.com/doc/tasks
|
|
1
2
|
class Podio::Task < ActivePodio::Base
|
|
2
3
|
include ActivePodio::Updatable
|
|
3
4
|
|
|
@@ -6,10 +7,11 @@ class Podio::Task < ActivePodio::Base
|
|
|
6
7
|
property :group, :string
|
|
7
8
|
property :text, :string
|
|
8
9
|
property :description, :string
|
|
10
|
+
property :rights, :array
|
|
9
11
|
property :private, :boolean
|
|
10
12
|
property :due_date, :date
|
|
11
13
|
property :due_time, :time
|
|
12
|
-
property :due_on, :datetime
|
|
14
|
+
property :due_on, :datetime
|
|
13
15
|
property :responsible, :hash
|
|
14
16
|
property :space_id, :integer
|
|
15
17
|
property :link, :string
|
|
@@ -19,6 +21,11 @@ class Podio::Task < ActivePodio::Base
|
|
|
19
21
|
property :label_ids, :array # when inputting tasks
|
|
20
22
|
property :labels, :array # when outputting tasks
|
|
21
23
|
property :external_id, :string
|
|
24
|
+
property :subscribed, :boolean
|
|
25
|
+
property :subscribed_count, :integer
|
|
26
|
+
property :pinned, :boolean
|
|
27
|
+
property :push, :hash
|
|
28
|
+
property :presence, :hash
|
|
22
29
|
|
|
23
30
|
# old references
|
|
24
31
|
property :ref_type, :string
|
|
@@ -43,6 +50,7 @@ class Podio::Task < ActivePodio::Base
|
|
|
43
50
|
|
|
44
51
|
alias_method :id, :task_id
|
|
45
52
|
|
|
53
|
+
# @see https://developers.podio.com/doc/tasks/create-task-22419
|
|
46
54
|
def create
|
|
47
55
|
result = self.create_multiple # Could return false if API call failed
|
|
48
56
|
self.task_id = result.first.id if result
|
|
@@ -58,63 +66,83 @@ class Podio::Task < ActivePodio::Base
|
|
|
58
66
|
end
|
|
59
67
|
end
|
|
60
68
|
|
|
69
|
+
# @see https://developers.podio.com/doc/tasks/delete-task-77179
|
|
61
70
|
def destroy
|
|
62
71
|
self.class.delete(self.id)
|
|
63
72
|
end
|
|
64
73
|
|
|
74
|
+
# @see https://developers.podio.com/doc/tasks/update-task-reference-170733
|
|
65
75
|
def update_reference(ref_type, ref_id)
|
|
66
76
|
self.class.update_reference(self.id, ref_type, ref_id)
|
|
67
77
|
end
|
|
68
78
|
|
|
79
|
+
# @see https://developers.podio.com/doc/tasks/remove-task-reference-6146114
|
|
69
80
|
def delete_reference
|
|
70
81
|
self.class.delete_reference(self.id)
|
|
71
82
|
end
|
|
72
83
|
|
|
84
|
+
# @see https://developers.podio.com/doc/tasks/update-task-labels-151769
|
|
73
85
|
def update_labels(label_ids)
|
|
74
86
|
self.class.update_labels(self.id, label_ids)
|
|
75
87
|
end
|
|
76
88
|
|
|
89
|
+
# @see https://developers.podio.com/doc/tasks/complete-task-22432
|
|
77
90
|
def complete
|
|
78
91
|
self.class.complete(self.id)
|
|
79
92
|
end
|
|
80
93
|
|
|
94
|
+
# @see https://developers.podio.com/doc/tasks/incomplete-task-22433
|
|
81
95
|
def uncomplete
|
|
82
96
|
self.class.incomplete(self.id)
|
|
83
97
|
end
|
|
84
98
|
|
|
99
|
+
# @see https://developers.podio.com/doc/tasks/rank-task-81015
|
|
85
100
|
def rank(previous_task, next_task)
|
|
86
101
|
self.class.rank(self.id, previous_task && previous_task.to_i, next_task && next_task.to_i)
|
|
87
102
|
end
|
|
88
103
|
|
|
89
|
-
handle_api_errors_for :create_multiple, :destroy, :complete, :uncomplete, :update_reference # Call must be made after the methods to handle have been defined
|
|
90
|
-
|
|
91
104
|
class << self
|
|
92
|
-
|
|
105
|
+
# @see https://developers.podio.com/doc/tasks/create-task-22419
|
|
106
|
+
def create(attributes, options = {})
|
|
93
107
|
response = Podio.connection.post do |req|
|
|
94
|
-
req.url
|
|
108
|
+
req.url("/task/", options)
|
|
95
109
|
req.body = attributes
|
|
96
110
|
end
|
|
97
111
|
|
|
98
112
|
list [response.body].flatten
|
|
99
113
|
end
|
|
100
114
|
|
|
101
|
-
|
|
115
|
+
# @see https://developers.podio.com/doc/tasks/create-task-with-reference-22420
|
|
116
|
+
def create_with_ref(ref_type, ref_id, attributes, options = {})
|
|
102
117
|
response = Podio.connection.post do |req|
|
|
103
|
-
req.url
|
|
118
|
+
req.url("/task/#{ref_type}/#{ref_id}/", options)
|
|
104
119
|
req.body = attributes
|
|
105
120
|
end
|
|
106
121
|
|
|
107
122
|
list [response.body].flatten
|
|
108
123
|
end
|
|
109
124
|
|
|
125
|
+
# @see https://developers.podio.com/doc/tasks/update-task-10583674
|
|
126
|
+
def update(id, attributes, options = {})
|
|
127
|
+
response = Podio.connection.put do |req|
|
|
128
|
+
req.url("/task/#{id}", options)
|
|
129
|
+
req.body = attributes
|
|
130
|
+
end
|
|
131
|
+
|
|
132
|
+
member response.body
|
|
133
|
+
end
|
|
134
|
+
|
|
135
|
+
# @see https://developers.podio.com/doc/tasks/update-task-description-76982
|
|
110
136
|
def update_description(id, description)
|
|
111
137
|
Podio.connection.put("/task/#{id}/description", {:description => description}).status
|
|
112
138
|
end
|
|
113
139
|
|
|
140
|
+
# @see https://developers.podio.com/doc/tasks/update-task-text-22428
|
|
114
141
|
def update_text(id, text)
|
|
115
142
|
Podio.connection.put("/task/#{id}/text", {:text => text}).status
|
|
116
143
|
end
|
|
117
144
|
|
|
145
|
+
# @see https://developers.podio.com/doc/tasks/update-task-private-22434
|
|
118
146
|
def update_private(id, private_flag)
|
|
119
147
|
Podio.connection.put("/task/#{id}/private", {:private => private_flag}).status
|
|
120
148
|
end
|
|
@@ -123,88 +151,116 @@ class Podio::Task < ActivePodio::Base
|
|
|
123
151
|
Podio.connection.put("/task/#{id}/due_date", {:due_date => due_date}).status
|
|
124
152
|
end
|
|
125
153
|
|
|
154
|
+
# @see https://developers.podio.com/doc/tasks/update-task-due-on-3442633
|
|
126
155
|
def update_due_on(id, options)
|
|
127
156
|
Podio.connection.put("/task/#{id}/due_on", options).status
|
|
128
157
|
end
|
|
129
158
|
|
|
159
|
+
# @see https://developers.podio.com/doc/tasks/assign-task-22412
|
|
130
160
|
def update_assignee(id, user_id)
|
|
131
161
|
Podio.connection.post("/task/#{id}/assign", {:responsible => user_id}).status
|
|
132
162
|
end
|
|
133
163
|
|
|
164
|
+
# @see https://developers.podio.com/doc/tasks/update-task-reference-170733
|
|
134
165
|
def update_reference(id, ref_type, ref_id)
|
|
135
166
|
Podio.connection.put("/task/#{id}/ref", {:ref_type => ref_type, :ref_id => ref_id}).status
|
|
136
167
|
end
|
|
137
168
|
|
|
169
|
+
# @see https://developers.podio.com/doc/tasks/remove-task-reference-6146114
|
|
138
170
|
def delete_reference(task_id)
|
|
139
171
|
Podio.connection.delete("/task/#{task_id}/ref").status
|
|
140
172
|
end
|
|
141
173
|
|
|
174
|
+
# @see https://developers.podio.com/doc/tasks/update-task-labels-151769
|
|
142
175
|
def update_labels(id, label_ids)
|
|
143
176
|
Podio.connection.put("/task/#{id}/label/", label_ids).status
|
|
144
177
|
end
|
|
145
178
|
|
|
179
|
+
# @see https://developers.podio.com/doc/tasks/delete-task-77179
|
|
146
180
|
def delete(id)
|
|
147
181
|
Podio.connection.delete("/task/#{id}").status
|
|
148
182
|
end
|
|
149
183
|
|
|
184
|
+
# @see https://developers.podio.com/doc/tasks/complete-task-22432
|
|
150
185
|
def complete(id)
|
|
151
186
|
Podio.connection.post("/task/#{id}/complete").body
|
|
152
187
|
end
|
|
153
188
|
|
|
189
|
+
# @see https://developers.podio.com/doc/tasks/incomplete-task-22433
|
|
154
190
|
def incomplete(id)
|
|
155
191
|
Podio.connection.post("/task/#{id}/incomplete").body
|
|
156
192
|
end
|
|
157
193
|
|
|
194
|
+
# @see https://developers.podio.com/doc/tasks/rank-task-81015
|
|
158
195
|
def rank(id, before_task_id, after_task_id)
|
|
159
196
|
Podio.connection.post("/task/#{id}/rank", {:before => before_task_id, :after => after_task_id}).body
|
|
160
197
|
end
|
|
161
198
|
|
|
162
|
-
|
|
163
|
-
|
|
199
|
+
# @see https://developers.podio.com/doc/tasks/get-task-22413
|
|
200
|
+
def find(id, options = {})
|
|
201
|
+
member Podio.connection.get("/task/#{id}", options).body
|
|
164
202
|
end
|
|
165
203
|
|
|
204
|
+
# @see https://developers.podio.com/doc/tasks/get-tasks-with-reference-22426
|
|
166
205
|
def find_for_reference(ref_type, ref_id)
|
|
167
206
|
list Podio.connection.get("/task/#{ref_type}/#{ref_id}/").body
|
|
168
207
|
end
|
|
169
208
|
|
|
209
|
+
# @see https://developers.podio.com/doc/tasks/get-tasks-77949
|
|
170
210
|
def find_all(options={})
|
|
171
211
|
list Podio.connection.get { |req|
|
|
172
212
|
req.url('/task/', options)
|
|
173
213
|
}.body
|
|
174
214
|
end
|
|
175
215
|
|
|
176
|
-
|
|
177
|
-
|
|
216
|
+
# @see https://developers.podio.com/doc/tasks/get-task-summary-1612017
|
|
217
|
+
def find_summary(options={})
|
|
218
|
+
response = Podio.connection.get { |req|
|
|
219
|
+
req.url("/task/summary", options)
|
|
220
|
+
}.body
|
|
178
221
|
response['overdue']['tasks'] = list(response['overdue']['tasks'])
|
|
179
222
|
response['today']['tasks'] = list(response['today']['tasks'])
|
|
180
223
|
response['other']['tasks'] = list(response['other']['tasks'])
|
|
181
224
|
response
|
|
182
225
|
end
|
|
183
226
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
227
|
+
# @see https://developers.podio.com/doc/tasks/get-task-summary-for-organization-1612063
|
|
228
|
+
def find_summary_for_org(org_id, options={})
|
|
229
|
+
response = Podio.connection.get { |req|
|
|
230
|
+
req.url("/task/org/#{org_id}/summary", options)
|
|
231
|
+
}.body
|
|
187
232
|
response['overdue']['tasks'] = list(response['overdue']['tasks'])
|
|
188
233
|
response['today']['tasks'] = list(response['today']['tasks'])
|
|
189
234
|
response['other']['tasks'] = list(response['other']['tasks'])
|
|
190
235
|
response
|
|
191
236
|
end
|
|
192
237
|
|
|
193
|
-
|
|
194
|
-
|
|
238
|
+
# @see https://developers.podio.com/doc/tasks/get-task-summary-for-reference-1657980
|
|
239
|
+
def find_summary_for_reference(ref_type, ref_id, options={})
|
|
240
|
+
response = Podio.connection.get { |req|
|
|
241
|
+
req.url("/task/#{ref_type}/#{ref_id}/summary", options)
|
|
242
|
+
}.body
|
|
195
243
|
response['overdue']['tasks'] = list(response['overdue']['tasks'])
|
|
196
244
|
response['today']['tasks'] = list(response['today']['tasks'])
|
|
197
245
|
response['other']['tasks'] = list(response['other']['tasks'])
|
|
198
246
|
response
|
|
199
247
|
end
|
|
200
248
|
|
|
201
|
-
|
|
202
|
-
|
|
249
|
+
# @see https://developers.podio.com/doc/tasks/get-task-summary-for-personal-1657217
|
|
250
|
+
def find_personal_summary(options={})
|
|
251
|
+
response = Podio.connection.get { |req|
|
|
252
|
+
req.url("/task/personal/summary", options)
|
|
253
|
+
}.body
|
|
203
254
|
response['overdue']['tasks'] = list(response['overdue']['tasks'])
|
|
204
255
|
response['today']['tasks'] = list(response['today']['tasks'])
|
|
205
256
|
response['other']['tasks'] = list(response['other']['tasks'])
|
|
206
257
|
response
|
|
207
258
|
end
|
|
208
259
|
|
|
260
|
+
# @see https://developers.podio.com/doc/tasks/get-task-count-38316458
|
|
261
|
+
def count_by_ref(ref_type, ref_id)
|
|
262
|
+
Podio.connection.get("/task/#{ref_type}/#{ref_id}/count").body['count']
|
|
263
|
+
end
|
|
264
|
+
|
|
209
265
|
end
|
|
210
266
|
end
|