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
@@ -0,0 +1,122 @@
1
+ class Podio::Item < ActivePodio::Base
2
+
3
+ # Included Get Item basic
4
+ property :item_id, :integer
5
+ property :app, :hash
6
+ property :external_id, :string
7
+ property :title, :string
8
+ property :fields, :array
9
+ property :rights, :array
10
+
11
+ has_one :initial_revision, :class => 'ItemRevision'
12
+ has_one :current_revision, :class => 'ItemRevision'
13
+
14
+ # Also included in the full Get item
15
+ property :ratings, :hash
16
+ property :conversations, :array
17
+ property :tasks, :array
18
+ property :references, :array
19
+ property :tags, :array
20
+ property :subscribed, :boolean
21
+ property :user_ratings, :hash
22
+
23
+ has_many :revisions, :class => 'ItemRevision'
24
+ has_many :files, :class => 'FileAttachment'
25
+ has_many :comments, :class => 'Comment'
26
+ has_many :shares, :class => 'AppStoreShare'
27
+
28
+ # For inserting/updating
29
+ property :file_ids, :array
30
+
31
+ alias_method :id, :item_id
32
+ delegate_to_hash :app, :app_id, :app_name, :item_name
33
+
34
+ def destroy
35
+ Item.delete(self.id)
36
+ end
37
+
38
+ class << self
39
+ def find(id)
40
+ member Podio.connection.get("/item/#{id}").body
41
+ end
42
+
43
+ def find_basic(id)
44
+ member Podio.connection.get("/item/#{id}/basic").body
45
+ end
46
+
47
+ def find_all_by_external_id(app_id, external_id)
48
+ collection Podio.connection.get("/item/app/#{app_id}/v2/?external_id=#{external_id}").body
49
+ end
50
+
51
+ def find_all(app_id, options={})
52
+ collection Podio.connection.get { |req|
53
+ req.url("/item/app/#{app_id}/", options)
54
+ }.body
55
+ end
56
+
57
+ def find_next(current_item_id, time = nil)
58
+ find_next_or_previous(:next, current_item_id, time)
59
+ end
60
+
61
+ def find_previous(current_item_id, time = nil)
62
+ find_next_or_previous(:previous, current_item_id, time)
63
+ end
64
+
65
+ def find_field_top(field_id, options={:limit => 8})
66
+ list Podio.connection.get { |req|
67
+ req.url("/item/field/#{field_id}/top/", options)
68
+ }.body
69
+ end
70
+
71
+ def search_field(field_id, options={})
72
+ list Podio.connection.get { |req|
73
+ req.url("/item/field/#{field_id}/find", options)
74
+ }.body
75
+ end
76
+
77
+ # Deprecated. Use method in ItemRevision instead.
78
+ # def revisions(item_id)
79
+ # collection Podio.connection.get("/item/#{item_id}/revision/").body
80
+ # end
81
+
82
+ # Deprecated. Use method in ItemDiff instead.
83
+ # def revision_difference(item_id, revision_from_id, revision_to_id)
84
+ # list Podio.connection.get{ |req|
85
+ # req.url("/item/#{item_id}/revision/#{revision_from_id}/#{revision_to_id}")
86
+ # }.body
87
+ # end
88
+
89
+ def create(app_id, attributes)
90
+ response = Podio.connection.post do |req|
91
+ req.url "/item/app/#{app_id}/"
92
+ req.body = attributes
93
+ end
94
+
95
+ response.body['item_id']
96
+ end
97
+
98
+ def update(id, attributes)
99
+ response = Podio.connection.put do |req|
100
+ req.url "/item/#{id}"
101
+ req.body = attributes
102
+ end
103
+ response.status
104
+ end
105
+
106
+ def delete(id)
107
+ Podio.connection.delete("/item/#{id}").body
108
+ end
109
+
110
+ protected
111
+
112
+ def time_options(time)
113
+ time.present? ? { 'time' => (time.is_a?(String) ? time : time.to_s(:db)) } : {}
114
+ end
115
+
116
+ def find_next_or_previous(operation, current_item_id, time)
117
+ member Podio.connection.get { |req|
118
+ req.url("/item/#{current_item_id}/#{operation}", time_options(time))
119
+ }.body
120
+ end
121
+ end
122
+ end
@@ -0,0 +1,16 @@
1
+ class Podio::ItemDiff < ActivePodio::Base
2
+ property :field_id, :integer
3
+ property :type, :string
4
+ property :external_id, :integer
5
+ property :label, :string
6
+ property :from, :array
7
+ property :to, :array
8
+
9
+ alias_method :id, :field_id
10
+
11
+ class << self
12
+ def find_by_item_and_revisions(item_id, revision_from_id, revision_to_id)
13
+ list Podio.connection.get("/item/#{item_id}/revision/#{revision_from_id}/#{revision_to_id}").body
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,19 @@
1
+ class Podio::ItemField < ActivePodio::Base
2
+ property :field_id, :integer
3
+ property :type, :string
4
+ property :external_id, :integer
5
+ property :label, :string
6
+ property :values, :array
7
+
8
+ alias_method :id, :field_id
9
+
10
+ class << self
11
+ def update(item_id, field_id, values)
12
+ response = Podio.connection.put do |req|
13
+ req.url "/item/#{item_id}/value/#{field_id}"
14
+ req.body = values
15
+ end
16
+ response.status
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,18 @@
1
+ class Podio::ItemRevision < ActivePodio::Base
2
+ property :revision, :integer
3
+ property :app_revision, :integer
4
+ property :created_on, :datetime
5
+
6
+ has_one :created_by, :class => 'ByLine'
7
+ has_one :created_via, :class => 'Via'
8
+
9
+ class << self
10
+ def find(item_id, revision_id)
11
+ member Podio.connection.get("/item/#{item_id}/revision/#{revision_id}").body
12
+ end
13
+
14
+ def find_all_by_item_id(item_id)
15
+ list Podio.connection.get("/item/#{item_id}/revision/").body
16
+ end
17
+ end
18
+ end
@@ -0,0 +1,83 @@
1
+ class Podio::News < ActivePodio::Base
2
+ property :news_id, :integer
3
+ property :title, :string
4
+ property :content, :string
5
+ property :link, :string
6
+ property :priority, :integer
7
+ property :target_group, :string
8
+ property :locale, :string
9
+ property :run_from, :datetime
10
+ property :run_to, :datetime
11
+ property :stream_display, :boolean
12
+ property :email_display, :boolean
13
+ property :email_views, :integer
14
+ property :stream_views, :integer
15
+ property :email_clicks, :integer
16
+ property :stream_clicks, :integer
17
+
18
+ alias_method :id, :news_id
19
+
20
+ class << self
21
+ def find_stream()
22
+ Podio.connection.get("/news/stream").body
23
+ end
24
+
25
+ def get_news_redirect(news_id, type=nil)
26
+ type = type.presence || 'stream'
27
+ response = Podio.connection.get("/news/#{news_id}/redirect?type=#{type}")
28
+ response.body['link']
29
+ end
30
+
31
+ def delete(news_id)
32
+ Podio.connection.delete("/news/#{news_id}")
33
+ end
34
+
35
+ def unsubscribe_entry(news_id)
36
+ Podio.connection.post do |req|
37
+ req.url "/news/#{news_id}/unsubscribe"
38
+ end
39
+ end
40
+
41
+ def create(attributes)
42
+ response = Podio.connection.post do |req|
43
+ req.url '/news/'
44
+ req.body = attributes
45
+ end
46
+ response.body['news_id']
47
+ end
48
+
49
+ def update(id, attributes)
50
+ response = Podio.connection.put do |req|
51
+ req.url "/news/#{id}"
52
+ req.body = attributes
53
+ end
54
+
55
+ response.status
56
+ end
57
+
58
+ def find(id, options={})
59
+ member Podio.connection.get("/news/#{id}").body
60
+ end
61
+
62
+ def find_visible
63
+ list Podio.connection.get("/news/").body
64
+ end
65
+
66
+ def find_all
67
+ list Podio.connection.get("/news/").body
68
+ end
69
+
70
+ def find_all_by_locale(locale)
71
+ list Podio.connection.get('/news/?locale=#{locale}').body
72
+ end
73
+
74
+ def find_all_by_target_group(target_group)
75
+ list Podio.connection.get('/news/?target_group=#{target_group}').body
76
+ end
77
+
78
+ def find_all_by_locale_and_group(locale, group)
79
+ list Podio.connection.get('/news/?locale=#{locale}?target_group=#{group}').body
80
+ end
81
+
82
+ end
83
+ end
@@ -0,0 +1,47 @@
1
+ class Podio::Notification < ActivePodio::Base
2
+ property :notification_id, :integer
3
+ property :user, :hash
4
+ property :type, :string
5
+ property :viewed_on, :datetime
6
+ property :subscription_id, :integer
7
+ property :created_on, :datetime
8
+ property :data, :hash
9
+ property :starred, :boolean
10
+
11
+ # Only available when getting a single notification
12
+ property :space, :hash
13
+ property :org, :hash
14
+ property :data_link, :string
15
+ property :context_type, :string
16
+ property :context_link, :string
17
+ property :context, :hash
18
+
19
+ has_one :created_by, :class => 'ByLine'
20
+ has_one :created_via, :class => 'Via'
21
+ has_one :user, :class => 'User'
22
+
23
+ alias_method :id, :notification_id
24
+ delegate_to_hash :data, :field, :value, :role, :message
25
+
26
+ class << self
27
+ def find(id)
28
+ member Podio.connection.get("/notification/#{id}").body
29
+ end
30
+
31
+ def mark_as_viewed(id)
32
+ Podio.connection.post("/notification/#{id}/viewed").status
33
+ end
34
+
35
+ def mark_all_as_viewed
36
+ Podio.connection.post("/notification/viewed").status
37
+ end
38
+
39
+ def star(id)
40
+ Podio.connection.post("/notification/#{id}/star").status
41
+ end
42
+
43
+ def unstar(id)
44
+ Podio.connection.delete("/notification/#{id}/star").status
45
+ end
46
+ end
47
+ end
@@ -0,0 +1,19 @@
1
+ # This class wraps the response from the Get Notifications API call
2
+ class Podio::NotificationGroup < ActivePodio::Base
3
+ property :context, :hash
4
+ property :notifications, :hash
5
+ delegate_to_hash :context, :ref, :data
6
+ delegate_to_hash :data, :link
7
+
8
+ class << self
9
+ def find_all(options={})
10
+ list Podio.connection.get { |req|
11
+ req.url('/notification/', options)
12
+ }.body
13
+ end
14
+
15
+ def mark_as_viewed_by_ref(ref_type, ref_id)
16
+ Podio.connection.post("/notification/#{ref_type}/#{ref_id}/viewed").status
17
+ end
18
+ end
19
+ end
@@ -0,0 +1,32 @@
1
+ class Podio::OAuth < ActivePodio::Base
2
+
3
+ class << self
4
+ def authorize(attributes)
5
+ response = Podio.connection.post do |req|
6
+ req.url "/oauth/authorize"
7
+ req.body = attributes
8
+ end
9
+
10
+ response.body
11
+ end
12
+
13
+ def get_info(attributes)
14
+ response = Podio.connection.post do |req|
15
+ req.url "/oauth/info"
16
+ req.body = attributes
17
+ end
18
+
19
+ response.body
20
+ end
21
+
22
+ def get_access_token(attributes)
23
+ response = Podio.connection.post do |req|
24
+ req.url "/oauth/token"
25
+ req.body = attributes
26
+ end
27
+
28
+ response.body
29
+ end
30
+ end
31
+
32
+ end
@@ -0,0 +1,93 @@
1
+ class Podio::OAuthClient < ActivePodio::Base
2
+ include ActivePodio::Updatable
3
+
4
+ property :auth_client_id, :integer
5
+ property :name, :string
6
+ property :key, :string
7
+ property :secret, :string
8
+ property :url, :string
9
+ property :domain, :string
10
+
11
+ alias_method :id, :auth_client_id
12
+
13
+ def create
14
+ self.auth_client_id = self.class.create(attributes)
15
+ end
16
+
17
+ def update
18
+ self.class.update(self.auth_client_id, attributes)
19
+ end
20
+
21
+ handle_api_errors_for :create, :update # Call must be made after the methods to handle have been defined
22
+
23
+ class << self
24
+ def create(attributes)
25
+ response = Podio.connection.post do |req|
26
+ req.url "/oauth/client/"
27
+ req.body = attributes
28
+ end
29
+
30
+ response.body['auth_client_id']
31
+ end
32
+
33
+ def create_admin(user_id, attributes)
34
+ response = Podio.connection.post do |req|
35
+ req.url "/oauth/client/user/#{user_id}/"
36
+ req.body = attributes
37
+ end
38
+
39
+ response.status
40
+ end
41
+
42
+ def update(id, attributes)
43
+ response = Podio.connection.put do |req|
44
+ req.url "/oauth/client/#{id}"
45
+ req.body = attributes
46
+ end
47
+
48
+ response.status
49
+ end
50
+
51
+ def update_admin(id, attributes)
52
+ response = Podio.connection.put do |req|
53
+ req.url "/oauth/client/#{id}/admin"
54
+ req.body = attributes
55
+ end
56
+
57
+ response.status
58
+ end
59
+
60
+ def delete(id)``
61
+ response = Podio.connection.delete("/oauth/client/#{id}")
62
+
63
+ response.status
64
+ end
65
+
66
+ def delete_grant(id)
67
+ response = Podio.connection.delete("/oauth/grant/client/#{id}")
68
+
69
+ response.status
70
+ end
71
+
72
+ def reset(id)
73
+ response = Podio.connection.post("/oauth/client/#{id}/reset")
74
+ response.status
75
+ end
76
+
77
+ def find_granted_clients()
78
+ list Podio.connection.get("oauth/grant/client/").body
79
+ end
80
+
81
+ def find_all_for_current_user()
82
+ list Podio.connection.get("oauth/client/").body
83
+ end
84
+
85
+ def find_all_for_user(user_id)
86
+ list Podio.connection.get("oauth/client/user/#{user_id}/").body
87
+ end
88
+
89
+ def find(client_id)
90
+ member Podio.connection.get("oauth/client/#{client_id}").body
91
+ end
92
+ end
93
+ end
@@ -1,8 +1,41 @@
1
- module Podio
2
- module Organization
3
- include Podio::ResponseWrapper
4
- extend self
5
-
1
+ class Podio::Organization < ActivePodio::Base
2
+ include ActivePodio::Updatable
3
+
4
+ property :org_id, :integer
5
+ property :name, :string
6
+ property :logo, :integer
7
+ property :image, :hash
8
+ property :spaces, :hash
9
+ property :url, :string
10
+ property :url_label, :string
11
+ property :premium, :boolean
12
+ property :role, :string
13
+ property :status, :string
14
+ property :sales_agent_id, :integer
15
+ property :created_on, :datetime
16
+ property :user_limit, :integer
17
+ property :member_count, :integer
18
+ property :contact_count, :integer
19
+ property :billing_interval, :integer
20
+
21
+ has_one :created_by, :class => 'ByLine'
22
+
23
+ alias_method :id, :org_id
24
+
25
+ def create
26
+ attributes = Organization.create(:name => name)
27
+ self.org_id = attributes['org_id']
28
+ self.url = attributes['url']
29
+ self.url_label = attributes['url_label']
30
+ end
31
+
32
+ def update
33
+ Organization.update(id, {:name => name, :logo => logo, :url_label => url_label, :billing_interval => billing_interval})
34
+ end
35
+
36
+ handle_api_errors_for :create, :update # Call must be made after the methods to handle have been defined
37
+
38
+ class << self
6
39
  def update(id, attributes)
7
40
  response = Podio.connection.put do |req|
8
41
  req.url "/org/#{id}"
@@ -64,6 +97,6 @@ module Podio
64
97
  def upgrade(id)
65
98
  Podio.connection.post("/org/#{id}/upgrade").body
66
99
  end
67
-
100
+
68
101
  end
69
102
  end
@@ -0,0 +1,14 @@
1
+ # Encapsulates a primary contact for an organization, primarily used for billing purposes
2
+ class Podio::OrganizationContact < Podio::Profile
3
+ include ActivePodio::Updatable
4
+
5
+ property :org_id, :integer
6
+ property :attention, :string # The name of the primary organization contact
7
+
8
+ alias_method :id, :org_id
9
+
10
+ def save
11
+ Organization.update_billing_profile(id, self.attributes)
12
+ end
13
+
14
+ end
@@ -1,8 +1,16 @@
1
- module Podio
2
- module OrganizationMember
3
- include Podio::ResponseWrapper
4
- extend self
1
+ # Encapsulates a user's indirect membership (through spaces) of an organization.
2
+ class Podio::OrganizationMember < ActivePodio::Base
3
+ property :spaces, :hash
4
+ property :profile, :hash
5
+ property :admin, :boolean
5
6
 
7
+ has_one :user, :class => 'User'
8
+ has_one :contact, :class => 'Contact', :property => :profile
9
+
10
+ delegate :user_id, :mail, :last_active_on, :to => :user
11
+ delegate :name, :avatar, :title, :organization, :title_and_org, :avatar_url, :to => :contact
12
+
13
+ class << self
6
14
  def find_all_for_org(org_id, options = {})
7
15
  list Podio.connection.get { |req|
8
16
  req.url("/org/#{org_id}/member/", options)
@@ -30,4 +38,4 @@ module Podio
30
38
  end
31
39
 
32
40
  end
33
- end
41
+ end
@@ -0,0 +1,61 @@
1
+ # Encapsulates an organization profile, primarily used for in app store
2
+ class Podio::OrganizationProfile < ActivePodio::Base
3
+ include ActivePodio::Updatable
4
+
5
+ property :org_id, :integer
6
+ property :avatar, :integer
7
+ property :name, :string
8
+ property :mail, :array
9
+ property :phone, :array
10
+ property :url, :array
11
+ property :address, :array
12
+ property :city, :string
13
+ property :country, :string
14
+ property :about, :string
15
+
16
+ alias_method :id, :org_id
17
+ alias_method :logo, :avatar
18
+ alias_method :logo=, :avatar=
19
+
20
+ def create
21
+ self.class.create(self.org_id, self.attributes)
22
+ end
23
+
24
+ def update
25
+ self.class.update(self.org_id, self.attributes)
26
+ end
27
+
28
+ def destroy
29
+ self.class.delete(self.org_id)
30
+ end
31
+
32
+ handle_api_errors_for :create, :update # Call must be made after the methods to handle have been defined
33
+
34
+ class << self
35
+ def find(org_id)
36
+ member Podio.connection.get("/org/#{org_id}/appstore").body
37
+ end
38
+
39
+ def create(org_id, attributes)
40
+ response = Podio.connection.post do |req|
41
+ req.url "/org/#{org_id}/appstore"
42
+ req.body = attributes
43
+ end
44
+
45
+ response.body
46
+ end
47
+
48
+ def update(org_id, attributes)
49
+ response = Podio.connection.put do |req|
50
+ req.url "/org/#{org_id}/appstore"
51
+ req.body = attributes
52
+ end
53
+ response.status
54
+ end
55
+
56
+ def delete(org_id)
57
+ Podio.connection.delete("/org/#{org_id}/appstore").status
58
+ end
59
+ end
60
+
61
+ end
@@ -1,8 +1,26 @@
1
- module Podio
2
- module Contact
3
- include Podio::ResponseWrapper
4
- extend self
5
-
1
+ # Serves as the base for Contacts and Organization Contacts
2
+ class Podio::Profile < ActivePodio::Base
3
+ property :profile_id, :integer
4
+ property :name, :string
5
+ property :avatar, :integer
6
+ property :image, :hash
7
+ property :birthdate, :date
8
+ property :department, :string
9
+ property :vatin, :string
10
+ property :skype, :string
11
+ property :about, :string
12
+ property :address, :array
13
+ property :zip, :string
14
+ property :city, :string
15
+ property :country, :string
16
+ property :im, :array
17
+ property :location, :array
18
+ property :mail, :array
19
+ property :phone, :array
20
+ property :title, :array
21
+ property :url, :array
22
+
23
+ class << self
6
24
  def all(options={})
7
25
  options[:exclude_self] = (options[:exclude_self] == false ? "0" : "1" )
8
26
 
@@ -106,5 +124,4 @@ module Podio
106
124
  end
107
125
 
108
126
  end
109
-
110
127
  end
@@ -1,8 +1,6 @@
1
- module Podio
2
- module Rating
3
- include Podio::ResponseWrapper
4
- extend self
5
-
1
+ class Podio::Rating < ActivePodio::Base
2
+
3
+ class << self
6
4
  def create(ref_type, ref_id, rating_type, value)
7
5
  response = Podio.connection.post do |req|
8
6
  req.url "/rating/#{ref_type}/#{ref_id}/#{rating_type}"
@@ -31,6 +29,6 @@ module Podio
31
29
  def delete(ref_type, ref_id, rating_type)
32
30
  Podio.connection.delete("/rating/#{ref_type}/#{ref_id}/#{rating_type}").body
33
31
  end
34
-
35
32
  end
36
- end
33
+
34
+ end
@@ -1,8 +1,6 @@
1
- module Podio
2
- module Search
3
- include Podio::ResponseWrapper
4
- extend self
5
-
1
+ class Podio::Search < ActivePodio::Base
2
+
3
+ class << self
6
4
  def in_org(org_id, words)
7
5
  response = Podio.connection.post do |req|
8
6
  req.url "/search/org/#{org_id}/"
@@ -10,6 +8,7 @@ module Podio
10
8
  end
11
9
 
12
10
  list response.body
13
- end
11
+ end
14
12
  end
15
- end
13
+
14
+ end