podio 0.4.1 → 0.5.0
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +36 -5
- data/Rakefile +3 -1
- data/lib/podio/active_podio/base.rb +311 -0
- data/lib/podio/active_podio/updatable.rb +22 -0
- data/lib/podio/client.rb +7 -4
- data/lib/podio/error.rb +1 -0
- data/lib/podio/middleware/error_response.rb +5 -1
- data/lib/podio/middleware/response_recorder.rb +1 -1
- data/lib/podio/models/app_store_share.rb +67 -0
- data/lib/podio/{areas → models}/application.rb +23 -7
- data/lib/podio/models/application_email.rb +22 -0
- data/lib/podio/models/application_field.rb +17 -0
- data/lib/podio/{areas → models}/bulletin.rb +16 -5
- data/lib/podio/models/by_line.rb +11 -0
- data/lib/podio/models/category.rb +49 -0
- data/lib/podio/models/comment.rb +63 -0
- data/lib/podio/{areas → models}/connection.rb +20 -4
- data/lib/podio/models/contact.rb +10 -0
- data/lib/podio/models/conversation.rb +72 -0
- data/lib/podio/models/conversation_message.rb +12 -0
- data/lib/podio/models/conversation_participant.rb +9 -0
- data/lib/podio/models/email_subscription_setting.rb +39 -0
- data/lib/podio/models/embed.rb +34 -0
- data/lib/podio/models/file_attachment.rb +127 -0
- data/lib/podio/models/form.rb +25 -0
- data/lib/podio/{areas → models}/hook.rb +15 -5
- data/lib/podio/{areas → models}/importer.rb +4 -6
- data/lib/podio/{areas → models}/integration.rb +40 -4
- data/lib/podio/models/item.rb +122 -0
- data/lib/podio/models/item_diff.rb +16 -0
- data/lib/podio/models/item_field.rb +19 -0
- data/lib/podio/models/item_revision.rb +18 -0
- data/lib/podio/models/news.rb +83 -0
- data/lib/podio/models/notification.rb +47 -0
- data/lib/podio/models/notification_group.rb +19 -0
- data/lib/podio/models/o_auth.rb +32 -0
- data/lib/podio/models/o_auth_client.rb +93 -0
- data/lib/podio/{areas → models}/organization.rb +39 -6
- data/lib/podio/models/organization_contact.rb +14 -0
- data/lib/podio/{areas → models}/organization_member.rb +13 -5
- data/lib/podio/models/organization_profile.rb +61 -0
- data/lib/podio/{areas/contact.rb → models/profile.rb} +23 -6
- data/lib/podio/{areas → models}/rating.rb +5 -7
- data/lib/podio/{areas → models}/search.rb +6 -7
- data/lib/podio/models/space.rb +45 -0
- data/lib/podio/models/space_contact.rb +23 -0
- data/lib/podio/models/space_invite.rb +57 -0
- data/lib/podio/models/space_member.rb +32 -0
- data/lib/podio/models/status.rb +35 -0
- data/lib/podio/{areas → models}/subscription.rb +8 -7
- data/lib/podio/{areas → models}/tag.rb +14 -7
- data/lib/podio/models/task.rb +153 -0
- data/lib/podio/models/task_label.rb +50 -0
- data/lib/podio/models/user.rb +66 -0
- data/lib/podio/models/user_status.rb +18 -0
- data/lib/podio/models/via.rb +7 -0
- data/lib/podio/{areas → models}/widget.rb +9 -5
- data/lib/podio/version.rb +1 -1
- data/lib/podio.rb +97 -39
- data/podio.gemspec +4 -3
- data/test/active_podio_test.rb +256 -0
- data/test/client_test.rb +20 -15
- data/test/fixtures/client/18a224aaf83ac57a7b8159cecdbb1263.rack +1 -0
- data/test/fixtures/client/a87c69a0624af0413a670094c6615651.rack +1 -0
- data/test/fixtures/client/ac493997db62308972c208afa76f8479.rack +1 -0
- data/test/fixtures/client/d7fbf422c77af768552423633d0389e8.rack +1 -0
- data/test/fixtures/client/e2d68afe39f5531195273ea259b63916.rack +1 -0
- data/test/fixtures/fixtures.yaml +34 -0
- data/test/models_sanity_test.rb +19 -0
- data/test/test_helper.rb +22 -28
- metadata +89 -64
- data/lib/podio/areas/app_store.rb +0 -69
- data/lib/podio/areas/comment.rb +0 -36
- data/lib/podio/areas/conversation.rb +0 -39
- data/lib/podio/areas/email.rb +0 -24
- data/lib/podio/areas/file.rb +0 -81
- data/lib/podio/areas/form.rb +0 -11
- data/lib/podio/areas/item.rb +0 -68
- data/lib/podio/areas/notification.rb +0 -39
- data/lib/podio/areas/oauth.rb +0 -107
- data/lib/podio/areas/organization_profile.rb +0 -32
- data/lib/podio/areas/space.rb +0 -77
- data/lib/podio/areas/status.rb +0 -19
- data/lib/podio/areas/task.rb +0 -108
- data/lib/podio/areas/user.rb +0 -31
- data/lib/podio/areas/user_status.rb +0 -11
data/test/test_helper.rb
CHANGED
@@ -1,9 +1,7 @@
|
|
1
1
|
require 'test/unit'
|
2
|
-
require 'yajl'
|
3
2
|
|
4
3
|
require 'podio'
|
5
4
|
|
6
|
-
|
7
5
|
ENABLE_STUBS = ENV['ENABLE_STUBS'] == 'true'
|
8
6
|
ENABLE_RECORD = ENV['ENABLE_RECORD'] == 'true'
|
9
7
|
|
@@ -30,48 +28,44 @@ class Test::Unit::TestCase
|
|
30
28
|
end
|
31
29
|
end
|
32
30
|
|
33
|
-
def set_podio_client
|
31
|
+
def set_podio_client
|
34
32
|
Podio.client = Podio::Client.new(
|
35
|
-
:api_url => 'http://
|
36
|
-
:api_key => '
|
37
|
-
:api_secret => '
|
33
|
+
:api_url => 'http://api-sandbox.podio.dev',
|
34
|
+
:api_key => 'sandbox@podio.com',
|
35
|
+
:api_secret => 'sandbox_secret',
|
38
36
|
:enable_stubs => ENABLE_STUBS && !ENABLE_RECORD,
|
39
37
|
:record_mode => ENABLE_RECORD,
|
40
|
-
:test_mode => true
|
41
|
-
:oauth_token => new_token_for_user(user_id)
|
38
|
+
:test_mode => true
|
42
39
|
)
|
43
40
|
end
|
44
41
|
|
45
|
-
|
46
|
-
|
42
|
+
USED_TOKENS = {}
|
43
|
+
def login_as(user_identifier)
|
44
|
+
user = fixtures[:users][user_identifier]
|
45
|
+
USED_TOKENS[user[:mail]] ||= Podio.client.authenticate_with_credentials(user[:mail], user[:password])
|
46
|
+
Podio.client.oauth_token = USED_TOKENS[user[:mail]]
|
47
|
+
Podio.client.reset
|
47
48
|
end
|
48
49
|
|
49
50
|
def stub_responses
|
50
51
|
folder_name = self.class.name.underscore.gsub('_test', '')
|
51
52
|
current_folder = File.join(File.dirname(__FILE__), 'fixtures', folder_name)
|
52
53
|
|
53
|
-
|
54
|
-
|
54
|
+
if File.exists?(current_folder)
|
55
|
+
Dir.foreach(current_folder) do |filename|
|
56
|
+
next unless filename.include?('.rack')
|
55
57
|
|
56
|
-
|
58
|
+
rack_response = eval(File.read(File.join(current_folder, filename)))
|
57
59
|
|
58
|
-
|
59
|
-
|
60
|
+
url = rack_response.shift
|
61
|
+
method = rack_response.shift
|
60
62
|
|
61
|
-
|
63
|
+
Podio.client.stubs.send(method, url) { rack_response }
|
64
|
+
end
|
62
65
|
end
|
63
66
|
end
|
64
|
-
|
65
|
-
def
|
66
|
-
|
67
|
-
1 => '352e85cd67eff86179194515b91a75404c1169ad083ad435b200af834b9121665b2aaf894f599b7d9b1bee6b7551f3a11e2a02dc43def9a9b549b1f2a4fe9a42',
|
68
|
-
2 => '58ac6854ac3e8d7e8797ed5b37ba8dfeca4224cabcd4ad4f04a5f328c83d9edb3be911e6fbccf742841369734ab26136c66380385e58ff2b5da03f7fe45852b1'
|
69
|
-
}
|
70
|
-
|
71
|
-
Podio::OAuthToken.new(
|
72
|
-
'access_token' => tokens[user_id],
|
73
|
-
'refresh_token' => '82e7a11ae187f28a25261599aa6229cd89f8faee48cba18a75d70efae88ba665ced11d43143b7f5bebb31a4103662b851dd2db1879a3947b843259479fccfad3',
|
74
|
-
'expires_in' => 3600
|
75
|
-
)
|
67
|
+
|
68
|
+
def fixtures
|
69
|
+
@fixtures ||= YAML.load_file(File.join(File.dirname(__FILE__), 'fixtures', 'fixtures.yaml'))
|
76
70
|
end
|
77
71
|
end
|
metadata
CHANGED
@@ -1,21 +1,17 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: podio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
prerelease:
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 4
|
8
|
-
- 1
|
9
|
-
version: 0.4.1
|
4
|
+
prerelease:
|
5
|
+
version: 0.5.0
|
10
6
|
platform: ruby
|
11
7
|
authors:
|
12
8
|
- Florian Munz
|
9
|
+
- Casper Fabricius
|
13
10
|
autorequire:
|
14
11
|
bindir: bin
|
15
12
|
cert_chain: []
|
16
13
|
|
17
|
-
date: 2011-
|
18
|
-
default_executable:
|
14
|
+
date: 2011-06-24 00:00:00 Z
|
19
15
|
dependencies:
|
20
16
|
- !ruby/object:Gem::Dependency
|
21
17
|
name: faraday
|
@@ -25,10 +21,6 @@ dependencies:
|
|
25
21
|
requirements:
|
26
22
|
- - ~>
|
27
23
|
- !ruby/object:Gem::Version
|
28
|
-
segments:
|
29
|
-
- 0
|
30
|
-
- 7
|
31
|
-
- 0
|
32
24
|
version: 0.7.0
|
33
25
|
type: :runtime
|
34
26
|
version_requirements: *id001
|
@@ -40,44 +32,44 @@ dependencies:
|
|
40
32
|
requirements:
|
41
33
|
- - ~>
|
42
34
|
- !ruby/object:Gem::Version
|
43
|
-
|
44
|
-
- 3
|
45
|
-
- 0
|
46
|
-
version: "3.0"
|
35
|
+
version: 3.0.0
|
47
36
|
type: :runtime
|
48
37
|
version_requirements: *id002
|
49
38
|
- !ruby/object:Gem::Dependency
|
50
|
-
name:
|
39
|
+
name: activemodel
|
51
40
|
prerelease: false
|
52
41
|
requirement: &id003 !ruby/object:Gem::Requirement
|
42
|
+
none: false
|
43
|
+
requirements:
|
44
|
+
- - ~>
|
45
|
+
- !ruby/object:Gem::Version
|
46
|
+
version: 3.0.0
|
47
|
+
type: :runtime
|
48
|
+
version_requirements: *id003
|
49
|
+
- !ruby/object:Gem::Dependency
|
50
|
+
name: i18n
|
51
|
+
prerelease: false
|
52
|
+
requirement: &id004 !ruby/object:Gem::Requirement
|
53
53
|
none: false
|
54
54
|
requirements:
|
55
55
|
- - ">="
|
56
56
|
- !ruby/object:Gem::Version
|
57
|
-
segments:
|
58
|
-
- 0
|
59
|
-
- 4
|
60
|
-
- 2
|
61
57
|
version: 0.4.2
|
62
58
|
type: :runtime
|
63
|
-
version_requirements: *
|
59
|
+
version_requirements: *id004
|
64
60
|
- !ruby/object:Gem::Dependency
|
65
61
|
name: multi_json
|
66
62
|
prerelease: false
|
67
|
-
requirement: &
|
63
|
+
requirement: &id005 !ruby/object:Gem::Requirement
|
68
64
|
none: false
|
69
65
|
requirements:
|
70
66
|
- - ~>
|
71
67
|
- !ruby/object:Gem::Version
|
72
|
-
segments:
|
73
|
-
- 0
|
74
|
-
- 0
|
75
|
-
- 5
|
76
68
|
version: 0.0.5
|
77
69
|
type: :runtime
|
78
|
-
version_requirements: *
|
70
|
+
version_requirements: *id005
|
79
71
|
description: |
|
80
|
-
The
|
72
|
+
The official Ruby wrapper for the Podio API used and maintained by the Podio team
|
81
73
|
|
82
74
|
email: florian@podio.com
|
83
75
|
executables: []
|
@@ -94,35 +86,8 @@ files:
|
|
94
86
|
- Rakefile
|
95
87
|
- examples/sinatra.rb
|
96
88
|
- lib/podio.rb
|
97
|
-
- lib/podio/
|
98
|
-
- lib/podio/
|
99
|
-
- lib/podio/areas/bulletin.rb
|
100
|
-
- lib/podio/areas/comment.rb
|
101
|
-
- lib/podio/areas/connection.rb
|
102
|
-
- lib/podio/areas/contact.rb
|
103
|
-
- lib/podio/areas/conversation.rb
|
104
|
-
- lib/podio/areas/email.rb
|
105
|
-
- lib/podio/areas/file.rb
|
106
|
-
- lib/podio/areas/form.rb
|
107
|
-
- lib/podio/areas/hook.rb
|
108
|
-
- lib/podio/areas/importer.rb
|
109
|
-
- lib/podio/areas/integration.rb
|
110
|
-
- lib/podio/areas/item.rb
|
111
|
-
- lib/podio/areas/notification.rb
|
112
|
-
- lib/podio/areas/oauth.rb
|
113
|
-
- lib/podio/areas/organization.rb
|
114
|
-
- lib/podio/areas/organization_member.rb
|
115
|
-
- lib/podio/areas/organization_profile.rb
|
116
|
-
- lib/podio/areas/rating.rb
|
117
|
-
- lib/podio/areas/search.rb
|
118
|
-
- lib/podio/areas/space.rb
|
119
|
-
- lib/podio/areas/status.rb
|
120
|
-
- lib/podio/areas/subscription.rb
|
121
|
-
- lib/podio/areas/tag.rb
|
122
|
-
- lib/podio/areas/task.rb
|
123
|
-
- lib/podio/areas/user.rb
|
124
|
-
- lib/podio/areas/user_status.rb
|
125
|
-
- lib/podio/areas/widget.rb
|
89
|
+
- lib/podio/active_podio/base.rb
|
90
|
+
- lib/podio/active_podio/updatable.rb
|
126
91
|
- lib/podio/client.rb
|
127
92
|
- lib/podio/error.rb
|
128
93
|
- lib/podio/middleware/date_conversion.rb
|
@@ -132,12 +97,68 @@ files:
|
|
132
97
|
- lib/podio/middleware/logger.rb
|
133
98
|
- lib/podio/middleware/oauth2.rb
|
134
99
|
- lib/podio/middleware/response_recorder.rb
|
100
|
+
- lib/podio/models/app_store_share.rb
|
101
|
+
- lib/podio/models/application.rb
|
102
|
+
- lib/podio/models/application_email.rb
|
103
|
+
- lib/podio/models/application_field.rb
|
104
|
+
- lib/podio/models/bulletin.rb
|
105
|
+
- lib/podio/models/by_line.rb
|
106
|
+
- lib/podio/models/category.rb
|
107
|
+
- lib/podio/models/comment.rb
|
108
|
+
- lib/podio/models/connection.rb
|
109
|
+
- lib/podio/models/contact.rb
|
110
|
+
- lib/podio/models/conversation.rb
|
111
|
+
- lib/podio/models/conversation_message.rb
|
112
|
+
- lib/podio/models/conversation_participant.rb
|
113
|
+
- lib/podio/models/email_subscription_setting.rb
|
114
|
+
- lib/podio/models/embed.rb
|
115
|
+
- lib/podio/models/file_attachment.rb
|
116
|
+
- lib/podio/models/form.rb
|
117
|
+
- lib/podio/models/hook.rb
|
118
|
+
- lib/podio/models/importer.rb
|
119
|
+
- lib/podio/models/integration.rb
|
120
|
+
- lib/podio/models/item.rb
|
121
|
+
- lib/podio/models/item_diff.rb
|
122
|
+
- lib/podio/models/item_field.rb
|
123
|
+
- lib/podio/models/item_revision.rb
|
124
|
+
- lib/podio/models/news.rb
|
125
|
+
- lib/podio/models/notification.rb
|
126
|
+
- lib/podio/models/notification_group.rb
|
127
|
+
- lib/podio/models/o_auth.rb
|
128
|
+
- lib/podio/models/o_auth_client.rb
|
129
|
+
- lib/podio/models/organization.rb
|
130
|
+
- lib/podio/models/organization_contact.rb
|
131
|
+
- lib/podio/models/organization_member.rb
|
132
|
+
- lib/podio/models/organization_profile.rb
|
133
|
+
- lib/podio/models/profile.rb
|
134
|
+
- lib/podio/models/rating.rb
|
135
|
+
- lib/podio/models/search.rb
|
136
|
+
- lib/podio/models/space.rb
|
137
|
+
- lib/podio/models/space_contact.rb
|
138
|
+
- lib/podio/models/space_invite.rb
|
139
|
+
- lib/podio/models/space_member.rb
|
140
|
+
- lib/podio/models/status.rb
|
141
|
+
- lib/podio/models/subscription.rb
|
142
|
+
- lib/podio/models/tag.rb
|
143
|
+
- lib/podio/models/task.rb
|
144
|
+
- lib/podio/models/task_label.rb
|
145
|
+
- lib/podio/models/user.rb
|
146
|
+
- lib/podio/models/user_status.rb
|
147
|
+
- lib/podio/models/via.rb
|
148
|
+
- lib/podio/models/widget.rb
|
135
149
|
- lib/podio/response_wrapper.rb
|
136
150
|
- lib/podio/version.rb
|
137
151
|
- podio.gemspec
|
152
|
+
- test/active_podio_test.rb
|
138
153
|
- test/client_test.rb
|
154
|
+
- test/fixtures/client/18a224aaf83ac57a7b8159cecdbb1263.rack
|
155
|
+
- test/fixtures/client/a87c69a0624af0413a670094c6615651.rack
|
156
|
+
- test/fixtures/client/ac493997db62308972c208afa76f8479.rack
|
157
|
+
- test/fixtures/client/d7fbf422c77af768552423633d0389e8.rack
|
158
|
+
- test/fixtures/client/e2d68afe39f5531195273ea259b63916.rack
|
159
|
+
- test/fixtures/fixtures.yaml
|
160
|
+
- test/models_sanity_test.rb
|
139
161
|
- test/test_helper.rb
|
140
|
-
has_rdoc: true
|
141
162
|
homepage: https://github.com/podio/podio-rb
|
142
163
|
licenses: []
|
143
164
|
|
@@ -151,24 +172,28 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
151
172
|
requirements:
|
152
173
|
- - ">="
|
153
174
|
- !ruby/object:Gem::Version
|
154
|
-
segments:
|
155
|
-
- 0
|
156
175
|
version: "0"
|
157
176
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
158
177
|
none: false
|
159
178
|
requirements:
|
160
179
|
- - ">="
|
161
180
|
- !ruby/object:Gem::Version
|
162
|
-
segments:
|
163
|
-
- 0
|
164
181
|
version: "0"
|
165
182
|
requirements: []
|
166
183
|
|
167
184
|
rubyforge_project:
|
168
|
-
rubygems_version: 1.
|
185
|
+
rubygems_version: 1.8.5
|
169
186
|
signing_key:
|
170
187
|
specification_version: 3
|
171
188
|
summary: Ruby wrapper for the Podio API
|
172
189
|
test_files:
|
190
|
+
- test/active_podio_test.rb
|
173
191
|
- test/client_test.rb
|
192
|
+
- test/fixtures/client/18a224aaf83ac57a7b8159cecdbb1263.rack
|
193
|
+
- test/fixtures/client/a87c69a0624af0413a670094c6615651.rack
|
194
|
+
- test/fixtures/client/ac493997db62308972c208afa76f8479.rack
|
195
|
+
- test/fixtures/client/d7fbf422c77af768552423633d0389e8.rack
|
196
|
+
- test/fixtures/client/e2d68afe39f5531195273ea259b63916.rack
|
197
|
+
- test/fixtures/fixtures.yaml
|
198
|
+
- test/models_sanity_test.rb
|
174
199
|
- test/test_helper.rb
|
@@ -1,69 +0,0 @@
|
|
1
|
-
module Podio
|
2
|
-
module Category
|
3
|
-
include Podio::ResponseWrapper
|
4
|
-
extend self
|
5
|
-
|
6
|
-
def create(attributes)
|
7
|
-
response = Podio.connection.post do |req|
|
8
|
-
req.url "/app_store/category/"
|
9
|
-
req.body = attributes
|
10
|
-
end
|
11
|
-
|
12
|
-
response.status
|
13
|
-
end
|
14
|
-
|
15
|
-
def update(id, attributes)
|
16
|
-
response = Podio.connection.put do |req|
|
17
|
-
req.url "/app_store/category/#{id}"
|
18
|
-
req.body = attributes
|
19
|
-
end
|
20
|
-
|
21
|
-
response.status
|
22
|
-
end
|
23
|
-
|
24
|
-
def delete(id)
|
25
|
-
Podio.connection.delete("/app_store/category/#{id}").status
|
26
|
-
end
|
27
|
-
|
28
|
-
def find(id)
|
29
|
-
member Podio.connection.get("/app_store/category/#{id}").body
|
30
|
-
end
|
31
|
-
|
32
|
-
def find_all
|
33
|
-
collection Podio.connection.get("/app_store/category/").body
|
34
|
-
end
|
35
|
-
|
36
|
-
private
|
37
|
-
|
38
|
-
def self.collection(response)
|
39
|
-
return Struct.new(:functional, :vertical).new([], []) if response.blank?
|
40
|
-
functionals = response['functional'].map! { |cat| member(cat) }
|
41
|
-
verticals = response['vertical'].map! { |cat| member(cat) }
|
42
|
-
Struct.new(:functional, :vertical).new(functionals, verticals)
|
43
|
-
end
|
44
|
-
end
|
45
|
-
|
46
|
-
module AppStoreShare
|
47
|
-
include Podio::ResponseWrapper
|
48
|
-
extend self
|
49
|
-
|
50
|
-
def create(attributes)
|
51
|
-
response = Podio.connection.post do |req|
|
52
|
-
req.url "/app_store/"
|
53
|
-
req.body = attributes
|
54
|
-
end
|
55
|
-
|
56
|
-
response.body['share_id']
|
57
|
-
end
|
58
|
-
|
59
|
-
def find(id)
|
60
|
-
member Podio.connection.get("/app_store/#{id}/v2").body
|
61
|
-
end
|
62
|
-
|
63
|
-
def find_all_private_for_org(org_id)
|
64
|
-
list Podio.connection.get("/app_store/org/#{org_id}/").body['shares']
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
68
|
-
|
69
|
-
end
|
data/lib/podio/areas/comment.rb
DELETED
@@ -1,36 +0,0 @@
|
|
1
|
-
module Podio
|
2
|
-
module Comment
|
3
|
-
include Podio::ResponseWrapper
|
4
|
-
extend self
|
5
|
-
|
6
|
-
def create(commentable_type, commentable_id, attributes)
|
7
|
-
response = Podio.connection.post do |req|
|
8
|
-
req.url "/comment/#{commentable_type}/#{commentable_id}"
|
9
|
-
req.body = attributes
|
10
|
-
end
|
11
|
-
|
12
|
-
response.body['comment_id']
|
13
|
-
end
|
14
|
-
|
15
|
-
def update(id, attributes)
|
16
|
-
response = Podio.connection.put do |req|
|
17
|
-
req.url "/comment/#{id}"
|
18
|
-
req.body = attributes
|
19
|
-
end
|
20
|
-
|
21
|
-
response.status
|
22
|
-
end
|
23
|
-
|
24
|
-
def delete(id)
|
25
|
-
Podio.connection.delete("/comment/#{id}").status
|
26
|
-
end
|
27
|
-
|
28
|
-
def find(id)
|
29
|
-
member Podio.connection.get("/comment/#{id}").body
|
30
|
-
end
|
31
|
-
|
32
|
-
def find_all_for(commentable_type, commentable_id)
|
33
|
-
list Podio.connection.get("/comment/#{commentable_type}/#{commentable_id}").body
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
module Podio
|
2
|
-
module Conversation
|
3
|
-
include Podio::ResponseWrapper
|
4
|
-
extend self
|
5
|
-
|
6
|
-
def find(conversation_id)
|
7
|
-
member Podio.connection.get("/conversation/#{conversation_id}").body
|
8
|
-
end
|
9
|
-
|
10
|
-
def find_all_for_reference(ref_type, ref_id)
|
11
|
-
list Podio.connection.get("/conversation/#{ref_type}/#{ref_id}/").body
|
12
|
-
end
|
13
|
-
|
14
|
-
def create(attributes)
|
15
|
-
response = Podio.connection.post do |req|
|
16
|
-
req.url '/conversation/'
|
17
|
-
req.body = attributes
|
18
|
-
end
|
19
|
-
response.body
|
20
|
-
end
|
21
|
-
|
22
|
-
def create_for_reference(ref_type, ref_id, attributes)
|
23
|
-
response = Podio.connection.post do |req|
|
24
|
-
req.url "/conversation/#{ref_type}/#{ref_id}/"
|
25
|
-
req.body = attributes
|
26
|
-
end
|
27
|
-
response.body
|
28
|
-
end
|
29
|
-
|
30
|
-
def create_reply(conversation_id, text, file_ids = [])
|
31
|
-
response = Podio.connection.post do |req|
|
32
|
-
req.url "/conversation/#{conversation_id}/reply"
|
33
|
-
req.body = { :text => text, :file_ids => file_ids }
|
34
|
-
end
|
35
|
-
response.body['message_id']
|
36
|
-
end
|
37
|
-
|
38
|
-
end
|
39
|
-
end
|
data/lib/podio/areas/email.rb
DELETED
@@ -1,24 +0,0 @@
|
|
1
|
-
module Podio
|
2
|
-
module Email
|
3
|
-
include Podio::ResponseWrapper
|
4
|
-
extend self
|
5
|
-
|
6
|
-
def get_groups()
|
7
|
-
member Podio.connection.get { |req|
|
8
|
-
req.url("/email/group/", {})
|
9
|
-
}.body
|
10
|
-
end
|
11
|
-
|
12
|
-
def update_groups(options)
|
13
|
-
Podio.connection.put { |req|
|
14
|
-
req.url "/email/group/"
|
15
|
-
req.body = options
|
16
|
-
}.body
|
17
|
-
end
|
18
|
-
|
19
|
-
def unsubscribe(username)
|
20
|
-
Podio.connection.post("/email/unsubscribe/#{username}").status
|
21
|
-
end
|
22
|
-
|
23
|
-
end
|
24
|
-
end
|
data/lib/podio/areas/file.rb
DELETED
@@ -1,81 +0,0 @@
|
|
1
|
-
module Podio
|
2
|
-
module File
|
3
|
-
include Podio::ResponseWrapper
|
4
|
-
extend self
|
5
|
-
|
6
|
-
# Uploading a file is a two-step operation
|
7
|
-
# First, the file must be created to get a file id and the path to move it to
|
8
|
-
def create(name, content_type)
|
9
|
-
response = Podio.connection.post do |req|
|
10
|
-
req.url "/file/"
|
11
|
-
req.body = { :name => name, :mimetype => content_type }
|
12
|
-
end
|
13
|
-
|
14
|
-
response.body
|
15
|
-
end
|
16
|
-
|
17
|
-
# Then, when the file has been moved, it must be marked as available
|
18
|
-
def set_available(id)
|
19
|
-
Podio.connection.post "/file/#{id}/available"
|
20
|
-
end
|
21
|
-
|
22
|
-
# Attach a file to an existing reference
|
23
|
-
def attach(id, ref_type, ref_id)
|
24
|
-
Podio.connection.post do |req|
|
25
|
-
req.url "/file/#{id}/attach"
|
26
|
-
req.body = { :ref_type => ref_type, :ref_id => ref_id }
|
27
|
-
end
|
28
|
-
end
|
29
|
-
|
30
|
-
def copy(id)
|
31
|
-
Podio.connection.post("/file/#{id}/copy").body['file_id']
|
32
|
-
end
|
33
|
-
|
34
|
-
def delete(id)
|
35
|
-
Podio.connection.delete("/file/#{id}")
|
36
|
-
end
|
37
|
-
|
38
|
-
def find(id)
|
39
|
-
member Podio.connection.get("/file/#{id}").body
|
40
|
-
end
|
41
|
-
|
42
|
-
def find_for_app(app_id, options={})
|
43
|
-
collection Podio.connection.get { |req|
|
44
|
-
req.url("/file/app/#{app_id}/", options)
|
45
|
-
}.body
|
46
|
-
end
|
47
|
-
|
48
|
-
def find_for_space(space_id, options={})
|
49
|
-
collection Podio.connection.get { |req|
|
50
|
-
req.url("/file/space/#{space_id}/", options)
|
51
|
-
}.body
|
52
|
-
end
|
53
|
-
|
54
|
-
def find_latest_for_app(app_id, options={})
|
55
|
-
collection Podio.connection.get { |req|
|
56
|
-
req.url("/file/app/#{app_id}/latest/", options)
|
57
|
-
}.body
|
58
|
-
end
|
59
|
-
|
60
|
-
def find_latest_for_space(space_id, options={})
|
61
|
-
collection Podio.connection.get { |req|
|
62
|
-
req.url("/file/space/#{space_id}/latest/", options)
|
63
|
-
}.body
|
64
|
-
end
|
65
|
-
|
66
|
-
def replace(old_file_id, new_file_id)
|
67
|
-
Podio.connection.post { |req|
|
68
|
-
req.url "/file/#{new_file_id}/replace"
|
69
|
-
req.body = { :old_file_id => old_file_id }
|
70
|
-
}.body
|
71
|
-
end
|
72
|
-
|
73
|
-
def update(id, description)
|
74
|
-
Podio.connection.put { |req|
|
75
|
-
req.url "/file/#{file_id}"
|
76
|
-
req.body = { :description => description }
|
77
|
-
}.body
|
78
|
-
end
|
79
|
-
|
80
|
-
end
|
81
|
-
end
|
data/lib/podio/areas/form.rb
DELETED
data/lib/podio/areas/item.rb
DELETED
@@ -1,68 +0,0 @@
|
|
1
|
-
module Podio
|
2
|
-
module Item
|
3
|
-
include Podio::ResponseWrapper
|
4
|
-
extend self
|
5
|
-
|
6
|
-
def find(id)
|
7
|
-
member Podio.connection.get("/item/#{id}").body
|
8
|
-
end
|
9
|
-
|
10
|
-
def find_basic(id)
|
11
|
-
member Podio.connection.get("/item/#{id}/basic").body
|
12
|
-
end
|
13
|
-
|
14
|
-
def find_all_by_external_id(app_id, external_id)
|
15
|
-
collection Podio.connection.get("/item/app/#{app_id}/v2/?external_id=#{external_id}").body
|
16
|
-
end
|
17
|
-
|
18
|
-
def find_all(app_id, options={})
|
19
|
-
collection Podio.connection.get { |req|
|
20
|
-
req.url("/item/app/#{app_id}/", options)
|
21
|
-
}.body
|
22
|
-
end
|
23
|
-
|
24
|
-
def find_next(current_item_id, time = nil)
|
25
|
-
find_next_or_previous(:next, current_item_id, time)
|
26
|
-
end
|
27
|
-
|
28
|
-
def find_previous(current_item_id, time = nil)
|
29
|
-
find_next_or_previous(:previous, current_item_id, time)
|
30
|
-
end
|
31
|
-
|
32
|
-
def revisions(item_id)
|
33
|
-
collection Podio.connection.get("/item/#{item_id}/revision/").body
|
34
|
-
end
|
35
|
-
|
36
|
-
def revision_difference(item_id, revision_from_id, revision_to_id)
|
37
|
-
list Podio.connection.get{ |req|
|
38
|
-
req.url("/item/#{item_id}/revision/#{revision_from_id}/#{revision_to_id}")
|
39
|
-
}.body
|
40
|
-
end
|
41
|
-
|
42
|
-
def create(app_id, attributes)
|
43
|
-
response = Podio.connection.post do |req|
|
44
|
-
req.url "/item/app/#{app_id}/"
|
45
|
-
req.body = attributes
|
46
|
-
end
|
47
|
-
|
48
|
-
response.body['item_id']
|
49
|
-
end
|
50
|
-
|
51
|
-
def delete(id)
|
52
|
-
Podio.connection.delete("/item/#{id}").body
|
53
|
-
end
|
54
|
-
|
55
|
-
protected
|
56
|
-
|
57
|
-
def time_options(time)
|
58
|
-
time.present? ? { 'time' => (time.is_a?(String) ? time : time.to_s(:db)) } : {}
|
59
|
-
end
|
60
|
-
|
61
|
-
def find_next_or_previous(operation, current_item_id, time)
|
62
|
-
member Podio.connection.get { |req|
|
63
|
-
req.url("/item/#{current_item_id}/#{operation}", time_options(time))
|
64
|
-
}.body
|
65
|
-
end
|
66
|
-
|
67
|
-
end
|
68
|
-
end
|
@@ -1,39 +0,0 @@
|
|
1
|
-
module Podio
|
2
|
-
module Notification
|
3
|
-
include Podio::ResponseWrapper
|
4
|
-
extend self
|
5
|
-
|
6
|
-
def find(id)
|
7
|
-
member Podio.connection.get("/notification/#{id}").body
|
8
|
-
end
|
9
|
-
|
10
|
-
def mark_as_viewed(id)
|
11
|
-
Podio.connection.post("/notification/#{id}/viewed").status
|
12
|
-
end
|
13
|
-
|
14
|
-
def mark_all_as_viewed
|
15
|
-
Podio.connection.post("/notification/viewed").status
|
16
|
-
end
|
17
|
-
|
18
|
-
def star(id)
|
19
|
-
Podio.connection.post("/notification/#{id}/star").status
|
20
|
-
end
|
21
|
-
|
22
|
-
def unstar(id)
|
23
|
-
Podio.connection.delete("/notification/#{id}/star").status
|
24
|
-
end
|
25
|
-
|
26
|
-
end
|
27
|
-
|
28
|
-
module NotificationGroup
|
29
|
-
include Podio::ResponseWrapper
|
30
|
-
extend self
|
31
|
-
|
32
|
-
def find_all(options={})
|
33
|
-
list Podio.connection.get { |req|
|
34
|
-
req.url('/notification/', options)
|
35
|
-
}.body
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
39
|
-
|