podio 0.4.1 → 0.5.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (86) hide show
  1. data/README.md +36 -5
  2. data/Rakefile +3 -1
  3. data/lib/podio/active_podio/base.rb +311 -0
  4. data/lib/podio/active_podio/updatable.rb +22 -0
  5. data/lib/podio/client.rb +7 -4
  6. data/lib/podio/error.rb +1 -0
  7. data/lib/podio/middleware/error_response.rb +5 -1
  8. data/lib/podio/middleware/response_recorder.rb +1 -1
  9. data/lib/podio/models/app_store_share.rb +67 -0
  10. data/lib/podio/{areas → models}/application.rb +23 -7
  11. data/lib/podio/models/application_email.rb +22 -0
  12. data/lib/podio/models/application_field.rb +17 -0
  13. data/lib/podio/{areas → models}/bulletin.rb +16 -5
  14. data/lib/podio/models/by_line.rb +11 -0
  15. data/lib/podio/models/category.rb +49 -0
  16. data/lib/podio/models/comment.rb +63 -0
  17. data/lib/podio/{areas → models}/connection.rb +20 -4
  18. data/lib/podio/models/contact.rb +10 -0
  19. data/lib/podio/models/conversation.rb +72 -0
  20. data/lib/podio/models/conversation_message.rb +12 -0
  21. data/lib/podio/models/conversation_participant.rb +9 -0
  22. data/lib/podio/models/email_subscription_setting.rb +39 -0
  23. data/lib/podio/models/embed.rb +34 -0
  24. data/lib/podio/models/file_attachment.rb +127 -0
  25. data/lib/podio/models/form.rb +25 -0
  26. data/lib/podio/{areas → models}/hook.rb +15 -5
  27. data/lib/podio/{areas → models}/importer.rb +4 -6
  28. data/lib/podio/{areas → models}/integration.rb +40 -4
  29. data/lib/podio/models/item.rb +122 -0
  30. data/lib/podio/models/item_diff.rb +16 -0
  31. data/lib/podio/models/item_field.rb +19 -0
  32. data/lib/podio/models/item_revision.rb +18 -0
  33. data/lib/podio/models/news.rb +83 -0
  34. data/lib/podio/models/notification.rb +47 -0
  35. data/lib/podio/models/notification_group.rb +19 -0
  36. data/lib/podio/models/o_auth.rb +32 -0
  37. data/lib/podio/models/o_auth_client.rb +93 -0
  38. data/lib/podio/{areas → models}/organization.rb +39 -6
  39. data/lib/podio/models/organization_contact.rb +14 -0
  40. data/lib/podio/{areas → models}/organization_member.rb +13 -5
  41. data/lib/podio/models/organization_profile.rb +61 -0
  42. data/lib/podio/{areas/contact.rb → models/profile.rb} +23 -6
  43. data/lib/podio/{areas → models}/rating.rb +5 -7
  44. data/lib/podio/{areas → models}/search.rb +6 -7
  45. data/lib/podio/models/space.rb +45 -0
  46. data/lib/podio/models/space_contact.rb +23 -0
  47. data/lib/podio/models/space_invite.rb +57 -0
  48. data/lib/podio/models/space_member.rb +32 -0
  49. data/lib/podio/models/status.rb +35 -0
  50. data/lib/podio/{areas → models}/subscription.rb +8 -7
  51. data/lib/podio/{areas → models}/tag.rb +14 -7
  52. data/lib/podio/models/task.rb +153 -0
  53. data/lib/podio/models/task_label.rb +50 -0
  54. data/lib/podio/models/user.rb +66 -0
  55. data/lib/podio/models/user_status.rb +18 -0
  56. data/lib/podio/models/via.rb +7 -0
  57. data/lib/podio/{areas → models}/widget.rb +9 -5
  58. data/lib/podio/version.rb +1 -1
  59. data/lib/podio.rb +97 -39
  60. data/podio.gemspec +4 -3
  61. data/test/active_podio_test.rb +256 -0
  62. data/test/client_test.rb +20 -15
  63. data/test/fixtures/client/18a224aaf83ac57a7b8159cecdbb1263.rack +1 -0
  64. data/test/fixtures/client/a87c69a0624af0413a670094c6615651.rack +1 -0
  65. data/test/fixtures/client/ac493997db62308972c208afa76f8479.rack +1 -0
  66. data/test/fixtures/client/d7fbf422c77af768552423633d0389e8.rack +1 -0
  67. data/test/fixtures/client/e2d68afe39f5531195273ea259b63916.rack +1 -0
  68. data/test/fixtures/fixtures.yaml +34 -0
  69. data/test/models_sanity_test.rb +19 -0
  70. data/test/test_helper.rb +22 -28
  71. metadata +89 -64
  72. data/lib/podio/areas/app_store.rb +0 -69
  73. data/lib/podio/areas/comment.rb +0 -36
  74. data/lib/podio/areas/conversation.rb +0 -39
  75. data/lib/podio/areas/email.rb +0 -24
  76. data/lib/podio/areas/file.rb +0 -81
  77. data/lib/podio/areas/form.rb +0 -11
  78. data/lib/podio/areas/item.rb +0 -68
  79. data/lib/podio/areas/notification.rb +0 -39
  80. data/lib/podio/areas/oauth.rb +0 -107
  81. data/lib/podio/areas/organization_profile.rb +0 -32
  82. data/lib/podio/areas/space.rb +0 -77
  83. data/lib/podio/areas/status.rb +0 -19
  84. data/lib/podio/areas/task.rb +0 -108
  85. data/lib/podio/areas/user.rb +0 -31
  86. data/lib/podio/areas/user_status.rb +0 -11
@@ -1,107 +0,0 @@
1
- module Podio
2
- module OAuth
3
- include Podio::ResponseWrapper
4
- extend self
5
-
6
- def authorize(attributes)
7
- response = Podio.connection.post do |req|
8
- req.url "/oauth/authorize"
9
- req.body = attributes
10
- end
11
-
12
- response.body
13
- end
14
-
15
- def get_info(attributes)
16
- response = Podio.connection.post do |req|
17
- req.url "/oauth/info"
18
- req.body = attributes
19
- end
20
-
21
- response.body
22
- end
23
-
24
- def get_access_token(attributes)
25
- response = Podio.connection.post do |req|
26
- req.url "/oauth/token"
27
- req.body = attributes
28
- end
29
-
30
- response.body
31
- end
32
-
33
- module OAuthClient
34
- include Podio::ResponseWrapper
35
- extend self
36
-
37
- def create(attributes)
38
- response = Podio.connection.post do |req|
39
- req.url "/oauth/client/"
40
- req.body = attributes
41
- end
42
-
43
- response.body['auth_client_id']
44
- end
45
-
46
- def create_admin(user_id, attributes)
47
- response = Podio.connection.post do |req|
48
- req.url "/oauth/client/user/#{user_id}/"
49
- req.body = attributes
50
- end
51
-
52
- response.status
53
- end
54
-
55
- def update(id, attributes)
56
- response = Podio.connection.put do |req|
57
- req.url "/oauth/client/#{id}"
58
- req.body = attributes
59
- end
60
-
61
- response.status
62
- end
63
-
64
- def update_admin(id, attributes)
65
- response = Podio.connection.put do |req|
66
- req.url "/oauth/client/#{id}/admin"
67
- req.body = attributes
68
- end
69
-
70
- response.status
71
- end
72
-
73
- def delete(id)``
74
- response = Podio.connection.delete("/oauth/client/#{id}")
75
-
76
- response.status
77
- end
78
-
79
- def delete_grant(id)
80
- response = Podio.connection.delete("/oauth/grant/client/#{id}")
81
-
82
- response.status
83
- end
84
-
85
- def reset(id)
86
- response = Podio.connection.post("/oauth/client/#{id}/reset")
87
- response.status
88
- end
89
-
90
- def find_granted_clients()
91
- list Podio.connection.get("oauth/grant/client/").body
92
- end
93
-
94
- def find_all_for_current_user()
95
- list Podio.connection.get("oauth/client/").body
96
- end
97
-
98
- def find_all_for_user(user_id)
99
- list Podio.connection.get("oauth/client/user/#{user_id}/").body
100
- end
101
-
102
- def find(client_id)
103
- member Podio.connection.get("oauth/client/#{client_id}").body
104
- end
105
- end
106
- end
107
- end
@@ -1,32 +0,0 @@
1
- module Podio
2
- module OrganizationProfile
3
- include Podio::ResponseWrapper
4
- extend self
5
-
6
- def find(org_id)
7
- member Podio.connection.get("/org/#{org_id}/appstore").body
8
- end
9
-
10
- def create(org_id, attributes)
11
- response = Podio.connection.post do |req|
12
- req.url "/org/#{org_id}/appstore"
13
- req.body = attributes
14
- end
15
-
16
- response.body
17
- end
18
-
19
- def update(org_id, attributes)
20
- response = Podio.connection.put do |req|
21
- req.url "/org/#{org_id}/appstore"
22
- req.body = attributes
23
- end
24
- response.status
25
- end
26
-
27
- def delete(org_id)
28
- Podio.connection.delete("/org/#{org_id}/appstore").status
29
- end
30
-
31
- end
32
- end
@@ -1,77 +0,0 @@
1
- require "erb"
2
-
3
- module Podio
4
- module Space
5
- include Podio::ResponseWrapper
6
- extend self
7
-
8
- def create(attributes)
9
- response = Podio.connection.post do |req|
10
- req.url '/space/'
11
- req.body = attributes
12
- end
13
-
14
- response.body
15
- end
16
-
17
- def find(id)
18
- member Podio.connection.get("/space/#{id}").body
19
- end
20
-
21
- def find_by_url(url)
22
- member Podio.connection.get("/space/url?url=#{ERB::Util.url_encode(url)}").body
23
- end
24
-
25
- def find_all_for_org(org_id)
26
- list Podio.connection.get("/org/#{org_id}/space/").body
27
- end
28
-
29
- end
30
-
31
- module SpaceInvite
32
- include Podio::ResponseWrapper
33
- extend self
34
-
35
- def create(space_id, role, attributes={})
36
- response = Podio.connection.post do |req|
37
- req.url "/space/#{space_id}/invite"
38
- req.body = attributes.merge(:role => role)
39
- end
40
-
41
- response.body
42
- end
43
-
44
- def accept(invite_code)
45
- response = Podio.connection.post do |req|
46
- req.url '/space/invite/accept'
47
- req.body = {:invite_code => invite_code}
48
- end
49
-
50
- response.body
51
- end
52
- end
53
-
54
- module SpaceMember
55
- include Podio::ResponseWrapper
56
- extend self
57
-
58
- def find_all_for_role(space_id, role)
59
- list Podio.connection.get { |req|
60
- req.url("/space/#{space_id}/member/#{role}/")
61
- }.body
62
- end
63
-
64
- def update_role(space_id, user_id, role)
65
- response = Podio.connection.put do |req|
66
- req.url "/space/#{space_id}/member/#{user_id}"
67
- req.body = { :role => role.to_s }
68
- end
69
- response.status
70
- end
71
-
72
- def end_membership(space_id, user_id)
73
- Podio.connection.delete("/space/#{space_id}/member/#{user_id}").status
74
- end
75
-
76
- end
77
- end
@@ -1,19 +0,0 @@
1
- module Podio
2
- module Status
3
- include Podio::ResponseWrapper
4
- extend self
5
-
6
- def find(id)
7
- member Podio.connection.get("/status/#{id}").body
8
- end
9
-
10
- def create(space_id, attributes)
11
- response = Podio.connection.post do |req|
12
- req.url "/status/space/#{space_id}/"
13
- req.body = attributes
14
- end
15
-
16
- response.body['status_id']
17
- end
18
- end
19
- end
@@ -1,108 +0,0 @@
1
- module Podio
2
- module Task
3
- include Podio::ResponseWrapper
4
- extend self
5
-
6
- def create(attributes)
7
- response = Podio.connection.post do |req|
8
- req.url "/task/"
9
- req.body = attributes
10
- end
11
-
12
- response.body['task_id']
13
- end
14
-
15
- def create_with_ref(ref_type, ref_id, attributes)
16
- response = Podio.connection.post do |req|
17
- req.url "/task/#{ref_type}/#{ref_id}/"
18
- req.body = attributes
19
- end
20
-
21
- response.body['task_id']
22
- end
23
-
24
- def update_description(id, description)
25
- Podio.connection.put("/task/#{id}/description", {:description => description}).status
26
- end
27
-
28
- def update_text(id, text)
29
- Podio.connection.put("/task/#{id}/text", {:text => text}).status
30
- end
31
-
32
- def update_private(id, private_flag)
33
- Podio.connection.put("/task/#{id}/private", {:private => private_flag}).status
34
- end
35
-
36
- def update_due_date(id, due_date)
37
- Podio.connection.put("/task/#{id}/due_date", {:due_date => due_date}).status
38
- end
39
-
40
- def update_assignee(id, user_id)
41
- Podio.connection.post("/task/#{id}/assign", {:responsible => user_id}).status
42
- end
43
-
44
- def update_reference(id, ref_type, ref_id)
45
- Podio.connection.put("/task/#{id}/ref", {:ref_type => ref_type, :ref_id => ref_id}).status
46
- end
47
-
48
- def update_labels(id, label_ids)
49
- Podio.connection.put("/task/#{id}/label/", label_ids).status
50
- end
51
-
52
- def delete(id)
53
- Podio.connection.delete("/task/#{id}").status
54
- end
55
-
56
- def complete(id)
57
- Podio.connection.post("/task/#{id}/complete").body
58
- end
59
-
60
- def incomplete(id)
61
- Podio.connection.post("/task/#{id}/incomplete").body
62
- end
63
-
64
- def rank(id, before_task_id, after_task_id)
65
- Podio.connection.post("/task/#{id}/rank", {:before => before_task_id, :after => after_task_id}).body
66
- end
67
-
68
- def find(id)
69
- member Podio.connection.get("/task/#{id}").body
70
- end
71
-
72
- def find_all(options={})
73
- list Podio.connection.get { |req|
74
- req.url('/task/', options)
75
- }.body
76
- end
77
- end
78
-
79
- module TaskLabel
80
- include Podio::ResponseWrapper
81
- extend self
82
-
83
- def find_all_labels
84
- list Podio.connection.get { |req|
85
- req.url("/task/label/")
86
- }.body
87
- end
88
-
89
- def create(attributes)
90
- response = Podio.connection.post do |req|
91
- req.url "/task/label/"
92
- req.body = attributes
93
- end
94
-
95
- response.body['label_id']
96
- end
97
-
98
- def delete(label_id)
99
- Podio.connection.delete("/task/label/#{label_id}").status
100
- end
101
-
102
- def update(label_id, attributes)
103
- Podio.connection.put("/task/label/#{label_id}", attributes).status
104
- end
105
-
106
- end
107
- end
108
-
@@ -1,31 +0,0 @@
1
- module Podio
2
- module User
3
- include Podio::ResponseWrapper
4
- extend self
5
-
6
- def current
7
- member Podio.connection.get("/user/").body
8
- end
9
-
10
- def create(attributes)
11
- response = Podio.connection.post do |req|
12
- req.url '/user/'
13
- req.body = attributes
14
- end
15
-
16
- response.body['user_id']
17
- end
18
-
19
- def find_all_admins_for_org(org_id)
20
- list Podio.connection.get("/org/#{org_id}/admin/").body
21
- end
22
-
23
- def get_property(name, value)
24
- Podio.connection.get("/user/property/#{name}").body['value']
25
- end
26
-
27
- def set_property(name, value)
28
- Podio.connection.put("/user/property/#{name}", {:value => value}).status
29
- end
30
- end
31
- end
@@ -1,11 +0,0 @@
1
- module Podio
2
- module UserStatus
3
- include Podio::ResponseWrapper
4
- extend self
5
-
6
- def current
7
- member Podio.connection.get("/user/status").body
8
- end
9
-
10
- end
11
- end