podio 1.0.0 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/.travis.yml +1 -4
- data/README.md +82 -67
- data/lib/podio.rb +15 -2
- data/lib/podio/client.rb +11 -7
- data/lib/podio/middleware/error_response.rb +3 -1
- data/lib/podio/middleware/json_response.rb +6 -1
- data/lib/podio/middleware/logger.rb +4 -3
- data/lib/podio/middleware/oauth2.rb +5 -5
- data/lib/podio/models/answer.rb +8 -0
- data/lib/podio/models/app_store_category.rb +2 -2
- data/lib/podio/models/app_store_share.rb +1 -0
- data/lib/podio/models/application.rb +12 -4
- data/lib/podio/models/application_field.rb +10 -0
- data/lib/podio/models/batch.rb +1 -0
- data/lib/podio/models/calendar_event.rb +6 -5
- data/lib/podio/models/campaign.rb +88 -0
- data/lib/podio/models/category.rb +1 -1
- data/lib/podio/models/contract.rb +18 -20
- data/lib/podio/models/contract_attribution.rb +24 -0
- data/lib/podio/models/contract_period.rb +22 -0
- data/lib/podio/models/contract_price.rb +37 -26
- data/lib/podio/models/device.rb +22 -0
- data/lib/podio/models/email_subscription_setting.rb +8 -0
- data/lib/podio/models/embed.rb +5 -2
- data/lib/podio/models/experiment.rb +26 -3
- data/lib/podio/models/extension.rb +90 -0
- data/lib/podio/models/external_file.rb +3 -3
- data/lib/podio/models/file_attachment.rb +25 -2
- data/lib/podio/models/form.rb +2 -1
- data/lib/podio/models/grant.rb +1 -0
- data/lib/podio/models/invoice.rb +13 -0
- data/lib/podio/models/item.rb +24 -11
- data/lib/podio/models/item_field.rb +6 -0
- data/lib/podio/models/item_transaction.rb +34 -0
- data/lib/podio/models/live.rb +1 -17
- data/lib/podio/models/notification.rb +5 -0
- data/lib/podio/models/o_auth.rb +9 -2
- data/lib/podio/models/o_auth_client.rb +5 -3
- data/lib/podio/models/o_auth_scope.rb +11 -0
- data/lib/podio/models/organization.rb +26 -8
- data/lib/podio/models/organization_member.rb +6 -0
- data/lib/podio/models/organization_membership.rb +15 -0
- data/lib/podio/models/profile.rb +2 -0
- data/lib/podio/models/promotion.rb +6 -8
- data/lib/podio/models/promotion_group.rb +51 -0
- data/lib/podio/models/promotion_group_member.rb +32 -0
- data/lib/podio/models/rating.rb +4 -2
- data/lib/podio/models/reference.rb +2 -1
- data/lib/podio/models/space.rb +11 -5
- data/lib/podio/models/tag.rb +36 -0
- data/lib/podio/models/view.rb +5 -0
- data/lib/podio/models/vote.rb +8 -0
- data/lib/podio/models/voting.rb +9 -0
- data/lib/podio/models/voucher.rb +68 -0
- data/lib/podio/version.rb +1 -1
- data/podio.gemspec +10 -3
- data/test/client_test.rb +14 -0
- metadata +31 -13
- data/lib/podio/models/contract_price_v2.rb +0 -31
- data/lib/podio/models/date_election.rb +0 -35
data/lib/podio/models/view.rb
CHANGED
@@ -67,5 +67,10 @@ class Podio::View < ActivePodio::Base
|
|
67
67
|
req.body = attributes
|
68
68
|
end
|
69
69
|
end
|
70
|
+
|
71
|
+
# @see https://developers.podio.com/doc/views/make-default-155388326
|
72
|
+
def make_default(view_id)
|
73
|
+
Podio.connection.post("/view/#{view_id}/default").status
|
74
|
+
end
|
70
75
|
end
|
71
76
|
end
|
@@ -0,0 +1,68 @@
|
|
1
|
+
class Podio::Voucher < ActivePodio::Base
|
2
|
+
include ActivePodio::Updatable
|
3
|
+
|
4
|
+
property :campaign_id, :integer
|
5
|
+
property :voucher_id, :integer
|
6
|
+
property :code, :string
|
7
|
+
property :uses, :integer
|
8
|
+
property :created_on, :datetime
|
9
|
+
|
10
|
+
alias_method :id, :voucher_id
|
11
|
+
|
12
|
+
def create
|
13
|
+
result = self.class.create(self.attributes)
|
14
|
+
self.update_attributes(result.attributes)
|
15
|
+
end
|
16
|
+
|
17
|
+
def update
|
18
|
+
result = self.class.update(self.voucher_id, self.attributes)
|
19
|
+
self.update_attributes(result.attributes)
|
20
|
+
end
|
21
|
+
|
22
|
+
def delete
|
23
|
+
self.class.delete(self.voucher_id)
|
24
|
+
end
|
25
|
+
|
26
|
+
class << self
|
27
|
+
def create(attributes)
|
28
|
+
member Podio.connection.post { |req|
|
29
|
+
req.url "/campaign/#{attributes[:campaign_id]}/voucher"
|
30
|
+
req.body = attributes
|
31
|
+
}.body
|
32
|
+
end
|
33
|
+
|
34
|
+
def generate(attributes)
|
35
|
+
Podio.connection.post { |req|
|
36
|
+
req.url "/campaign/#{attributes[:campaign_id]}/voucher/generate"
|
37
|
+
req.body = attributes
|
38
|
+
}.status
|
39
|
+
end
|
40
|
+
|
41
|
+
def update(id, attributes)
|
42
|
+
member Podio.connection.put { |req|
|
43
|
+
req.url "/campaign/voucher/#{id}"
|
44
|
+
req.body = attributes
|
45
|
+
}.body
|
46
|
+
end
|
47
|
+
|
48
|
+
def delete(id)
|
49
|
+
Podio.connection.delete("/campaign/voucher/#{id}").status
|
50
|
+
end
|
51
|
+
|
52
|
+
def find(id)
|
53
|
+
member Podio.connection.get("/campaign/voucher/#{id}").body
|
54
|
+
end
|
55
|
+
|
56
|
+
def find_all(campaign_id, options = {})
|
57
|
+
list Podio.connection.get { |req|
|
58
|
+
req.url("/campaign/#{campaign_id}/voucher", options)
|
59
|
+
}.body
|
60
|
+
end
|
61
|
+
|
62
|
+
def export(campaign_id, options = {})
|
63
|
+
Podio.connection.get { |req|
|
64
|
+
req.url("/campaign/#{campaign_id}/voucher/export", options)
|
65
|
+
}.body
|
66
|
+
end
|
67
|
+
end
|
68
|
+
end
|
data/lib/podio/version.rb
CHANGED
data/podio.gemspec
CHANGED
@@ -19,11 +19,18 @@ Gem::Specification.new do |s|
|
|
19
19
|
|
20
20
|
s.has_rdoc = false
|
21
21
|
|
22
|
-
s.add_dependency('faraday', '
|
23
|
-
s.add_dependency('activesupport', '>= 3.0')
|
24
|
-
s.add_dependency('activemodel', '>= 3.0')
|
22
|
+
s.add_dependency('faraday', ['>= 0.8.0', '< 0.10.0'])
|
25
23
|
s.add_dependency('multi_json')
|
26
24
|
|
25
|
+
if RUBY_VERSION < '1.9.3'
|
26
|
+
s.add_dependency('i18n', '<= 0.6.11')
|
27
|
+
s.add_dependency('activesupport', '~> 3.0')
|
28
|
+
s.add_dependency('activemodel', '~> 3.0')
|
29
|
+
else
|
30
|
+
s.add_dependency('activesupport', '>= 3.0')
|
31
|
+
s.add_dependency('activemodel', '>= 3.0')
|
32
|
+
end
|
33
|
+
|
27
34
|
s.add_development_dependency('rake')
|
28
35
|
s.add_development_dependency('yard')
|
29
36
|
end
|
data/test/client_test.rb
CHANGED
@@ -105,4 +105,18 @@ class ClientTest < Test::Unit::TestCase
|
|
105
105
|
assert_equal 200, response.status
|
106
106
|
assert response.body.is_a?(Array)
|
107
107
|
end
|
108
|
+
|
109
|
+
test 'should be able to handle bad json files' do
|
110
|
+
login_as(:professor)
|
111
|
+
|
112
|
+
Podio.client.stubs.get('/file/1/raw') {[200,
|
113
|
+
{'content-disposition' => 'inline; filename="horrible.json"',
|
114
|
+
'content-type'=> 'application/json'},
|
115
|
+
'[ this is really bad json {"status" => "active"}]']}
|
116
|
+
|
117
|
+
response = Podio.connection.get('/file/1/raw')
|
118
|
+
assert_equal 200, response.status
|
119
|
+
puts "#{response.body.class}"
|
120
|
+
assert response.body.is_a?(String)
|
121
|
+
end
|
108
122
|
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:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Florian Munz
|
@@ -9,38 +9,44 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2015-12-11 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday
|
16
16
|
requirement: !ruby/object:Gem::Requirement
|
17
17
|
requirements:
|
18
|
-
- -
|
18
|
+
- - '>='
|
19
19
|
- !ruby/object:Gem::Version
|
20
20
|
version: 0.8.0
|
21
|
+
- - <
|
22
|
+
- !ruby/object:Gem::Version
|
23
|
+
version: 0.10.0
|
21
24
|
type: :runtime
|
22
25
|
prerelease: false
|
23
26
|
version_requirements: !ruby/object:Gem::Requirement
|
24
27
|
requirements:
|
25
|
-
- -
|
28
|
+
- - '>='
|
26
29
|
- !ruby/object:Gem::Version
|
27
30
|
version: 0.8.0
|
31
|
+
- - <
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: 0.10.0
|
28
34
|
- !ruby/object:Gem::Dependency
|
29
|
-
name:
|
35
|
+
name: multi_json
|
30
36
|
requirement: !ruby/object:Gem::Requirement
|
31
37
|
requirements:
|
32
38
|
- - '>='
|
33
39
|
- !ruby/object:Gem::Version
|
34
|
-
version: '
|
40
|
+
version: '0'
|
35
41
|
type: :runtime
|
36
42
|
prerelease: false
|
37
43
|
version_requirements: !ruby/object:Gem::Requirement
|
38
44
|
requirements:
|
39
45
|
- - '>='
|
40
46
|
- !ruby/object:Gem::Version
|
41
|
-
version: '
|
47
|
+
version: '0'
|
42
48
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
49
|
+
name: activesupport
|
44
50
|
requirement: !ruby/object:Gem::Requirement
|
45
51
|
requirements:
|
46
52
|
- - '>='
|
@@ -54,19 +60,19 @@ dependencies:
|
|
54
60
|
- !ruby/object:Gem::Version
|
55
61
|
version: '3.0'
|
56
62
|
- !ruby/object:Gem::Dependency
|
57
|
-
name:
|
63
|
+
name: activemodel
|
58
64
|
requirement: !ruby/object:Gem::Requirement
|
59
65
|
requirements:
|
60
66
|
- - '>='
|
61
67
|
- !ruby/object:Gem::Version
|
62
|
-
version: '0'
|
68
|
+
version: '3.0'
|
63
69
|
type: :runtime
|
64
70
|
prerelease: false
|
65
71
|
version_requirements: !ruby/object:Gem::Requirement
|
66
72
|
requirements:
|
67
73
|
- - '>='
|
68
74
|
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
75
|
+
version: '3.0'
|
70
76
|
- !ruby/object:Gem::Dependency
|
71
77
|
name: rake
|
72
78
|
requirement: !ruby/object:Gem::Requirement
|
@@ -124,6 +130,7 @@ files:
|
|
124
130
|
- lib/podio/models/action.rb
|
125
131
|
- lib/podio/models/activation_status.rb
|
126
132
|
- lib/podio/models/activity.rb
|
133
|
+
- lib/podio/models/answer.rb
|
127
134
|
- lib/podio/models/app_store_category.rb
|
128
135
|
- lib/podio/models/app_store_share.rb
|
129
136
|
- lib/podio/models/application.rb
|
@@ -133,6 +140,7 @@ files:
|
|
133
140
|
- lib/podio/models/by_line.rb
|
134
141
|
- lib/podio/models/calendar_event.rb
|
135
142
|
- lib/podio/models/calendar_mute.rb
|
143
|
+
- lib/podio/models/campaign.rb
|
136
144
|
- lib/podio/models/category.rb
|
137
145
|
- lib/podio/models/comment.rb
|
138
146
|
- lib/podio/models/condition.rb
|
@@ -140,19 +148,21 @@ files:
|
|
140
148
|
- lib/podio/models/contact.rb
|
141
149
|
- lib/podio/models/contract.rb
|
142
150
|
- lib/podio/models/contract_accounting.rb
|
151
|
+
- lib/podio/models/contract_attribution.rb
|
143
152
|
- lib/podio/models/contract_event.rb
|
153
|
+
- lib/podio/models/contract_period.rb
|
144
154
|
- lib/podio/models/contract_price.rb
|
145
|
-
- lib/podio/models/contract_price_v2.rb
|
146
155
|
- lib/podio/models/contract_user.rb
|
147
156
|
- lib/podio/models/conversation.rb
|
148
157
|
- lib/podio/models/conversation_event.rb
|
149
158
|
- lib/podio/models/conversation_message.rb
|
150
159
|
- lib/podio/models/conversation_participant.rb
|
151
|
-
- lib/podio/models/
|
160
|
+
- lib/podio/models/device.rb
|
152
161
|
- lib/podio/models/email_contact.rb
|
153
162
|
- lib/podio/models/email_subscription_setting.rb
|
154
163
|
- lib/podio/models/embed.rb
|
155
164
|
- lib/podio/models/experiment.rb
|
165
|
+
- lib/podio/models/extension.rb
|
156
166
|
- lib/podio/models/external_file.rb
|
157
167
|
- lib/podio/models/file_attachment.rb
|
158
168
|
- lib/podio/models/filter.rb
|
@@ -167,6 +177,7 @@ files:
|
|
167
177
|
- lib/podio/models/item_diff.rb
|
168
178
|
- lib/podio/models/item_field.rb
|
169
179
|
- lib/podio/models/item_revision.rb
|
180
|
+
- lib/podio/models/item_transaction.rb
|
170
181
|
- lib/podio/models/linked_account.rb
|
171
182
|
- lib/podio/models/linked_account_data.rb
|
172
183
|
- lib/podio/models/live.rb
|
@@ -175,13 +186,17 @@ files:
|
|
175
186
|
- lib/podio/models/notification_group.rb
|
176
187
|
- lib/podio/models/o_auth.rb
|
177
188
|
- lib/podio/models/o_auth_client.rb
|
189
|
+
- lib/podio/models/o_auth_scope.rb
|
178
190
|
- lib/podio/models/organization.rb
|
179
191
|
- lib/podio/models/organization_contact.rb
|
180
192
|
- lib/podio/models/organization_member.rb
|
193
|
+
- lib/podio/models/organization_membership.rb
|
181
194
|
- lib/podio/models/organization_profile.rb
|
182
195
|
- lib/podio/models/pin.rb
|
183
196
|
- lib/podio/models/profile.rb
|
184
197
|
- lib/podio/models/promotion.rb
|
198
|
+
- lib/podio/models/promotion_group.rb
|
199
|
+
- lib/podio/models/promotion_group_member.rb
|
185
200
|
- lib/podio/models/question.rb
|
186
201
|
- lib/podio/models/question_answer.rb
|
187
202
|
- lib/podio/models/question_option.rb
|
@@ -209,6 +224,9 @@ files:
|
|
209
224
|
- lib/podio/models/user_status.rb
|
210
225
|
- lib/podio/models/via.rb
|
211
226
|
- lib/podio/models/view.rb
|
227
|
+
- lib/podio/models/vote.rb
|
228
|
+
- lib/podio/models/voting.rb
|
229
|
+
- lib/podio/models/voucher.rb
|
212
230
|
- lib/podio/models/widget.rb
|
213
231
|
- lib/podio/response_wrapper.rb
|
214
232
|
- lib/podio/version.rb
|
@@ -1,31 +0,0 @@
|
|
1
|
-
class Podio::ContractPriceV2 < ActivePodio::Base
|
2
|
-
|
3
|
-
has_one :employee, :class => 'ContractPriceItemV2'
|
4
|
-
has_one :external, :class => 'ContractPriceItemV2'
|
5
|
-
|
6
|
-
def total
|
7
|
-
self.employee.sub_total + self.external.sub_total
|
8
|
-
end
|
9
|
-
|
10
|
-
class << self
|
11
|
-
def calculate(contract_id, attributes)
|
12
|
-
response = Podio.connection.post do |req|
|
13
|
-
req.url "/contract/#{contract_id}/price/v2"
|
14
|
-
req.body = attributes
|
15
|
-
end
|
16
|
-
|
17
|
-
member response.body
|
18
|
-
end
|
19
|
-
|
20
|
-
end
|
21
|
-
end
|
22
|
-
|
23
|
-
class Podio::ContractPriceItemV2 < ActivePodio::Base
|
24
|
-
property :price, :float # Price per user
|
25
|
-
property :quantity, :integer # Number of users
|
26
|
-
|
27
|
-
def sub_total
|
28
|
-
(self.quantity*self.price).to_f
|
29
|
-
end
|
30
|
-
|
31
|
-
end
|
@@ -1,35 +0,0 @@
|
|
1
|
-
class Podio::DateElectionVote < ActivePodio::Base
|
2
|
-
property :date_option_id, :integer
|
3
|
-
property :value, :boolean
|
4
|
-
|
5
|
-
has_one :user, :class => 'Contact'
|
6
|
-
end
|
7
|
-
|
8
|
-
class Podio::DateElectionOption < ActivePodio::Base
|
9
|
-
property :date_option_id, :integer
|
10
|
-
property :start_utc, :datetime
|
11
|
-
property :end_utc, :datetime
|
12
|
-
end
|
13
|
-
|
14
|
-
class Podio::DateElection < ActivePodio::Base
|
15
|
-
property :date_election_id, :integer
|
16
|
-
|
17
|
-
has_many :votes, :class => 'DateElectionVote'
|
18
|
-
has_many :options, :class => 'DateElectionOption'
|
19
|
-
|
20
|
-
class << self
|
21
|
-
def vote(date_election_id, date_option_id, value)
|
22
|
-
Podio.connection.post do |req|
|
23
|
-
req.url "/date_election/#{date_election_id}/vote"
|
24
|
-
req.body = {:date_option_id => date_option_id.to_i, :value => value}
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
def choose(date_election_id, date_option_id)
|
29
|
-
Podio.connection.post do |req|
|
30
|
-
req.url "/date_election/#{date_election_id}/choose"
|
31
|
-
req.body = {:date_option_id => date_option_id.to_i}
|
32
|
-
end
|
33
|
-
end
|
34
|
-
end
|
35
|
-
end
|