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
data/lib/podio/models/embed.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# @see https://developers.podio.com/doc/embeds
|
1
2
|
class Podio::Embed < ActivePodio::Base
|
2
3
|
|
3
4
|
property :embed_id, :integer
|
@@ -6,10 +7,8 @@ class Podio::Embed < ActivePodio::Base
|
|
6
7
|
property :type, :string
|
7
8
|
property :title, :string
|
8
9
|
property :description, :string
|
9
|
-
property :created_on, :datetime
|
10
|
-
property :provider_name, :string
|
11
10
|
property :embed_html, :string
|
12
|
-
property :embed_height, :
|
11
|
+
property :embed_height, :integer
|
13
12
|
property :embed_width, :integer
|
14
13
|
|
15
14
|
has_many :files, :class => 'FileAttachment'
|
@@ -18,6 +17,7 @@ class Podio::Embed < ActivePodio::Base
|
|
18
17
|
|
19
18
|
class << self
|
20
19
|
|
20
|
+
# @see https://developers.podio.com/doc/embeds/add-an-embed-726483
|
21
21
|
def create(url)
|
22
22
|
response = Podio.connection.post do |req|
|
23
23
|
req.url '/embed/'
|
@@ -31,4 +31,4 @@ class Podio::Embed < ActivePodio::Base
|
|
31
31
|
end
|
32
32
|
|
33
33
|
end
|
34
|
-
end
|
34
|
+
end
|
@@ -0,0 +1,71 @@
|
|
1
|
+
class Podio::Experiment < ActivePodio::Base
|
2
|
+
|
3
|
+
class << self
|
4
|
+
|
5
|
+
def create_subject(attributes)
|
6
|
+
response = Podio.client.trusted_connection.post do |req|
|
7
|
+
req.url '/experiment/subject/'
|
8
|
+
req.body = attributes
|
9
|
+
end
|
10
|
+
response.body['identifier']
|
11
|
+
end
|
12
|
+
|
13
|
+
def associate_subject(identifier)
|
14
|
+
Podio.connection.post("/experiment/subject/#{identifier}/associate")
|
15
|
+
end
|
16
|
+
|
17
|
+
def find_variation_for_subject(identifier, experiment, supported_variations)
|
18
|
+
response = Podio.client.trusted_connection.post do |req|
|
19
|
+
req.url "/experiment/#{experiment}/subject/#{identifier}"
|
20
|
+
req.body = supported_variations
|
21
|
+
end
|
22
|
+
response.body['variation']
|
23
|
+
end
|
24
|
+
|
25
|
+
def find_variation_for_user(experiment, supported_variations)
|
26
|
+
response = Podio.connection.post do |req|
|
27
|
+
req.url "/experiment/#{experiment}/user"
|
28
|
+
req.body = supported_variations
|
29
|
+
end
|
30
|
+
response.body['variation']
|
31
|
+
end
|
32
|
+
|
33
|
+
def find_all
|
34
|
+
Podio.connection.get('/experiment/').body
|
35
|
+
end
|
36
|
+
|
37
|
+
def create_variation(experiment, variation)
|
38
|
+
Podio.connection.post("/experiment/#{experiment}/variation/#{variation}")
|
39
|
+
end
|
40
|
+
|
41
|
+
def activate_variation(experiment, variation)
|
42
|
+
Podio.connection.post("/experiment/#{experiment}/variation/#{variation}/activate")
|
43
|
+
end
|
44
|
+
|
45
|
+
def deactivate_variation(experiment, variation)
|
46
|
+
Podio.connection.post("/experiment/#{experiment}/variation/#{variation}/deactivate")
|
47
|
+
end
|
48
|
+
|
49
|
+
def assign_variation(experiment, variation, attributes)
|
50
|
+
Podio.connection.post do |req|
|
51
|
+
req.url "/experiment/#{experiment}/variation/#{variation}/assign"
|
52
|
+
req.body = attributes
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
def combined(supported_variations_map, identifier=nil, attributes={})
|
57
|
+
connection = Podio.client.oauth_token ? Podio.client.connection : Podio.client.trusted_connection
|
58
|
+
|
59
|
+
body = {
|
60
|
+
"experiments" => supported_variations_map
|
61
|
+
}
|
62
|
+
|
63
|
+
body["identifier"] = identifier if identifier.present?
|
64
|
+
|
65
|
+
connection.post do |req|
|
66
|
+
req.url "/experiment/combined"
|
67
|
+
req.body = body
|
68
|
+
end.body
|
69
|
+
end
|
70
|
+
end
|
71
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# @see https://developers.podio.com/doc/files
|
1
2
|
class Podio::ExternalFile < ActivePodio::Base
|
2
3
|
property :external_file_id, :string
|
3
4
|
property :name, :string
|
@@ -17,10 +18,14 @@ class Podio::ExternalFile < ActivePodio::Base
|
|
17
18
|
}.body
|
18
19
|
end
|
19
20
|
|
20
|
-
|
21
|
+
|
22
|
+
def create_from_external_file_id(linked_account_id, external_file_id, preserve_permissions=false)
|
21
23
|
response = Podio.client.connection.post do |req|
|
22
24
|
req.url "/file/linked_account/#{linked_account_id}/"
|
23
|
-
req.body = {
|
25
|
+
req.body = {
|
26
|
+
:external_file_id => external_file_id,
|
27
|
+
:preserve_permissions => preserve_permissions
|
28
|
+
}
|
24
29
|
end
|
25
30
|
|
26
31
|
member response.body
|
@@ -1,6 +1,8 @@
|
|
1
|
+
# @see https://developers.podio.com/doc/files
|
1
2
|
class Podio::FileAttachment < ActivePodio::Base
|
2
3
|
property :file_id, :integer
|
3
4
|
property :link, :string
|
5
|
+
property :link_target, :string
|
4
6
|
property :perma_link, :string
|
5
7
|
property :thumbnail_link, :string
|
6
8
|
property :hosted_by, :string
|
@@ -11,10 +13,15 @@ class Podio::FileAttachment < ActivePodio::Base
|
|
11
13
|
property :context, :hash
|
12
14
|
property :created_on, :datetime
|
13
15
|
property :rights, :array
|
16
|
+
property :subscribed, :boolean
|
17
|
+
property :subscribed_count, :integer
|
18
|
+
property :push, :hash
|
19
|
+
property :presence, :hash
|
14
20
|
|
15
21
|
has_one :created_by, :class => 'ByLine'
|
16
22
|
has_one :created_via, :class => 'Via'
|
17
23
|
has_many :replaces, :class => 'FileAttachment'
|
24
|
+
has_many :comments, :class => 'Comment'
|
18
25
|
|
19
26
|
alias_method :id, :file_id
|
20
27
|
|
@@ -30,8 +37,13 @@ class Podio::FileAttachment < ActivePodio::Base
|
|
30
37
|
'file'
|
31
38
|
end
|
32
39
|
|
40
|
+
def raw_data
|
41
|
+
Podio.connection.get(self.link).body
|
42
|
+
end
|
43
|
+
|
33
44
|
class << self
|
34
45
|
# Accepts an open file stream along with a file name and uploads the file to Podio
|
46
|
+
# @see https://developers.podio.com/doc/files/upload-file-1004361
|
35
47
|
def upload(file_stream, file_name)
|
36
48
|
response = Podio.client.connection.post do |req|
|
37
49
|
req.options[:timeout] = 1200
|
@@ -53,6 +65,7 @@ class Podio::FileAttachment < ActivePodio::Base
|
|
53
65
|
end
|
54
66
|
|
55
67
|
# Attach a file to an existing reference
|
68
|
+
# @see https://developers.podio.com/doc/files/attach-file-22518
|
56
69
|
def attach(id, ref_type, ref_id)
|
57
70
|
Podio.connection.post do |req|
|
58
71
|
req.url "/file/#{id}/attach"
|
@@ -60,40 +73,48 @@ class Podio::FileAttachment < ActivePodio::Base
|
|
60
73
|
end
|
61
74
|
end
|
62
75
|
|
76
|
+
# @see https://developers.podio.com/doc/files/copy-file-89977
|
63
77
|
def copy(id)
|
64
78
|
Podio.connection.post("/file/#{id}/copy").body['file_id']
|
65
79
|
end
|
66
80
|
|
81
|
+
# @see https://developers.podio.com/doc/files/delete-file-22453
|
67
82
|
def delete(id)
|
68
83
|
Podio.connection.delete("/file/#{id}")
|
69
84
|
end
|
70
85
|
|
86
|
+
# @see https://developers.podio.com/doc/files/get-file-22451
|
71
87
|
def find(id)
|
72
88
|
member Podio.connection.get("/file/#{id}").body
|
73
89
|
end
|
74
90
|
|
91
|
+
# @see https://developers.podio.com/doc/files/download-file-1004147
|
75
92
|
def find_raw(id)
|
76
93
|
Podio.client.connection.get("/file/#{id}/raw").body
|
77
94
|
end
|
78
95
|
|
96
|
+
# @see https://developers.podio.com/doc/files/get-files-on-app-22472
|
79
97
|
def find_for_app(app_id, options={})
|
80
98
|
list Podio.connection.get { |req|
|
81
99
|
req.url("/file/app/#{app_id}/", options)
|
82
100
|
}.body
|
83
101
|
end
|
84
102
|
|
103
|
+
# @see https://developers.podio.com/doc/files/get-files-on-space-22471
|
85
104
|
def find_for_space(space_id, options={})
|
86
105
|
list Podio.connection.get { |req|
|
87
106
|
req.url("/file/space/#{space_id}/", options)
|
88
107
|
}.body
|
89
108
|
end
|
90
109
|
|
110
|
+
# @see https://developers.podio.com/doc/files/get-latest-files-on-app-22473
|
91
111
|
def find_latest_for_app(app_id, options={})
|
92
112
|
list Podio.connection.get { |req|
|
93
113
|
req.url("/file/app/#{app_id}/latest/", options)
|
94
114
|
}.body
|
95
115
|
end
|
96
116
|
|
117
|
+
# @see https://developers.podio.com/doc/files/get-latest-files-on-space-22470
|
97
118
|
def find_latest_for_space(space_id, options={})
|
98
119
|
list Podio.connection.get { |req|
|
99
120
|
req.url("/file/space/#{space_id}/latest/", options)
|
@@ -106,6 +127,7 @@ class Podio::FileAttachment < ActivePodio::Base
|
|
106
127
|
}.body
|
107
128
|
end
|
108
129
|
|
130
|
+
# @see https://developers.podio.com/doc/files/replace-file-22450
|
109
131
|
def replace(old_file_id, new_file_id)
|
110
132
|
Podio.connection.post { |req|
|
111
133
|
req.url "/file/#{new_file_id}/replace"
|
@@ -113,6 +135,7 @@ class Podio::FileAttachment < ActivePodio::Base
|
|
113
135
|
}.body
|
114
136
|
end
|
115
137
|
|
138
|
+
# @see https://developers.podio.com/doc/files/update-file-22454
|
116
139
|
def update(id, description)
|
117
140
|
Podio.connection.put { |req|
|
118
141
|
req.url "/file/#{file_id}"
|
data/lib/podio/models/form.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# @see https://developers.podio.com/doc/forms
|
1
2
|
class Podio::Form < ActivePodio::Base
|
2
3
|
property :form_id, :integer
|
3
4
|
property :app_id, :integer
|
@@ -16,6 +17,7 @@ class Podio::Form < ActivePodio::Base
|
|
16
17
|
delegate_to_hash :text, :submit, :success, :heading, :description, :setter => true
|
17
18
|
|
18
19
|
class << self
|
20
|
+
# @see https://developers.podio.com/doc/forms/create-form-53803
|
19
21
|
def create(app_id, attributes)
|
20
22
|
response = Podio.connection.post do |req|
|
21
23
|
req.url "/form/app/#{app_id}/"
|
@@ -25,6 +27,7 @@ class Podio::Form < ActivePodio::Base
|
|
25
27
|
response.body['form_id']
|
26
28
|
end
|
27
29
|
|
30
|
+
# @see https://developers.podio.com/doc/forms/update-form-53808
|
28
31
|
def update(form_id, attributes)
|
29
32
|
response = Podio.connection.put do |req|
|
30
33
|
req.url "/form/#{form_id}"
|
@@ -34,20 +37,24 @@ class Podio::Form < ActivePodio::Base
|
|
34
37
|
response.status
|
35
38
|
end
|
36
39
|
|
40
|
+
# @see https://developers.podio.com/doc/forms/get-forms-53771
|
37
41
|
def find_all_for_app(app_id)
|
38
42
|
list Podio.connection.get { |req|
|
39
43
|
req.url("/form/app/#{app_id}/")
|
40
44
|
}.body
|
41
45
|
end
|
42
46
|
|
47
|
+
# @see https://developers.podio.com/doc/forms/get-form-53754
|
43
48
|
def find(form_id)
|
44
49
|
member Podio.connection.get("/form/#{form_id}").body
|
45
50
|
end
|
46
51
|
|
52
|
+
# @see https://developers.podio.com/doc/forms/deactivate-form-1107378
|
47
53
|
def disable(form_id)
|
48
54
|
Podio.connection.post("/form/#{form_id}/deactivate").body
|
49
55
|
end
|
50
56
|
|
57
|
+
# @see https://developers.podio.com/doc/forms/activate-form-1107439
|
51
58
|
def enable(form_id)
|
52
59
|
Podio.connection.post("/form/#{form_id}/activate").body
|
53
60
|
end
|
@@ -0,0 +1,73 @@
|
|
1
|
+
class Podio::Grant < ActivePodio::Base
|
2
|
+
|
3
|
+
property :ref_type, :string
|
4
|
+
property :ref_id, :integer
|
5
|
+
property :people, :hash
|
6
|
+
property :action, :string
|
7
|
+
property :message, :string
|
8
|
+
property :ref, :hash
|
9
|
+
property :created_on, :datetime
|
10
|
+
|
11
|
+
has_one :created_by, :class => 'ByLine'
|
12
|
+
has_one :user, :class => 'Contact'
|
13
|
+
|
14
|
+
def save
|
15
|
+
self.class.create(self.ref_type, self.ref_id, self.attributes)
|
16
|
+
end
|
17
|
+
|
18
|
+
class << self
|
19
|
+
# https://hoist.podio.com/api/item/16168841
|
20
|
+
def create(ref_type, ref_id, attributes={})
|
21
|
+
response = Podio.connection.post do |req|
|
22
|
+
req.url "/grant/#{ref_type}/#{ref_id}"
|
23
|
+
req.body = attributes
|
24
|
+
end
|
25
|
+
|
26
|
+
response.body
|
27
|
+
end
|
28
|
+
|
29
|
+
# https://hoist.podio.com/api/item/16490748
|
30
|
+
def find_own(ref_type, ref_id, options = {})
|
31
|
+
response = Podio.connection.get { |req|
|
32
|
+
req.url("/grant/#{ref_type}/#{ref_id}/own", options)
|
33
|
+
}
|
34
|
+
if response.status == 200
|
35
|
+
member response.body
|
36
|
+
else
|
37
|
+
nil
|
38
|
+
end
|
39
|
+
end
|
40
|
+
|
41
|
+
# https://hoist.podio.com/api/item/16491464
|
42
|
+
def find_all(ref_type, ref_id, options = {})
|
43
|
+
list Podio.connection.get { |req|
|
44
|
+
req.url("grant/#{ref_type}/#{ref_id}/", options)
|
45
|
+
}.body
|
46
|
+
end
|
47
|
+
|
48
|
+
# https://hoist.podio.com/api/item/16496711
|
49
|
+
def delete(ref_type, ref_id, user_id)
|
50
|
+
Podio.connection.delete("grant/#{ref_type}/#{ref_id}/#{user_id}").body
|
51
|
+
end
|
52
|
+
|
53
|
+
# https://hoist.podio.com/api/item/19275931
|
54
|
+
def count_by_reference(ref_type, ref_id)
|
55
|
+
Podio.connection.get("/grant/#{ref_type}/#{ref_id}/count").body['count']
|
56
|
+
end
|
57
|
+
|
58
|
+
# https://hoist.podio.com/api/item/19389786
|
59
|
+
def find_for_user_on_space(space_id, user_id, options = {})
|
60
|
+
list Podio.connection.get { |req|
|
61
|
+
req.url("/grant/space/#{space_id}/user/#{user_id}/", options)
|
62
|
+
}.body
|
63
|
+
end
|
64
|
+
|
65
|
+
# https://hoist.podio.com/api/item/22330891
|
66
|
+
def find_own_on_org(org_id, options = {})
|
67
|
+
list Podio.connection.get { |req|
|
68
|
+
req.url("/grant/org/#{org_id}/own/", options)
|
69
|
+
}.body
|
70
|
+
end
|
71
|
+
|
72
|
+
end
|
73
|
+
end
|
data/lib/podio/models/hook.rb
CHANGED
@@ -1,3 +1,4 @@
|
|
1
|
+
# @see https://developers.podio.com/doc/hooks
|
1
2
|
class Podio::Hook < ActivePodio::Base
|
2
3
|
property :hook_id, :integer
|
3
4
|
property :status, :string
|
@@ -8,11 +9,13 @@ class Podio::Hook < ActivePodio::Base
|
|
8
9
|
|
9
10
|
attr_accessor :hookable_type, :hookable_id
|
10
11
|
|
12
|
+
# @see https://developers.podio.com/doc/hooks/create-hook-215056
|
11
13
|
def create
|
12
14
|
self.hook_id = self.class.create(self.hookable_type, self.hookable_id, attributes)
|
13
15
|
end
|
14
|
-
|
16
|
+
|
15
17
|
class << self
|
18
|
+
# @see https://developers.podio.com/doc/hooks/create-hook-215056
|
16
19
|
def create(hookable_type, hookable_id, attributes)
|
17
20
|
response = Podio.connection.post do |req|
|
18
21
|
req.url "/hook/#{hookable_type}/#{hookable_id}/"
|
@@ -21,28 +24,32 @@ class Podio::Hook < ActivePodio::Base
|
|
21
24
|
|
22
25
|
response.body['hook_id']
|
23
26
|
end
|
24
|
-
|
27
|
+
|
28
|
+
# @see https://developers.podio.com/doc/hooks/request-hook-verification-215232
|
25
29
|
def verify(hook_id)
|
26
30
|
Podio.connection.post do |req|
|
27
31
|
req.url "/hook/#{hook_id}/verify/request"
|
28
32
|
end
|
29
33
|
end
|
30
34
|
|
35
|
+
# @see https://developers.podio.com/doc/hooks/validate-hook-verification-215241
|
31
36
|
def validate(hook_id, code)
|
32
37
|
Podio.connection.post do |req|
|
33
38
|
req.url "/hook/#{hook_id}/verify/validate"
|
34
39
|
req.body = {:code => code}
|
35
40
|
end
|
36
41
|
end
|
37
|
-
|
42
|
+
|
43
|
+
# @see https://developers.podio.com/doc/hooks/delete-hook-215291
|
38
44
|
def delete(hook_id)
|
39
45
|
Podio.connection.delete do |req|
|
40
46
|
req.url "/hook/#{hook_id}"
|
41
|
-
end
|
47
|
+
end
|
42
48
|
end
|
43
|
-
|
49
|
+
|
50
|
+
# @see https://developers.podio.com/doc/hooks/get-hooks-215285
|
44
51
|
def find_all_for(hookable_type, hookable_id)
|
45
52
|
list Podio.connection.get("/hook/#{hookable_type}/#{hookable_id}/").body
|
46
53
|
end
|
47
54
|
end
|
48
|
-
end
|
55
|
+
end
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# @see https://developers.podio.com/doc/importer
|
1
2
|
class Podio::Importer < ActivePodio::Base
|
2
3
|
|
3
4
|
class << self
|
@@ -14,10 +15,12 @@ class Podio::Importer < ActivePodio::Base
|
|
14
15
|
list Podio.connection.get("/importer/#{file_id}/column/").body
|
15
16
|
end
|
16
17
|
|
18
|
+
# @see https://developers.podio.com/doc/importer/get-info-5929504
|
17
19
|
def get_info(file_id)
|
18
20
|
Podio.connection.get("/importer/#{file_id}/info").body
|
19
21
|
end
|
20
22
|
|
23
|
+
# @see https://developers.podio.com/doc/importer/get-preview-5936702
|
21
24
|
def preview(file_id, row, options)
|
22
25
|
response = Podio.connection.post do |req|
|
23
26
|
req.url "/importer/#{file_id}/preview/#{row}"
|
@@ -1,3 +1,4 @@
|
|
1
|
+
# @see https://developers.podio.com/doc/integrations
|
1
2
|
class Podio::Integration < ActivePodio::Base
|
2
3
|
include ActivePodio::Updatable
|
3
4
|
|
@@ -11,34 +12,38 @@ class Podio::Integration < ActivePodio::Base
|
|
11
12
|
property :updating, :boolean
|
12
13
|
property :last_updated_on, :datetime
|
13
14
|
property :created_on, :datetime
|
14
|
-
|
15
|
+
|
15
16
|
has_one :created_by, :class => 'ByLine'
|
16
17
|
|
17
18
|
alias_method :id, :integration_id
|
18
19
|
|
20
|
+
# @see https://developers.podio.com/doc/integrations/create-integration-86839
|
19
21
|
def create
|
20
22
|
self.integration_id = Integration.create(self.app_id, attributes)
|
21
23
|
end
|
22
24
|
|
25
|
+
# @see https://developers.podio.com/doc/integrations/update-integration-86843
|
23
26
|
def update
|
24
27
|
Integration.update(self.app_id, attributes)
|
25
28
|
end
|
26
29
|
|
30
|
+
# @see https://developers.podio.com/doc/integrations/update-integration-mapping-86865
|
27
31
|
def update_mapping
|
28
32
|
Integration.update_mapping(self.app_id, attributes)
|
29
33
|
end
|
30
|
-
|
34
|
+
|
35
|
+
# @see https://developers.podio.com/doc/integrations/delete-integration-86876
|
31
36
|
def destroy
|
32
37
|
Integration.delete(self.app_id)
|
33
38
|
end
|
34
39
|
|
40
|
+
# @see https://developers.podio.com/doc/integrations/refresh-integration-86987
|
35
41
|
def refresh
|
36
42
|
Integration.refresh(self.app_id)
|
37
43
|
end
|
38
|
-
|
39
|
-
handle_api_errors_for :create, :update, :update_mapping
|
40
|
-
|
44
|
+
|
41
45
|
class << self
|
46
|
+
# @see https://developers.podio.com/doc/integrations/create-integration-86839
|
42
47
|
def create(app_id, attributes)
|
43
48
|
response = Podio.connection.post do |req|
|
44
49
|
req.url "/integration/#{app_id}"
|
@@ -48,6 +53,7 @@ class Podio::Integration < ActivePodio::Base
|
|
48
53
|
response.body['integration_id']
|
49
54
|
end
|
50
55
|
|
56
|
+
# @see https://developers.podio.com/doc/integrations/update-integration-86843
|
51
57
|
def update(app_id, attributes)
|
52
58
|
response = Podio.connection.put do |req|
|
53
59
|
req.url "/integration/#{app_id}"
|
@@ -57,6 +63,7 @@ class Podio::Integration < ActivePodio::Base
|
|
57
63
|
response.body
|
58
64
|
end
|
59
65
|
|
66
|
+
# @see https://developers.podio.com/doc/integrations/update-integration-mapping-86865
|
60
67
|
def update_mapping(app_id, attributes)
|
61
68
|
response = Podio.connection.put do |req|
|
62
69
|
req.url "/integration/#{app_id}/mapping"
|
@@ -64,18 +71,22 @@ class Podio::Integration < ActivePodio::Base
|
|
64
71
|
end
|
65
72
|
end
|
66
73
|
|
74
|
+
# @see https://developers.podio.com/doc/integrations/get-integration-86821
|
67
75
|
def find(app_id)
|
68
76
|
member Podio.connection.get("/integration/#{app_id}").body
|
69
77
|
end
|
70
78
|
|
79
|
+
# @see https://developers.podio.com/doc/integrations/get-available-fields-86890
|
71
80
|
def find_available_fields_for(app_id)
|
72
81
|
list Podio.connection.get("/integration/#{app_id}/field/").body
|
73
82
|
end
|
74
|
-
|
83
|
+
|
84
|
+
# @see https://developers.podio.com/doc/integrations/delete-integration-86876
|
75
85
|
def delete(app_id)
|
76
86
|
Podio.connection.delete("/integration/#{app_id}").status
|
77
87
|
end
|
78
88
|
|
89
|
+
# @see https://developers.podio.com/doc/integrations/refresh-integration-86987
|
79
90
|
def refresh(app_id)
|
80
91
|
Podio.connection.post("/integration/#{app_id}/refresh").status
|
81
92
|
end
|