podio 0.8.0 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (106) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +3 -0
  3. data/Gemfile +9 -2
  4. data/README.md +1 -4
  5. data/examples/oauth_web_flow/Gemfile +4 -0
  6. data/examples/{sinatra.rb → oauth_web_flow/sinatra.rb} +7 -6
  7. data/lib/podio.rb +18 -3
  8. data/lib/podio/active_podio/base.rb +107 -62
  9. data/lib/podio/client.rb +30 -5
  10. data/lib/podio/error.rb +22 -10
  11. data/lib/podio/middleware/error_response.rb +23 -16
  12. data/lib/podio/middleware/json_response.rb +1 -1
  13. data/lib/podio/middleware/logger.rb +3 -0
  14. data/lib/podio/middleware/oauth2.rb +3 -0
  15. data/lib/podio/models/account_provider.rb +1 -0
  16. data/lib/podio/models/action.rb +19 -2
  17. data/lib/podio/models/activation_status.rb +8 -2
  18. data/lib/podio/models/app_store_category.rb +4 -1
  19. data/lib/podio/models/app_store_share.rb +29 -16
  20. data/lib/podio/models/application.rb +57 -2
  21. data/lib/podio/models/application_email.rb +5 -2
  22. data/lib/podio/models/application_field.rb +5 -2
  23. data/lib/podio/models/batch.rb +8 -0
  24. data/lib/podio/models/by_line.rb +2 -1
  25. data/lib/podio/models/calendar_event.rb +63 -3
  26. data/lib/podio/models/calendar_mute.rb +6 -1
  27. data/lib/podio/models/category.rb +1 -0
  28. data/lib/podio/models/comment.rb +29 -8
  29. data/lib/podio/models/condition.rb +8 -0
  30. data/lib/podio/models/condition_set.rb +40 -0
  31. data/lib/podio/models/contact.rb +13 -2
  32. data/lib/podio/models/contract.rb +85 -1
  33. data/lib/podio/models/contract_event.rb +17 -0
  34. data/lib/podio/models/contract_price.rb +3 -7
  35. data/lib/podio/models/contract_price_v2.rb +31 -0
  36. data/lib/podio/models/contract_user.rb +4 -0
  37. data/lib/podio/models/conversation.rb +114 -13
  38. data/lib/podio/models/conversation_event.rb +51 -0
  39. data/lib/podio/models/conversation_message.rb +2 -1
  40. data/lib/podio/models/conversation_participant.rb +3 -2
  41. data/lib/podio/models/date_election.rb +35 -0
  42. data/lib/podio/models/email_contact.rb +46 -0
  43. data/lib/podio/models/email_subscription_setting.rb +4 -23
  44. data/lib/podio/models/embed.rb +4 -4
  45. data/lib/podio/models/experiment.rb +71 -0
  46. data/lib/podio/models/external_file.rb +7 -2
  47. data/lib/podio/models/file_attachment.rb +23 -0
  48. data/lib/podio/models/form.rb +7 -0
  49. data/lib/podio/models/friend.rb +12 -0
  50. data/lib/podio/models/grant.rb +73 -0
  51. data/lib/podio/models/hook.rb +13 -6
  52. data/lib/podio/models/importer.rb +3 -0
  53. data/lib/podio/models/integration.rb +17 -6
  54. data/lib/podio/models/invoice.rb +30 -0
  55. data/lib/podio/models/item.rb +81 -14
  56. data/lib/podio/models/item_diff.rb +9 -5
  57. data/lib/podio/models/item_field.rb +11 -2
  58. data/lib/podio/models/item_revision.rb +5 -2
  59. data/lib/podio/models/linked_account.rb +1 -0
  60. data/lib/podio/models/live.rb +61 -0
  61. data/lib/podio/models/net_promoter_score.rb +28 -0
  62. data/lib/podio/models/notification.rb +9 -4
  63. data/lib/podio/models/notification_group.rb +5 -2
  64. data/lib/podio/models/o_auth.rb +4 -2
  65. data/lib/podio/models/o_auth_client.rb +1 -2
  66. data/lib/podio/models/organization.rb +22 -10
  67. data/lib/podio/models/organization_contact.rb +2 -1
  68. data/lib/podio/models/organization_member.rb +17 -3
  69. data/lib/podio/models/organization_profile.rb +8 -2
  70. data/lib/podio/models/pin.rb +27 -0
  71. data/lib/podio/models/profile.rb +19 -50
  72. data/lib/podio/models/promotion.rb +91 -0
  73. data/lib/podio/models/rating.rb +23 -5
  74. data/lib/podio/models/recurrence.rb +6 -3
  75. data/lib/podio/models/reference.rb +17 -1
  76. data/lib/podio/models/reminder.rb +8 -3
  77. data/lib/podio/models/search.rb +7 -1
  78. data/lib/podio/models/space.rb +41 -2
  79. data/lib/podio/models/space_contact.rb +1 -2
  80. data/lib/podio/models/space_invitation.rb +4 -5
  81. data/lib/podio/models/space_member.rb +37 -4
  82. data/lib/podio/models/status.rb +20 -8
  83. data/lib/podio/models/stream_activity_group.rb +40 -0
  84. data/lib/podio/models/stream_mute.rb +7 -8
  85. data/lib/podio/models/stream_object.rb +19 -11
  86. data/lib/podio/models/subscription.rb +7 -1
  87. data/lib/podio/models/tag.rb +6 -1
  88. data/lib/podio/models/tag_search.rb +2 -1
  89. data/lib/podio/models/task.rb +74 -18
  90. data/lib/podio/models/task_label.rb +10 -2
  91. data/lib/podio/models/user.rb +50 -6
  92. data/lib/podio/models/user_mail.rb +4 -0
  93. data/lib/podio/models/user_status.rb +7 -0
  94. data/lib/podio/models/view.rb +27 -7
  95. data/lib/podio/models/widget.rb +25 -3
  96. data/lib/podio/version.rb +1 -1
  97. data/podio.gemspec +13 -10
  98. data/script/config.example.rb +6 -0
  99. data/script/referenceGenerator.rb +87 -0
  100. data/test/active_podio_test.rb +44 -34
  101. data/test/client_test.rb +13 -2
  102. metadata +89 -36
  103. data/lib/podio/middleware/date_conversion.rb +0 -37
  104. data/lib/podio/models/bulletin.rb +0 -60
  105. data/lib/podio/models/connection.rb +0 -53
  106. data/lib/podio/models/news.rb +0 -85
@@ -1,12 +1,14 @@
1
+ # @see https://developers.podio.com/doc/notifications
1
2
  class Podio::Notification < ActivePodio::Base
2
3
  property :notification_id, :integer
3
- property :user, :hash
4
4
  property :type, :string
5
5
  property :viewed_on, :datetime
6
6
  property :subscription_id, :integer
7
7
  property :created_on, :datetime
8
8
  property :data, :hash
9
9
  property :starred, :boolean
10
+ property :text, :string
11
+ property :text_short, :string
10
12
 
11
13
  # Only available when getting a single notification
12
14
  property :space, :hash
@@ -18,28 +20,31 @@ class Podio::Notification < ActivePodio::Base
18
20
 
19
21
  has_one :created_by, :class => 'ByLine'
20
22
  has_one :created_via, :class => 'Via'
21
- has_one :user, :class => 'User'
22
23
 
23
24
  alias_method :id, :notification_id
24
25
  delegate_to_hash :data, :field, :value, :role, :message
25
-
26
+
26
27
  class << self
27
28
  def find(id)
28
29
  member Podio.connection.get("/notification/#{id}").body
29
30
  end
30
31
 
32
+ # @see https://developers.podio.com/doc/notifications/mark-notification-as-viewed-22436
31
33
  def mark_as_viewed(id)
32
34
  Podio.connection.post("/notification/#{id}/viewed").status
33
35
  end
34
36
 
37
+ # @see https://developers.podio.com/doc/notifications/mark-all-notifications-as-viewed-58099
35
38
  def mark_all_as_viewed
36
39
  Podio.connection.post("/notification/viewed").status
37
40
  end
38
-
41
+
42
+ # @see https://developers.podio.com/doc/notifications/star-notification-295910
39
43
  def star(id)
40
44
  Podio.connection.post("/notification/#{id}/star").status
41
45
  end
42
46
 
47
+ # @see https://developers.podio.com/doc/notifications/un-star-notification-295911
43
48
  def unstar(id)
44
49
  Podio.connection.delete("/notification/#{id}/star").status
45
50
  end
@@ -1,21 +1,24 @@
1
1
  # This class wraps the response from the Get Notifications API call
2
+ # @see https://developers.podio.com/doc/notifications
2
3
  class Podio::NotificationGroup < ActivePodio::Base
3
4
  property :context, :hash
4
5
  property :notifications, :hash
5
- delegate_to_hash :context, :ref, :data, :comment_count, :link, :space
6
+ delegate_to_hash :context, :ref, :data, :comment_count, :link, :space, :rights
6
7
 
7
8
  class << self
9
+ # @see https://developers.podio.com/doc/notifications/get-notifications-290777
8
10
  def find_all(options={})
9
11
  list Podio.connection.get { |req|
10
12
  req.url('/notification/', options)
11
13
  }.body
12
14
  end
13
15
 
16
+ # @see https://developers.podio.com/doc/notifications/get-notification-v2-2973737
14
17
  def find(id)
15
18
  member Podio.connection.get("/notification/#{id}/v2").body
16
19
  end
17
20
 
18
-
21
+ # @see https://developers.podio.com/doc/notifications/mark-notifications-as-viewed-by-ref-553653
19
22
  def mark_as_viewed_by_ref(ref_type, ref_id)
20
23
  Podio.connection.post("/notification/#{ref_type}/#{ref_id}/viewed").status
21
24
  end
@@ -1,5 +1,6 @@
1
+ # @see https://developers.podio.com/doc/oauth-authorization
1
2
  class Podio::OAuth < ActivePodio::Base
2
-
3
+
3
4
  class << self
4
5
  def authorize(attributes)
5
6
  response = Podio.connection.post do |req|
@@ -19,6 +20,7 @@ class Podio::OAuth < ActivePodio::Base
19
20
  response.body
20
21
  end
21
22
 
23
+ # @see https://developers.podio.com/doc/oauth-authorization/get-access-token-22359
22
24
  def get_access_token(attributes)
23
25
  response = Podio.connection.post do |req|
24
26
  req.url "/oauth/token"
@@ -28,5 +30,5 @@ class Podio::OAuth < ActivePodio::Base
28
30
  response.body
29
31
  end
30
32
  end
31
-
33
+
32
34
  end
@@ -1,3 +1,4 @@
1
+ # @see https://developers.podio.com/doc/oauth-authorization
1
2
  class Podio::OAuthClient < ActivePodio::Base
2
3
  include ActivePodio::Updatable
3
4
 
@@ -18,8 +19,6 @@ class Podio::OAuthClient < ActivePodio::Base
18
19
  self.class.update(self.auth_client_id, attributes)
19
20
  end
20
21
 
21
- handle_api_errors_for :create, :update # Call must be made after the methods to handle have been defined
22
-
23
22
  class << self
24
23
  def create(attributes)
25
24
  response = Podio.connection.post do |req|
@@ -1,3 +1,4 @@
1
+ # @see https://developers.podio.com/doc/organizations
1
2
  class Podio::Organization < ActivePodio::Base
2
3
  include ActivePodio::Updatable
3
4
 
@@ -25,11 +26,14 @@ class Podio::Organization < ActivePodio::Base
25
26
  property :type, :string
26
27
  property :segment, :string
27
28
  property :segment_size, :integer
29
+ property :grants_count, :integer
30
+ property :allow_add_space, :boolean
28
31
 
29
32
  has_one :created_by, :class => 'ByLine'
30
33
 
31
34
  alias_method :id, :org_id
32
35
 
36
+ # @see https://developers.podio.com/doc/organizations/add-new-organization-22385
33
37
  def create
34
38
  attributes = Organization.create(:name => name, :logo => logo, :segment_size => segment_size)
35
39
  self.org_id = attributes['org_id']
@@ -37,13 +41,13 @@ class Podio::Organization < ActivePodio::Base
37
41
  self.url_label = attributes['url_label']
38
42
  end
39
43
 
44
+ # @see https://developers.podio.com/doc/organizations/update-organization-22386
40
45
  def update
41
46
  Organization.update(id, {:name => name, :logo => logo, :url_label => url_label, :billing_interval => billing_interval, :segment_size => segment_size})
42
47
  end
43
48
 
44
- handle_api_errors_for :create, :update # Call must be made after the methods to handle have been defined
45
-
46
49
  class << self
50
+ # @see https://developers.podio.com/doc/organizations/update-organization-22386
47
51
  def update(id, attributes)
48
52
  response = Podio.connection.put do |req|
49
53
  req.url "/org/#{id}"
@@ -56,6 +60,7 @@ class Podio::Organization < ActivePodio::Base
56
60
  Podio.connection.delete("/org/#{id}").status
57
61
  end
58
62
 
63
+ # @see https://developers.podio.com/doc/organizations/add-new-organization-22385
59
64
  def create(attributes)
60
65
  response = Podio.connection.post do |req|
61
66
  req.url '/org/'
@@ -65,14 +70,20 @@ class Podio::Organization < ActivePodio::Base
65
70
  response.body
66
71
  end
67
72
 
73
+ # @see https://developers.podio.com/doc/organizations/get-organization-22383
68
74
  def find(id)
69
75
  member Podio.connection.get("/org/#{id}").body
70
76
  end
71
77
 
78
+ # @see https://developers.podio.com/doc/organizations/get-organization-by-url-22384
72
79
  def find_by_url(url)
73
80
  member Podio.connection.get("/org/url?url=#{url}").body
74
81
  end
75
82
 
83
+ def find_by_url_slug(org_slug)
84
+ member Podio.connection.get('/org/url', :org_slug => org_slug).body
85
+ end
86
+
76
87
  def validate_url_label(url_label)
77
88
  Podio.connection.post { |req|
78
89
  req.url '/org/url/validate'
@@ -80,18 +91,11 @@ class Podio::Organization < ActivePodio::Base
80
91
  }.body
81
92
  end
82
93
 
94
+ # @see https://developers.podio.com/doc/organizations/get-organizations-22344
83
95
  def find_all
84
96
  list Podio.connection.get("/org/").body
85
97
  end
86
98
 
87
- def get_statistics(id)
88
- Podio.connection.get("/org/#{id}/statistics").body
89
- end
90
-
91
- def get_member_count(id)
92
- Podio.connection.get("/org/#{id}/member/count").body
93
- end
94
-
95
99
  def get_login_report(id, options = {})
96
100
  Podio.connection.get { |req|
97
101
  req.url("/org/#{id}/report/login/", options)
@@ -114,5 +118,13 @@ class Podio::Organization < ActivePodio::Base
114
118
  list Podio.connection.get("/app_store/org/").body
115
119
  end
116
120
 
121
+ def get_statistics(id)
122
+ Podio.connection.get("/org/#{id}/statistics/v2").body
123
+ end
124
+
125
+ def find_for_user(user_id)
126
+ list Podio.connection.get("/org/user/#{user_id}/").body
127
+ end
128
+
117
129
  end
118
130
  end
@@ -1,10 +1,11 @@
1
1
  # Encapsulates a primary contact for an organization, primarily used for billing purposes
2
+ # @see https://developers.podio.com/doc/contacts
2
3
  class Podio::OrganizationContact < Podio::Profile
3
4
  include ActivePodio::Updatable
4
5
 
5
6
  property :org_id, :integer
6
7
  property :attention, :string # The name of the primary organization contact
7
-
8
+
8
9
  alias_method :id, :org_id
9
10
 
10
11
  def save
@@ -1,4 +1,5 @@
1
1
  # Encapsulates a user's indirect membership (through spaces) of an organization.
2
+ # @see https://developers.podio.com/doc/organizations
2
3
  class Podio::OrganizationMember < ActivePodio::Base
3
4
  property :profile, :hash
4
5
  property :admin, :boolean
@@ -9,9 +10,10 @@ class Podio::OrganizationMember < ActivePodio::Base
9
10
  has_one :contact, :class => 'Contact', :property => :profile
10
11
 
11
12
  delegate :user_id, :mail, :to => :user
12
- delegate :name, :avatar, :link, :title, :organization, :title_and_org, :default_title, :avatar_url, :last_seen_on, :to => :contact
13
+ delegate :name, :avatar, :link, :title, :organization, :title_and_org, :default_title, :last_seen_on, :to => :contact
13
14
 
14
15
  class << self
16
+ # @see https://developers.podio.com/doc/organizations/get-organization-members-50661
15
17
  def find_all_for_org(org_id, options = {})
16
18
  list Podio.connection.get { |req|
17
19
  req.url("/org/#{org_id}/member/", options)
@@ -25,19 +27,30 @@ class Podio::OrganizationMember < ActivePodio::Base
25
27
  }.body
26
28
  end
27
29
 
30
+ # @see https://developers.podio.com/doc/organizations/get-organization-member-50908
28
31
  def find(org_id, user_id)
29
32
  member Podio.connection.get("/org/#{org_id}/member/#{user_id}").body
30
33
  end
31
34
 
32
-
35
+ # @see https://developers.podio.com/doc/organizations/end-organization-membership-50689
33
36
  def delete(org_id, user_id)
34
37
  Podio.connection.delete("/org/#{org_id}/member/#{user_id}").status
35
38
  end
36
39
 
40
+ # @see https://developers.podio.com/doc/organizations/end-organization-membership-19410652
41
+ def leave(org_id)
42
+ Podio.connection.post("/org/#{org_id}/leave").status
43
+ end
44
+
37
45
  def delete_info(org_id, user_id)
38
- Podio.connection.get("/org/#{org_id}/member/#{user_id}/end_member_info").body
46
+ result = Podio.connection.get("/org/#{org_id}/member/#{user_id}/end_member_info").body
47
+ %w{ to_promote to_remove to_delete }.each do |type|
48
+ result[type].collect! { |member| self.klass_from_string('SpaceMember').new(member) } if result[type].present?
49
+ end
50
+ result
39
51
  end
40
52
 
53
+ # @see https://developers.podio.com/doc/organizations/add-organization-admin-50854
41
54
  def make_admin(org_id, user_id)
42
55
  response = Podio.connection.post do |req|
43
56
  req.url "/org/#{org_id}/admin/"
@@ -46,6 +59,7 @@ class Podio::OrganizationMember < ActivePodio::Base
46
59
  response.status
47
60
  end
48
61
 
62
+ # @see https://developers.podio.com/doc/organizations/remove-organization-admin-50855
49
63
  def remove_admin(org_id, user_id)
50
64
  Podio.connection.delete("/org/#{org_id}/admin/#{user_id}").status
51
65
  end
@@ -1,4 +1,5 @@
1
1
  # Encapsulates an organization profile, primarily used for in app store
2
+ # @see https://developers.podio.com/doc/organizations
2
3
  class Podio::OrganizationProfile < ActivePodio::Base
3
4
  include ActivePodio::Updatable
4
5
 
@@ -18,21 +19,23 @@ class Podio::OrganizationProfile < ActivePodio::Base
18
19
  alias_method :logo, :avatar
19
20
  alias_method :logo=, :avatar=
20
21
 
22
+ # @see https://developers.podio.com/doc/organizations/create-organization-app-store-profile-87819
21
23
  def create
22
24
  self.class.create(self.org_id, self.attributes)
23
25
  end
24
26
 
27
+ # @see https://developers.podio.com/doc/organizations/update-organization-app-store-profile-87805
25
28
  def update
26
29
  self.class.update(self.org_id, self.attributes)
27
30
  end
28
31
 
32
+ # @see https://developers.podio.com/doc/organizations/delete-organization-app-store-profile-87808
29
33
  def destroy
30
34
  self.class.delete(self.org_id)
31
35
  end
32
36
 
33
- handle_api_errors_for :create, :update # Call must be made after the methods to handle have been defined
34
-
35
37
  class << self
38
+ # @see https://developers.podio.com/doc/organizations/get-organization-app-store-profile-87799
36
39
  def find(org_id)
37
40
  member Podio.connection.get("/org/#{org_id}/appstore").body
38
41
  end
@@ -41,6 +44,7 @@ class Podio::OrganizationProfile < ActivePodio::Base
41
44
  member Podio.connection.get("/app_store/org/#{url_label}/profile").body
42
45
  end
43
46
 
47
+ # @see https://developers.podio.com/doc/organizations/create-organization-app-store-profile-87819
44
48
  def create(org_id, attributes)
45
49
  response = Podio.connection.post do |req|
46
50
  req.url "/org/#{org_id}/appstore"
@@ -50,6 +54,7 @@ class Podio::OrganizationProfile < ActivePodio::Base
50
54
  response.body
51
55
  end
52
56
 
57
+ # @see https://developers.podio.com/doc/organizations/update-organization-app-store-profile-87805
53
58
  def update(org_id, attributes)
54
59
  response = Podio.connection.put do |req|
55
60
  req.url "/org/#{org_id}/appstore"
@@ -58,6 +63,7 @@ class Podio::OrganizationProfile < ActivePodio::Base
58
63
  response.status
59
64
  end
60
65
 
66
+ # @see https://developers.podio.com/doc/organizations/delete-organization-app-store-profile-87808
61
67
  def delete(org_id)
62
68
  Podio.connection.delete("/org/#{org_id}/appstore").status
63
69
  end
@@ -0,0 +1,27 @@
1
+ class Podio::Pin < ActivePodio::Base
2
+ property :title, :string
3
+ property :type, :string
4
+ property :id, :integer
5
+ property :link, :string
6
+
7
+ alias :ref_id :id
8
+ alias :ref_type :type
9
+
10
+ class << self
11
+ def find_all(query = {})
12
+ Podio.connection.get("/pin/?#{query.to_param}").body.map(&method(:new))
13
+ end
14
+
15
+ def create(ref_type, ref_id)
16
+ new(Podio.connection.post("/pin/#{ref_type}/#{ref_id}").body)
17
+ end
18
+
19
+ def reorder(ref_type, ref_id, priority)
20
+ Podio.connection.post("/pin/#{ref_type}/#{ref_id}/reorder", priority)
21
+ end
22
+
23
+ def delete(ref_type, ref_id)
24
+ Podio.connection.delete("/pin/#{ref_type}/#{ref_id}")
25
+ end
26
+ end
27
+ end
@@ -1,4 +1,5 @@
1
1
  # Serves as the base for Contacts and Organization Contacts
2
+ # @see https://developers.podio.com/doc/contacts
2
3
  class Podio::Profile < ActivePodio::Base
3
4
  property :profile_id, :integer
4
5
  property :name, :string
@@ -44,30 +45,6 @@ class Podio::Profile < ActivePodio::Base
44
45
  }.body
45
46
  end
46
47
 
47
- def top(options={})
48
- list Podio.connection.get { |req|
49
- req.url("/contact/top/", options)
50
- }.body
51
- end
52
-
53
- def top_for_space(space_id, options={})
54
- list Podio.connection.get { |req|
55
- req.url("/contact/space/#{space_id}/top/", options)
56
- }.body
57
- end
58
-
59
- def top_for_org(org_id, options={})
60
- list Podio.connection.get { |req|
61
- req.url("/contact/org/#{org_id}/top/", options)
62
- }.body
63
- end
64
-
65
- def top_for_personal(options={})
66
- list Podio.connection.get { |req|
67
- req.url("/contact/personal/top/", options)
68
- }.body
69
- end
70
-
71
48
  def find(profile_id, options = {})
72
49
  result = Podio.connection.get do |req|
73
50
  req.url("/contact/#{profile_id}/v2", options)
@@ -80,8 +57,9 @@ class Podio::Profile < ActivePodio::Base
80
57
  end
81
58
  end
82
59
 
60
+ # @see https://developers.podio.com/doc/contacts/get-organization-contacts-22401
83
61
  def find_all_for_org(org_id, options={})
84
- options[:type] ||= 'full'
62
+ options[:view] ||= 'full'
85
63
  options[:exclude_self] = (options[:exclude_self] == false ? "0" : "1" )
86
64
 
87
65
  list Podio.connection.get { |req|
@@ -89,8 +67,9 @@ class Podio::Profile < ActivePodio::Base
89
67
  }.body
90
68
  end
91
69
 
70
+ # @see https://developers.podio.com/doc/contacts/get-space-contacts-22414
92
71
  def find_all_for_space(space_id, options={})
93
- options[:type] ||= 'full'
72
+ options[:view] ||= 'full'
94
73
  options[:exclude_self] = (options[:exclude_self] == false ? "0" : "1" )
95
74
 
96
75
  list Podio.connection.get { |req|
@@ -98,22 +77,7 @@ class Podio::Profile < ActivePodio::Base
98
77
  }.body
99
78
  end
100
79
 
101
- def find_all_for_connection(connection_id, options={})
102
- options[:type] ||= 'full'
103
-
104
- list Podio.connection.get { |req|
105
- req.url("/contact/connection/#{connection_id}", options)
106
- }.body
107
- end
108
-
109
- def find_all_for_connection_type(connection_type, options={})
110
- options[:type] ||= 'full'
111
-
112
- list Podio.connection.get { |req|
113
- req.url("/contact/connection/#{connection_type}", options)
114
- }.body
115
- end
116
-
80
+ # @see https://developers.podio.com/doc/contacts/get-linked-account-contacts-6214688
117
81
  def find_all_for_linked_account(id, options={})
118
82
  list Podio.connection.get { |req|
119
83
  req.url("/contact/linked_account/#{id}", options)
@@ -124,10 +88,17 @@ class Podio::Profile < ActivePodio::Base
124
88
  member Podio.connection.get("/org/#{org_id}/billing").body
125
89
  end
126
90
 
91
+ # @see https://developers.podio.com/doc/contacts/get-user-contact-60514
127
92
  def find_for_user(user_id)
128
93
  member Podio.connection.get("/contact/user/#{user_id}").body
129
94
  end
130
95
 
96
+ # @see https://developers.podio.com/doc/contacts/get-user-contact-60514
97
+ def find_all_for_users(user_ids)
98
+ list Podio.connection.get("/contact/user/#{user_ids}").body
99
+ end
100
+
101
+ # @see https://developers.podio.com/doc/contacts/get-vcard-213496
131
102
  def vcard(profile_id)
132
103
  Podio.connection.get("/contact/#{profile_id}/vcard").body
133
104
  end
@@ -136,28 +107,24 @@ class Podio::Profile < ActivePodio::Base
136
107
  Podio.connection.get("/contact/totals/").body
137
108
  end
138
109
 
110
+ # @see https://developers.podio.com/doc/contacts/get-space-contact-totals-67508
139
111
  def totals_by_space_v2(space_id)
140
112
  Podio.connection.get("/contact/space/#{space_id}/totals/space").body
141
113
  end
142
114
 
115
+ # @see https://developers.podio.com/doc/contacts/get-contact-totals-60467
143
116
  def totals_by_org_and_space
144
117
  Podio.connection.get("/contact/totals/v2/").body
145
118
  end
146
119
 
120
+ # @see https://developers.podio.com/doc/contacts/get-skills-1346872
147
121
  def skills(options)
148
122
  Podio.connection.get { |req|
149
123
  req.url("/contact/skill/", options)
150
124
  }.body
151
125
  end
152
126
 
153
- def totals_by_space(space_id, options = {})
154
- options[:exclude_self] = (options[:exclude_self] == false ? "0" : "1" )
155
-
156
- Podio.connection.get { |req|
157
- req.url("/contact/space/#{space_id}/totals/", options)
158
- }.body
159
- end
160
-
127
+ # @see https://developers.podio.com/doc/contacts/create-space-contact-65590
161
128
  def create_space_contact(space_id, attributes)
162
129
  response = Podio.connection.post do |req|
163
130
  req.url "/contact/space/#{space_id}/"
@@ -167,10 +134,12 @@ class Podio::Profile < ActivePodio::Base
167
134
  response.body
168
135
  end
169
136
 
137
+ # @see https://developers.podio.com/doc/contacts/delete-contact-s-60560
170
138
  def delete_contact(profile_id)
171
139
  Podio.connection.delete("/contact/#{profile_id}").body
172
140
  end
173
141
 
142
+ # @see https://developers.podio.com/doc/contacts/update-contact-60556
174
143
  def update_contact(profile_id, attributes)
175
144
  response = Podio.connection.put do |req|
176
145
  req.url "/contact/#{profile_id}"