podio 0.6.0 → 0.7.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.travis.yml +4 -0
- data/LICENSE +1 -1
- data/lib/podio.rb +7 -3
- data/lib/podio/active_podio/base.rb +121 -54
- data/lib/podio/client.rb +15 -2
- data/lib/podio/error.rb +1 -0
- data/lib/podio/middleware/error_response.rb +2 -0
- data/lib/podio/models/app_store_share.rb +8 -4
- data/lib/podio/models/application.rb +4 -0
- data/lib/podio/models/{calendar.rb → calendar_event.rb} +13 -1
- data/lib/podio/models/contact.rb +1 -0
- data/lib/podio/models/contract.rb +17 -1
- data/lib/podio/models/email_subscription_setting.rb +1 -0
- data/lib/podio/models/external_file.rb +30 -0
- data/lib/podio/models/file_attachment.rb +30 -12
- data/lib/podio/models/filter.rb +33 -2
- data/lib/podio/models/item.rb +23 -0
- data/lib/podio/models/item_field.rb +1 -1
- data/lib/podio/models/linked_account.rb +32 -0
- data/lib/podio/models/meeting.rb +55 -30
- data/lib/podio/models/meeting_participiant.rb +10 -4
- data/lib/podio/models/notification_group.rb +3 -4
- data/lib/podio/models/organization.rb +11 -9
- data/lib/podio/models/organization_member.rb +2 -1
- data/lib/podio/models/organization_profile.rb +1 -0
- data/lib/podio/models/question_answer.rb +3 -2
- data/lib/podio/models/referral.rb +25 -0
- data/lib/podio/models/reminder.rb +2 -2
- data/lib/podio/models/search.rb +34 -5
- data/lib/podio/models/space_invitation.rb +9 -4
- data/lib/podio/models/space_member.rb +8 -0
- data/lib/podio/models/subscription.rb +7 -3
- data/lib/podio/models/user_status.rb +2 -1
- data/lib/podio/models/widget.rb +2 -0
- data/lib/podio/version.rb +1 -1
- data/test/active_podio_test.rb +2 -2
- metadata +14 -11
@@ -1,5 +1,11 @@
|
|
1
|
-
class Podio::MeetingParticipant <
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
class Podio::MeetingParticipant < ActivePodio::Base
|
2
|
+
property :status, :string
|
3
|
+
|
4
|
+
has_one :profile, :class => 'Contact'
|
5
|
+
|
6
|
+
delegate :name, :to => :profile
|
7
|
+
|
8
|
+
def id
|
9
|
+
self.profile.try(:profile_id)
|
10
|
+
end
|
5
11
|
end
|
@@ -2,9 +2,8 @@
|
|
2
2
|
class Podio::NotificationGroup < ActivePodio::Base
|
3
3
|
property :context, :hash
|
4
4
|
property :notifications, :hash
|
5
|
-
delegate_to_hash :context, :ref, :data, :comment_count
|
6
|
-
|
7
|
-
|
5
|
+
delegate_to_hash :context, :ref, :data, :comment_count, :link, :space
|
6
|
+
|
8
7
|
class << self
|
9
8
|
def find_all(options={})
|
10
9
|
list Podio.connection.get { |req|
|
@@ -16,7 +15,7 @@ class Podio::NotificationGroup < ActivePodio::Base
|
|
16
15
|
member Podio.connection.get("/notification/#{id}/v2").body
|
17
16
|
end
|
18
17
|
|
19
|
-
|
18
|
+
|
20
19
|
def mark_as_viewed_by_ref(ref_type, ref_id)
|
21
20
|
Podio.connection.post("/notification/#{ref_type}/#{ref_id}/viewed").status
|
22
21
|
end
|
@@ -18,29 +18,31 @@ class Podio::Organization < ActivePodio::Base
|
|
18
18
|
property :contact_count, :integer
|
19
19
|
property :billing_interval, :integer
|
20
20
|
property :rights, :array
|
21
|
-
property :verified_domain, :string
|
21
|
+
property :verified_domain, :string # TODO: Remove this, it's deprecated
|
22
|
+
property :domains, :array
|
22
23
|
property :rank, :integer
|
23
24
|
property :contract_status, :string
|
24
25
|
property :type, :string
|
25
26
|
property :segment, :string
|
27
|
+
property :segment_size, :integer
|
26
28
|
|
27
29
|
has_one :created_by, :class => 'ByLine'
|
28
30
|
|
29
31
|
alias_method :id, :org_id
|
30
32
|
|
31
33
|
def create
|
32
|
-
attributes = Organization.create(:name => name, :logo => logo)
|
34
|
+
attributes = Organization.create(:name => name, :logo => logo, :segment_size => segment_size)
|
33
35
|
self.org_id = attributes['org_id']
|
34
36
|
self.url = attributes['url']
|
35
37
|
self.url_label = attributes['url_label']
|
36
38
|
end
|
37
39
|
|
38
40
|
def update
|
39
|
-
Organization.update(id, {:name => name, :logo => logo, :url_label => url_label, :billing_interval => billing_interval})
|
41
|
+
Organization.update(id, {:name => name, :logo => logo, :url_label => url_label, :billing_interval => billing_interval, :segment_size => segment_size})
|
40
42
|
end
|
41
|
-
|
42
|
-
handle_api_errors_for :create, :update # Call must be made after the methods to handle have been defined
|
43
|
-
|
43
|
+
|
44
|
+
handle_api_errors_for :create, :update # Call must be made after the methods to handle have been defined
|
45
|
+
|
44
46
|
class << self
|
45
47
|
def update(id, attributes)
|
46
48
|
response = Podio.connection.put do |req|
|
@@ -89,13 +91,13 @@ class Podio::Organization < ActivePodio::Base
|
|
89
91
|
def get_member_count(id)
|
90
92
|
Podio.connection.get("/org/#{id}/member/count").body
|
91
93
|
end
|
92
|
-
|
94
|
+
|
93
95
|
def get_login_report(id, options = {})
|
94
96
|
Podio.connection.get { |req|
|
95
97
|
req.url("/org/#{id}/report/login/", options)
|
96
98
|
}.body
|
97
99
|
end
|
98
|
-
|
100
|
+
|
99
101
|
def update_billing_profile(id, attributes)
|
100
102
|
response = Podio.connection.put do |req|
|
101
103
|
req.url "/org/#{id}/billing"
|
@@ -107,6 +109,6 @@ class Podio::Organization < ActivePodio::Base
|
|
107
109
|
def upgrade(id)
|
108
110
|
Podio.connection.post("/org/#{id}/upgrade").body
|
109
111
|
end
|
110
|
-
|
112
|
+
|
111
113
|
end
|
112
114
|
end
|
@@ -2,12 +2,13 @@
|
|
2
2
|
class Podio::OrganizationMember < ActivePodio::Base
|
3
3
|
property :profile, :hash
|
4
4
|
property :admin, :boolean
|
5
|
+
property :employee, :boolean
|
5
6
|
|
6
7
|
has_one :user, :class => 'User'
|
7
8
|
has_one :contact, :class => 'Contact', :property => :profile
|
8
9
|
|
9
10
|
delegate :user_id, :mail, :to => :user
|
10
|
-
delegate :name, :avatar, :title, :organization, :title_and_org, :default_title, :avatar_url, :last_seen_on, :to => :contact
|
11
|
+
delegate :name, :avatar, :link, :title, :organization, :title_and_org, :default_title, :avatar_url, :last_seen_on, :to => :contact
|
11
12
|
|
12
13
|
class << self
|
13
14
|
def find_all_for_org(org_id, options = {})
|
@@ -0,0 +1,25 @@
|
|
1
|
+
class Podio::Referral < ActivePodio::Base
|
2
|
+
property :code, :string
|
3
|
+
property :status, :string
|
4
|
+
|
5
|
+
alias_method :id, :code
|
6
|
+
|
7
|
+
class << self
|
8
|
+
def find_referral_contact(code)
|
9
|
+
Contact.member Podio.connection.get("/referral/info/#{code}").body
|
10
|
+
end
|
11
|
+
|
12
|
+
def find_referred_users
|
13
|
+
Contact.list Podio.connection.get("/referral/user/").body
|
14
|
+
end
|
15
|
+
|
16
|
+
def update_teaser_status(status)
|
17
|
+
response = Podio.connection.put do |req|
|
18
|
+
req.url "/referral/status"
|
19
|
+
req.body = { :status => status }
|
20
|
+
end
|
21
|
+
response.status
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
end
|
@@ -9,8 +9,8 @@ class Podio::Reminder < ActivePodio::Base
|
|
9
9
|
Podio.connection.delete("/reminder/#{ref_type}/#{ref_id}").body
|
10
10
|
end
|
11
11
|
|
12
|
-
def snooze(
|
13
|
-
Podio.connection.post("/reminder/#{
|
12
|
+
def snooze(ref_type, ref_id)
|
13
|
+
Podio.connection.post("/reminder/#{ref_type}/#{ref_id}/snooze").body
|
14
14
|
end
|
15
15
|
|
16
16
|
def create(ref_type, ref_id, attributes)
|
data/lib/podio/models/search.rb
CHANGED
@@ -7,9 +7,13 @@ class Podio::Search < ActivePodio::Base
|
|
7
7
|
property :space, :hash
|
8
8
|
property :org, :hash
|
9
9
|
property :app, :hash
|
10
|
+
property :search_id, :integer
|
11
|
+
property :rank, :integer
|
10
12
|
|
11
13
|
has_one :created_by, :class => 'ByLine'
|
12
|
-
|
14
|
+
has_one :app, :class => 'Application'
|
15
|
+
has_one :org, :class => 'Organization'
|
16
|
+
has_one :space, :class => 'Space'
|
13
17
|
|
14
18
|
class << self
|
15
19
|
def in_org(org_id, words)
|
@@ -19,16 +23,41 @@ class Podio::Search < ActivePodio::Base
|
|
19
23
|
end
|
20
24
|
|
21
25
|
list response.body
|
22
|
-
end
|
26
|
+
end
|
23
27
|
|
24
|
-
def
|
28
|
+
def globally(words, attributes={})
|
29
|
+
attributes[:query] = words
|
30
|
+
response = Podio.connection.post do |req|
|
31
|
+
req.url "/search/"
|
32
|
+
req.body = attributes
|
33
|
+
end
|
34
|
+
|
35
|
+
list response.body
|
36
|
+
end
|
37
|
+
|
38
|
+
def in_space(space_id, words, attributes={})
|
39
|
+
attributes[:query] = words
|
25
40
|
response = Podio.connection.post do |req|
|
26
41
|
req.url "/search/space/#{space_id}/"
|
27
|
-
req.body =
|
42
|
+
req.body = attributes
|
28
43
|
end
|
29
44
|
|
30
45
|
list response.body
|
31
|
-
end
|
46
|
+
end
|
47
|
+
|
48
|
+
def in_app(app_id, words, attributes={})
|
49
|
+
attributes[:query] = words
|
50
|
+
response = Podio.connection.post do |req|
|
51
|
+
req.url "/search/app/#{app_id}/"
|
52
|
+
req.body = attributes
|
53
|
+
end
|
54
|
+
|
55
|
+
list response.body
|
56
|
+
end
|
57
|
+
|
58
|
+
def rank(search_id, rank)
|
59
|
+
Podio.connection.post("/search/#{search_id}/#{rank}/clicked").status
|
60
|
+
end
|
32
61
|
end
|
33
62
|
|
34
63
|
end
|
@@ -1,6 +1,6 @@
|
|
1
1
|
class Podio::SpaceInvitation < ActivePodio::Base
|
2
2
|
include ActivePodio::Updatable
|
3
|
-
|
3
|
+
|
4
4
|
property :space_id, :integer
|
5
5
|
property :role, :string
|
6
6
|
property :subject, :string
|
@@ -10,6 +10,11 @@ class Podio::SpaceInvitation < ActivePodio::Base
|
|
10
10
|
property :mails, :array
|
11
11
|
property :profiles, :array
|
12
12
|
property :activation_code, :integer
|
13
|
+
property :context_ref_type, :string # Write
|
14
|
+
property :context_ref_id, :integer # Write
|
15
|
+
property :context, :hash # Read
|
16
|
+
|
17
|
+
has_one :user, :class => 'User'
|
13
18
|
|
14
19
|
def save
|
15
20
|
self.class.create(self.space_id, self.role, self.attributes.except(:contacts))
|
@@ -22,9 +27,9 @@ class Podio::SpaceInvitation < ActivePodio::Base
|
|
22
27
|
def accept(invite_code)
|
23
28
|
self.class.accept(invite_code)
|
24
29
|
end
|
25
|
-
|
30
|
+
|
26
31
|
handle_api_errors_for :save, :save_member, :accept # Call must be made after the methods to handle have been defined
|
27
|
-
|
32
|
+
|
28
33
|
class << self
|
29
34
|
def create(space_id, role, attributes={})
|
30
35
|
response = Podio.connection.post do |req|
|
@@ -73,6 +78,6 @@ class Podio::SpaceInvitation < ActivePodio::Base
|
|
73
78
|
def find_member(invite_code)
|
74
79
|
member Podio.connection.get("/space/membership?invite_code=#{ERB::Util.url_encode(invite_code)}").body
|
75
80
|
end
|
76
|
-
|
81
|
+
|
77
82
|
end
|
78
83
|
end
|
@@ -35,5 +35,13 @@ class Podio::SpaceMember < ActivePodio::Base
|
|
35
35
|
def end_membership(space_id, user_id)
|
36
36
|
Podio.connection.delete("/space/#{space_id}/member/#{user_id}").status
|
37
37
|
end
|
38
|
+
|
39
|
+
def find_top_contacts(space_id)
|
40
|
+
result = Podio.connection.get("/space/#{space_id}/member/top/").body
|
41
|
+
%w(employee external).each do |section|
|
42
|
+
result[section]['profiles'].map! { |profile| Contact.new(profile) } if result[section].present? && result[section]['profiles'].present?
|
43
|
+
end
|
44
|
+
result
|
45
|
+
end
|
38
46
|
end
|
39
47
|
end
|
@@ -2,7 +2,7 @@ class Podio::Subscription < ActivePodio::Base
|
|
2
2
|
property :started_on, :datetime
|
3
3
|
property :notifications, :integer
|
4
4
|
property :ref, :hash
|
5
|
-
|
5
|
+
|
6
6
|
class << self
|
7
7
|
def find(id)
|
8
8
|
member Podio.connection.get("/subscription/#{id}").body
|
@@ -22,6 +22,10 @@ class Podio::Subscription < ActivePodio::Base
|
|
22
22
|
|
23
23
|
def delete_by_reference(ref_type, ref_id)
|
24
24
|
Podio.connection.delete("/subscription/#{ref_type}/#{ref_id}")
|
25
|
-
end
|
25
|
+
end
|
26
|
+
|
27
|
+
def find_subscribers_by_reference(ref_type, ref_id)
|
28
|
+
User.list Podio.connection.get("/subscription/#{ref_type}/#{ref_id}/").body
|
29
|
+
end
|
26
30
|
end
|
27
|
-
end
|
31
|
+
end
|
@@ -9,7 +9,8 @@ class Podio::UserStatus < ActivePodio::Base
|
|
9
9
|
|
10
10
|
has_one :user, :class => 'User'
|
11
11
|
has_one :contact, :class => 'Contact', :property => :profile
|
12
|
-
|
12
|
+
has_one :referral, :class => 'Referral'
|
13
|
+
|
13
14
|
class << self
|
14
15
|
def current
|
15
16
|
member Podio.connection.get("/user/status").body
|
data/lib/podio/models/widget.rb
CHANGED
data/lib/podio/version.rb
CHANGED
data/test/active_podio_test.rb
CHANGED
@@ -284,10 +284,10 @@ class ActivePodioTest < Test::Unit::TestCase
|
|
284
284
|
@test = TestModel.new(:test_id => 42)
|
285
285
|
assert_equal 42.hash, @test.hash
|
286
286
|
end
|
287
|
-
|
287
|
+
|
288
288
|
test 'should return attributes for as_json' do
|
289
289
|
@test = TestModel.new(:test_id => 42)
|
290
|
-
assert_equal({:string=>nil, :test_id=>42, :hash_property=>nil, :prefixed_hash_property=>nil, :hash_property_with_setter=>nil, :prefixed_hash_property_with_setter=>nil, :datetime=>nil, :date=>nil, :integer=>nil, :boolean=>nil, :array=>nil}, @test.as_json)
|
290
|
+
assert_equal({:id=> 42, :string=>nil, :test_id=>42, :hash_property=>nil, :prefixed_hash_property=>nil, :hash_property_with_setter=>nil, :prefixed_hash_property_with_setter=>nil, :datetime=>nil, :date=>nil, :integer=>nil, :boolean=>nil, :array=>nil}, @test.as_json)
|
291
291
|
end
|
292
292
|
|
293
293
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: podio
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.7.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -10,11 +10,11 @@ authors:
|
|
10
10
|
autorequire:
|
11
11
|
bindir: bin
|
12
12
|
cert_chain: []
|
13
|
-
date:
|
13
|
+
date: 2012-02-22 00:00:00.000000000 Z
|
14
14
|
dependencies:
|
15
15
|
- !ruby/object:Gem::Dependency
|
16
16
|
name: faraday
|
17
|
-
requirement: &
|
17
|
+
requirement: &2156588980 !ruby/object:Gem::Requirement
|
18
18
|
none: false
|
19
19
|
requirements:
|
20
20
|
- - ~>
|
@@ -22,10 +22,10 @@ dependencies:
|
|
22
22
|
version: 0.7.0
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
|
-
version_requirements: *
|
25
|
+
version_requirements: *2156588980
|
26
26
|
- !ruby/object:Gem::Dependency
|
27
27
|
name: activesupport
|
28
|
-
requirement: &
|
28
|
+
requirement: &2156588080 !ruby/object:Gem::Requirement
|
29
29
|
none: false
|
30
30
|
requirements:
|
31
31
|
- - ~>
|
@@ -33,10 +33,10 @@ dependencies:
|
|
33
33
|
version: '3.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
|
-
version_requirements: *
|
36
|
+
version_requirements: *2156588080
|
37
37
|
- !ruby/object:Gem::Dependency
|
38
38
|
name: activemodel
|
39
|
-
requirement: &
|
39
|
+
requirement: &2156586720 !ruby/object:Gem::Requirement
|
40
40
|
none: false
|
41
41
|
requirements:
|
42
42
|
- - ~>
|
@@ -44,10 +44,10 @@ dependencies:
|
|
44
44
|
version: '3.0'
|
45
45
|
type: :runtime
|
46
46
|
prerelease: false
|
47
|
-
version_requirements: *
|
47
|
+
version_requirements: *2156586720
|
48
48
|
- !ruby/object:Gem::Dependency
|
49
49
|
name: multi_json
|
50
|
-
requirement: &
|
50
|
+
requirement: &2156585920 !ruby/object:Gem::Requirement
|
51
51
|
none: false
|
52
52
|
requirements:
|
53
53
|
- - ! '>='
|
@@ -55,7 +55,7 @@ dependencies:
|
|
55
55
|
version: '0'
|
56
56
|
type: :runtime
|
57
57
|
prerelease: false
|
58
|
-
version_requirements: *
|
58
|
+
version_requirements: *2156585920
|
59
59
|
description: ! 'The official Ruby wrapper for the Podio API used and maintained by
|
60
60
|
the Podio team
|
61
61
|
|
@@ -93,7 +93,7 @@ files:
|
|
93
93
|
- lib/podio/models/application_field.rb
|
94
94
|
- lib/podio/models/bulletin.rb
|
95
95
|
- lib/podio/models/by_line.rb
|
96
|
-
- lib/podio/models/
|
96
|
+
- lib/podio/models/calendar_event.rb
|
97
97
|
- lib/podio/models/calendar_mute.rb
|
98
98
|
- lib/podio/models/category.rb
|
99
99
|
- lib/podio/models/comment.rb
|
@@ -107,6 +107,7 @@ files:
|
|
107
107
|
- lib/podio/models/conversation_participant.rb
|
108
108
|
- lib/podio/models/email_subscription_setting.rb
|
109
109
|
- lib/podio/models/embed.rb
|
110
|
+
- lib/podio/models/external_file.rb
|
110
111
|
- lib/podio/models/file_attachment.rb
|
111
112
|
- lib/podio/models/filter.rb
|
112
113
|
- lib/podio/models/form.rb
|
@@ -117,6 +118,7 @@ files:
|
|
117
118
|
- lib/podio/models/item_diff.rb
|
118
119
|
- lib/podio/models/item_field.rb
|
119
120
|
- lib/podio/models/item_revision.rb
|
121
|
+
- lib/podio/models/linked_account.rb
|
120
122
|
- lib/podio/models/meeting.rb
|
121
123
|
- lib/podio/models/meeting_participiant.rb
|
122
124
|
- lib/podio/models/news.rb
|
@@ -134,6 +136,7 @@ files:
|
|
134
136
|
- lib/podio/models/question_option.rb
|
135
137
|
- lib/podio/models/rating.rb
|
136
138
|
- lib/podio/models/recurrence.rb
|
139
|
+
- lib/podio/models/referral.rb
|
137
140
|
- lib/podio/models/reminder.rb
|
138
141
|
- lib/podio/models/search.rb
|
139
142
|
- lib/podio/models/space.rb
|