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,17 @@
|
|
1
|
+
class Podio::ContractEvent < ActivePodio::Base
|
2
|
+
property :type, :string
|
3
|
+
property :created_on, :datetime
|
4
|
+
|
5
|
+
has_one :created_by, :class => 'ByLine'
|
6
|
+
has_one :created_via, :class => 'Via'
|
7
|
+
|
8
|
+
class << self
|
9
|
+
# @see https://hoist.podio.com/api/apps/apioperations/items/699
|
10
|
+
def find_all_for_contract(contract_id, options = {})
|
11
|
+
list Podio.connection.get { |req|
|
12
|
+
req.url("/contract/#{contract_id}/event/", options)
|
13
|
+
}.body
|
14
|
+
end
|
15
|
+
|
16
|
+
end
|
17
|
+
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Podio::ContractPrice < ActivePodio::Base
|
2
2
|
property :total, :float
|
3
|
-
|
3
|
+
|
4
4
|
has_many :users, :class => 'ContractUser'
|
5
5
|
|
6
6
|
def premium_employees
|
@@ -23,10 +23,6 @@ class Podio::ContractPrice < ActivePodio::Base
|
|
23
23
|
items['emp_network'].present?
|
24
24
|
end
|
25
25
|
|
26
|
-
def total_for_emp_network
|
27
|
-
items['emp_network']['sub_total']
|
28
|
-
end
|
29
|
-
|
30
26
|
def items
|
31
27
|
if @items.nil?
|
32
28
|
@items = {}
|
@@ -36,11 +32,11 @@ class Podio::ContractPrice < ActivePodio::Base
|
|
36
32
|
end
|
37
33
|
@items
|
38
34
|
end
|
39
|
-
|
35
|
+
|
40
36
|
end
|
41
37
|
|
42
38
|
class Podio::ContractPriceItem < ActivePodio::Base
|
43
39
|
property :sub_total, :float
|
44
40
|
property :quantity, :integer
|
45
41
|
property :already_paid, :integer
|
46
|
-
end
|
42
|
+
end
|
@@ -0,0 +1,31 @@
|
|
1
|
+
class Podio::ContractPriceV2 < ActivePodio::Base
|
2
|
+
|
3
|
+
has_one :employee, :class => 'ContractPriceItemV2'
|
4
|
+
has_one :external, :class => 'ContractPriceItemV2'
|
5
|
+
|
6
|
+
def total
|
7
|
+
self.employee.sub_total + self.external.sub_total
|
8
|
+
end
|
9
|
+
|
10
|
+
class << self
|
11
|
+
def calculate(contract_id, attributes)
|
12
|
+
response = Podio.connection.post do |req|
|
13
|
+
req.url "/contract/#{contract_id}/price/v2"
|
14
|
+
req.body = attributes
|
15
|
+
end
|
16
|
+
|
17
|
+
member response.body
|
18
|
+
end
|
19
|
+
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
class Podio::ContractPriceItemV2 < ActivePodio::Base
|
24
|
+
property :price, :float # Price per user
|
25
|
+
property :quantity, :integer # Number of users
|
26
|
+
|
27
|
+
def sub_total
|
28
|
+
(self.quantity*self.price).to_f
|
29
|
+
end
|
30
|
+
|
31
|
+
end
|
@@ -1,6 +1,10 @@
|
|
1
|
+
# @see https://developers.podio.com/doc/conversations
|
1
2
|
class Podio::Conversation < ActivePodio::Base
|
3
|
+
include ActivePodio::Updatable
|
4
|
+
|
2
5
|
property :conversation_id, :integer
|
3
6
|
property :subject, :string
|
7
|
+
property :pinned, :boolean
|
4
8
|
|
5
9
|
# When inputting conversation
|
6
10
|
property :text, :string
|
@@ -8,45 +12,86 @@ class Podio::Conversation < ActivePodio::Base
|
|
8
12
|
property :file_ids, :array
|
9
13
|
property :embed_id, :integer
|
10
14
|
property :embed_file_id, :integer
|
11
|
-
|
15
|
+
|
12
16
|
# When outputting conversation(s)
|
17
|
+
property :link, :string
|
13
18
|
property :created_on, :datetime
|
19
|
+
property :excerpt, :string
|
20
|
+
property :last_event_on, :datetime
|
21
|
+
property :starred, :boolean
|
22
|
+
property :unread, :boolean
|
23
|
+
property :type, :string
|
24
|
+
property :push, :hash
|
25
|
+
property :presence, :hash
|
26
|
+
|
14
27
|
has_one :embed, :class => 'Embed'
|
15
28
|
has_one :embed_file, :class => 'FileAttachment'
|
16
29
|
has_one :created_by, :class => 'ByLine'
|
30
|
+
has_one :live, :class => 'Live'
|
17
31
|
has_many :files, :class => 'FileAttachment'
|
18
32
|
has_many :messages, :class => 'ConversationMessage'
|
19
33
|
has_many :participants_full, :class => 'ConversationParticipant'
|
20
34
|
|
21
|
-
|
22
35
|
alias_method :id, :conversation_id
|
23
|
-
|
36
|
+
|
37
|
+
# So tasks can refer to ref.name on all types of references
|
38
|
+
def name
|
39
|
+
self.subject || self.excerpt
|
40
|
+
end
|
24
41
|
|
25
42
|
def save
|
26
43
|
self[:file_ids] ||= []
|
27
|
-
|
28
|
-
self.
|
44
|
+
model = self.class.create(self.attributes)
|
45
|
+
self.attributes = model.attributes
|
29
46
|
end
|
30
|
-
|
31
|
-
handle_api_errors_for :save # Call must be made after the methods to handle have been defined
|
32
|
-
|
47
|
+
|
33
48
|
class << self
|
49
|
+
# @see https://developers.podio.com/doc/conversations/get-conversations-34822801
|
50
|
+
def find_all(options={})
|
51
|
+
list Podio.connection.get { |req|
|
52
|
+
req.url("/conversation/", options)
|
53
|
+
}.body
|
54
|
+
end
|
55
|
+
|
56
|
+
# @see https://developers.podio.com/doc/conversations/get-flagged-conversations-35466860
|
57
|
+
def find_all_by_flag(flag, options={})
|
58
|
+
list Podio.connection.get { |req|
|
59
|
+
req.url("/conversation/#{flag}/", options)
|
60
|
+
}.body
|
61
|
+
end
|
62
|
+
|
63
|
+
# @see https://developers.podio.com/doc/conversations/search-conversations-36885550
|
64
|
+
def search(options={})
|
65
|
+
list Podio.connection.get { |req|
|
66
|
+
req.url "/conversation/search/", options
|
67
|
+
}.body
|
68
|
+
end
|
69
|
+
|
70
|
+
# @see https://developers.podio.com/doc/conversations/get-conversation-22369
|
34
71
|
def find(conversation_id)
|
35
72
|
member Podio.connection.get("/conversation/#{conversation_id}").body
|
36
73
|
end
|
37
74
|
|
75
|
+
# @see https://developers.podio.com/doc/conversations/get-conversations-on-object-22443
|
38
76
|
def find_all_for_reference(ref_type, ref_id)
|
39
77
|
list Podio.connection.get("/conversation/#{ref_type}/#{ref_id}/").body
|
40
78
|
end
|
41
79
|
|
80
|
+
# @see https://developers.podio.com/doc/conversations/get-existing-direct-conversation-44969910
|
81
|
+
def find_direct_with_user(user_id)
|
82
|
+
member Podio.connection.get("/conversation/direct/#{user_id}").body
|
83
|
+
end
|
84
|
+
|
85
|
+
# @see https://developers.podio.com/doc/conversations/create-conversation-v2-37301474
|
42
86
|
def create(attributes)
|
43
87
|
response = Podio.connection.post do |req|
|
44
|
-
req.url '/conversation/'
|
88
|
+
req.url '/conversation/v2/'
|
45
89
|
req.body = attributes
|
46
90
|
end
|
47
|
-
response.body
|
91
|
+
member response.body
|
48
92
|
end
|
49
93
|
|
94
|
+
# @see https://developers.podio.com/doc/conversations/create-conversation-on-object-22442
|
50
95
|
def create_for_reference(ref_type, ref_id, attributes)
|
51
96
|
response = Podio.connection.post do |req|
|
52
97
|
req.url "/conversation/#{ref_type}/#{ref_id}/"
|
@@ -54,7 +99,8 @@ class Podio::Conversation < ActivePodio::Base
|
|
54
99
|
end
|
55
100
|
response.body
|
56
101
|
end
|
57
|
-
|
102
|
+
|
103
|
+
# @see https://developers.podio.com/doc/conversations/reply-to-conversation-22444
|
58
104
|
def create_reply(conversation_id, text, file_ids=[], embed_id=nil, embed_file_id=nil)
|
59
105
|
response = Podio.connection.post do |req|
|
60
106
|
req.url "/conversation/#{conversation_id}/reply"
|
@@ -62,7 +108,16 @@ class Podio::Conversation < ActivePodio::Base
|
|
62
108
|
end
|
63
109
|
response.body['message_id']
|
64
110
|
end
|
65
|
-
|
111
|
+
|
112
|
+
# @see https://developers.podio.com/doc/conversations/add-participants-384261
|
113
|
+
def add_participants(conversation_id, participants)
|
114
|
+
response = Podio.connection.post do |req|
|
115
|
+
req.url "/conversation/#{conversation_id}/participant/"
|
116
|
+
req.body = { :participants => participants }
|
117
|
+
end
|
118
|
+
response.body
|
119
|
+
end
|
120
|
+
|
66
121
|
def add_participant(conversation_id, user_id)
|
67
122
|
response = Podio.connection.post do |req|
|
68
123
|
req.url "/conversation/#{conversation_id}/participant/"
|
@@ -70,6 +125,52 @@ class Podio::Conversation < ActivePodio::Base
|
|
70
125
|
end
|
71
126
|
response.body
|
72
127
|
end
|
73
|
-
|
128
|
+
|
129
|
+
# @see https://developers.podio.com/doc/conversations/mark-all-conversations-as-read-38080233
|
130
|
+
def mark_all_as_read
|
131
|
+
Podio.connection.post("/conversation/read").status
|
132
|
+
end
|
133
|
+
|
134
|
+
# @see https://developers.podio.com/doc/conversations/mark-conversation-as-read-35441525
|
135
|
+
def mark_as_read(conversation_id)
|
136
|
+
response = Podio.connection.post do |req|
|
137
|
+
req.url "/conversation/#{conversation_id}/read"
|
138
|
+
end
|
139
|
+
response.status
|
140
|
+
end
|
141
|
+
|
142
|
+
# @see https://developers.podio.com/doc/conversations/mark-conversation-as-unread-35441542
|
143
|
+
def mark_as_unread(conversation_id)
|
144
|
+
Podio.connection.delete("/conversation/#{conversation_id}/read").status
|
145
|
+
end
|
146
|
+
|
147
|
+
# @see https://developers.podio.com/doc/conversations/star-conversation-35106944
|
148
|
+
def star(conversation_id)
|
149
|
+
response = Podio.connection.post do |req|
|
150
|
+
req.url "/conversation/#{conversation_id}/star"
|
151
|
+
end
|
152
|
+
response.status
|
153
|
+
end
|
154
|
+
|
155
|
+
# @see https://developers.podio.com/doc/conversations/unstar-conversation-35106990
|
156
|
+
def unstar(conversation_id)
|
157
|
+
Podio.connection.delete("/conversation/#{conversation_id}/star").status
|
158
|
+
end
|
159
|
+
|
160
|
+
# @see https://developers.podio.com/doc/conversations/get-flagged-conversation-counts-35467925
|
161
|
+
def unread_count
|
162
|
+
Podio.connection.get("/conversation/unread/count").body['value']
|
163
|
+
end
|
164
|
+
|
165
|
+
# @see https://developers.podio.com/doc/conversations/get-flagged-conversation-counts-35467925
|
166
|
+
def starred_count
|
167
|
+
Podio.connection.get("/conversation/starred/count").body['value']
|
168
|
+
end
|
169
|
+
|
170
|
+
# @see https://developers.podio.com/doc/conversations/leave-conversation-35483748
|
171
|
+
def leave(conversation_id)
|
172
|
+
Podio.connection.post("/conversation/#{conversation_id}/leave")
|
173
|
+
end
|
174
|
+
|
74
175
|
end
|
75
176
|
end
|
@@ -0,0 +1,51 @@
|
|
1
|
+
# @see https://developers.podio.com/doc/conversations
|
2
|
+
class Podio::ConversationEvent < ActivePodio::Base
|
3
|
+
property :event_id, :integer
|
4
|
+
property :action, :string # message, participant_add, participant_leave
|
5
|
+
property :created_on, :datetime
|
6
|
+
|
7
|
+
has_one :data, :class_property => :action, :class_map => { :message => 'ConversationMessage', :participant_leave => 'User', :participant_add => 'User', :live_start => 'Live', :live_end => 'Live', :live_accept => 'Live', :live_decline => 'Live', :subject_change => 'User' }
|
8
|
+
has_one :created_by, :class => 'ByLine'
|
9
|
+
has_one :created_via, :class => 'Via'
|
10
|
+
|
11
|
+
alias_method :id, :event_id
|
12
|
+
|
13
|
+
class << self
|
14
|
+
# @see https://developers.podio.com/doc/conversations/get-conversation-events-35440697
|
15
|
+
def find_all(conversation_id, options = {})
|
16
|
+
list Podio.connection.get { |req|
|
17
|
+
req.url("/conversation/#{conversation_id}/event/", options)
|
18
|
+
}.body
|
19
|
+
end
|
20
|
+
|
21
|
+
def add_participants(conversation_id, participants)
|
22
|
+
response = Podio.connection.post do |req|
|
23
|
+
req.url "/conversation/#{conversation_id}/participant/v2/"
|
24
|
+
req.body = { :participants => participants }
|
25
|
+
end
|
26
|
+
list response.body
|
27
|
+
end
|
28
|
+
|
29
|
+
def create_reply(conversation_id, text, file_ids=[], embed_id=nil, embed_file_id=nil)
|
30
|
+
response = Podio.connection.post do |req|
|
31
|
+
req.url "/conversation/#{conversation_id}/reply/v2"
|
32
|
+
req.body = {:text => text, :file_ids => file_ids, :embed_id => embed_id, :embed_file_id => embed_file_id}
|
33
|
+
end
|
34
|
+
member response.body
|
35
|
+
end
|
36
|
+
|
37
|
+
# @see https://developers.podio.com/doc/conversations/get-conversation-event-35628220
|
38
|
+
def find(id)
|
39
|
+
member Podio.connection.get("/conversation/event/#{id}").body
|
40
|
+
end
|
41
|
+
|
42
|
+
def change_subject(conversation_id, subject)
|
43
|
+
response = Podio.connection.put do |req|
|
44
|
+
req.url "/conversation/#{conversation_id}/subject"
|
45
|
+
req.body = { :subject => subject }
|
46
|
+
end
|
47
|
+
|
48
|
+
member response.body
|
49
|
+
end
|
50
|
+
end
|
51
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# @see https://developers.podio.com/doc/conversations
|
1
2
|
class Podio::ConversationMessage < ActivePodio::Base
|
2
3
|
property :message_id, :integer
|
3
4
|
property :embed_id, :integer
|
@@ -9,6 +10,6 @@ class Podio::ConversationMessage < ActivePodio::Base
|
|
9
10
|
has_one :embed_file, :class => 'FileAttachment'
|
10
11
|
has_one :created_by, :class => 'ByLine'
|
11
12
|
has_many :files, :class => 'FileAttachment'
|
12
|
-
|
13
|
+
|
13
14
|
alias_method :id, :message_id
|
14
15
|
end
|
@@ -1,9 +1,10 @@
|
|
1
|
+
# @see https://developers.podio.com/doc/conversations
|
1
2
|
class Podio::ConversationParticipant < ActivePodio::Base
|
2
3
|
property :created_on, :datetime
|
3
|
-
|
4
|
+
|
4
5
|
has_one :user, :class => 'User'
|
5
6
|
has_one :created_by, :class => 'ByLine'
|
6
7
|
has_one :created_via, :class => 'Via'
|
7
8
|
|
8
9
|
delegate :id, :name, :avatar, :link, :to => :user, :prefix => false
|
9
|
-
end
|
10
|
+
end
|
@@ -0,0 +1,35 @@
|
|
1
|
+
class Podio::DateElectionVote < ActivePodio::Base
|
2
|
+
property :date_option_id, :integer
|
3
|
+
property :value, :boolean
|
4
|
+
|
5
|
+
has_one :user, :class => 'Contact'
|
6
|
+
end
|
7
|
+
|
8
|
+
class Podio::DateElectionOption < ActivePodio::Base
|
9
|
+
property :date_option_id, :integer
|
10
|
+
property :start_utc, :datetime
|
11
|
+
property :end_utc, :datetime
|
12
|
+
end
|
13
|
+
|
14
|
+
class Podio::DateElection < ActivePodio::Base
|
15
|
+
property :date_election_id, :integer
|
16
|
+
|
17
|
+
has_many :votes, :class => 'DateElectionVote'
|
18
|
+
has_many :options, :class => 'DateElectionOption'
|
19
|
+
|
20
|
+
class << self
|
21
|
+
def vote(date_election_id, date_option_id, value)
|
22
|
+
Podio.connection.post do |req|
|
23
|
+
req.url "/date_election/#{date_election_id}/vote"
|
24
|
+
req.body = {:date_option_id => date_option_id.to_i, :value => value}
|
25
|
+
end
|
26
|
+
end
|
27
|
+
|
28
|
+
def choose(date_election_id, date_option_id)
|
29
|
+
Podio.connection.post do |req|
|
30
|
+
req.url "/date_election/#{date_election_id}/choose"
|
31
|
+
req.body = {:date_option_id => date_option_id.to_i}
|
32
|
+
end
|
33
|
+
end
|
34
|
+
end
|
35
|
+
end
|
@@ -0,0 +1,46 @@
|
|
1
|
+
# @see https://developers.podio.com/doc/email
|
2
|
+
class Podio::EmailContact < ActivePodio::Base
|
3
|
+
|
4
|
+
property :name, :string
|
5
|
+
property :mail, :string
|
6
|
+
|
7
|
+
class << self
|
8
|
+
# @see https://developers.podio.com/doc/email/get-global-contact-13716154
|
9
|
+
def get_global(name)
|
10
|
+
member Podio.connection.get("/email/contact/#{name}").body
|
11
|
+
end
|
12
|
+
|
13
|
+
# @see https://developers.podio.com/doc/email/get-email-contact-for-reference-13716555
|
14
|
+
def get_ref(name, ref_type, ref_id)
|
15
|
+
member Podio.connection.get("/email/contact/#{name}/#{ref_type}/#{ref_id}").body
|
16
|
+
end
|
17
|
+
|
18
|
+
# @see https://developers.podio.com/doc/email/get-global-email-contact-as-vcard-13624848
|
19
|
+
def get_global_as_vcard(name)
|
20
|
+
Podio.connection.get("/email/contact/#{name}/vcard").body
|
21
|
+
end
|
22
|
+
|
23
|
+
# @see https://developers.podio.com/doc/email/get-email-contact-for-reference-as-vcard-13628255
|
24
|
+
def get_ref_as_vcard(name, ref_type, ref_id)
|
25
|
+
Podio.connection.get("/email/contact/#{name}/#{ref_type}/#{ref_id}/vcard").body
|
26
|
+
end
|
27
|
+
|
28
|
+
# @see https://developers.podio.com/doc/email/export-global-email-contact-to-linked-account-13629508
|
29
|
+
def export_global(name, linked_acc_id)
|
30
|
+
Podio.connection.post { |req|
|
31
|
+
req.url "/email/contact/#{name}/export"
|
32
|
+
req.body = { :linked_account_id => linked_acc_id }
|
33
|
+
}.body
|
34
|
+
end
|
35
|
+
|
36
|
+
# @see https://developers.podio.com/doc/email/export-email-contact-for-reference-to-linked-account-13628926
|
37
|
+
def export_ref(name, ref_type, ref_id, linked_acc_id)
|
38
|
+
Podio.connection.post { |req|
|
39
|
+
req.url "/email/contact/#{name}/#{ref_type}/#{ref_id}/export"
|
40
|
+
req.body = { :linked_account_id => linked_acc_id }
|
41
|
+
}.body
|
42
|
+
end
|
43
|
+
|
44
|
+
end
|
45
|
+
|
46
|
+
end
|
@@ -1,8 +1,8 @@
|
|
1
|
+
# @see https://developers.podio.com/doc/email
|
1
2
|
class Podio::EmailSubscriptionSetting < ActivePodio::Base
|
2
3
|
include ActivePodio::Updatable
|
3
4
|
|
4
5
|
property :digest, :boolean
|
5
|
-
property :bulletin, :boolean
|
6
6
|
property :reference, :boolean
|
7
7
|
property :message, :boolean
|
8
8
|
property :reminder, :boolean
|
@@ -21,12 +21,14 @@ class Podio::EmailSubscriptionSetting < ActivePodio::Base
|
|
21
21
|
end
|
22
22
|
|
23
23
|
class << self
|
24
|
+
# @see https://developers.podio.com/doc/email/get-groups-333977
|
24
25
|
def get_groups()
|
25
26
|
member Podio.connection.get { |req|
|
26
27
|
req.url("/email/group/", {})
|
27
28
|
}.body
|
28
29
|
end
|
29
30
|
|
31
|
+
# @see https://developers.podio.com/doc/email/update-groups-333981
|
30
32
|
def update_groups(options)
|
31
33
|
Podio.connection.put { |req|
|
32
34
|
req.url "/email/group/"
|
@@ -34,32 +36,11 @@ class Podio::EmailSubscriptionSetting < ActivePodio::Base
|
|
34
36
|
}.body
|
35
37
|
end
|
36
38
|
|
39
|
+
# @see https://developers.podio.com/doc/email/unsubscribe-from-all-304917
|
37
40
|
def unsubscribe(username)
|
38
41
|
Podio.connection.post("/email/unsubscribe/#{username}").status
|
39
42
|
end
|
40
43
|
|
41
|
-
def get_global_email_as_vcard(name)
|
42
|
-
Podio.connection.get("/email/contact/#{name}/vcard").body
|
43
|
-
end
|
44
|
-
|
45
|
-
def get_ref_email_as_vcard(name, ref_type, ref_id)
|
46
|
-
Podio.connection.get("/email/contact/#{name}/#{ref_type}/#{ref_id}/vcard").body
|
47
|
-
end
|
48
|
-
|
49
|
-
def export_global_contact_to_linked_acc(name, linked_acc_id)
|
50
|
-
Podio.connection.post { |req|
|
51
|
-
req.url "/email/contact/#{name}/export"
|
52
|
-
req.body = { :linked_account_id => linked_acc_id }
|
53
|
-
}.body
|
54
|
-
end
|
55
|
-
|
56
|
-
def export_ref_contact_to_linked_acc(name, ref_type, ref_id, linked_acc_id)
|
57
|
-
Podio.connection.post { |req|
|
58
|
-
req.url "/email/contact/#{name}/#{ref_type}/#{ref_id}/export"
|
59
|
-
req.body = { :linked_account_id => linked_acc_id }
|
60
|
-
}.body
|
61
|
-
end
|
62
|
-
|
63
44
|
end
|
64
45
|
|
65
46
|
end
|