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
@@ -30,22 +30,31 @@ class ActivePodioTest < Test::Unit::TestCase
30
30
  delegate_to_hash :prefixed_hash_property, :key3, :prefix => true
31
31
  delegate_to_hash :hash_property_with_setter, :key4, :setter => true
32
32
  delegate_to_hash :prefixed_hash_property_with_setter, :key5, :setter => true, :prefix => true
33
-
34
-
35
- def save(exception_class = nil)
36
- if exception_class
37
- raise exception_class.new({
38
- 'error' => 'test status',
39
- 'error_description' => 'test desc',
40
- 'error_parameters' => 'test parms'
41
- }, 500, 'http://api.podio.dev')
42
- end
43
- end
44
-
45
- handle_api_errors_for :save
46
33
  end
47
-
48
- test 'should instansiate model' do
34
+
35
+ class TestInheritedModel < TestModel
36
+ property :subclass_string, :string
37
+
38
+ has_one :subclass_assoc, :class => 'ActivePodioTest::TestAssociationModel'
39
+ end
40
+
41
+ test 'inherited models should not pollute the superclass attributes' do
42
+ super_attributes = TestModel.valid_attributes.dup
43
+ subclass_attributes = TestInheritedModel.valid_attributes
44
+
45
+ assert_equal [:subclass_string], subclass_attributes - super_attributes
46
+ assert_equal super_attributes, TestModel.valid_attributes
47
+ end
48
+
49
+ test 'inherited models should not pollute the superclass associations' do
50
+ super_associations = TestModel._associations.dup
51
+ subclass_associations = TestInheritedModel._associations
52
+
53
+ assert_equal [[:subclass_assoc, :has_one]], subclass_associations.to_a - super_associations.to_a
54
+ assert_equal super_associations, TestModel._associations
55
+ end
56
+
57
+ test 'should instantiate model' do
49
58
  @test = TestModel.new
50
59
  assert_not_nil @test
51
60
  end
@@ -130,7 +139,7 @@ class ActivePodioTest < Test::Unit::TestCase
130
139
  @test = TestModel.new(:array => ['foo', 'bar'])
131
140
  assert_equal 'foo', @test.default_array
132
141
  end
133
-
142
+
134
143
  test 'should expose has one association' do
135
144
  @test = TestModel.new(:association => { :string => 'association string' })
136
145
  assert_equal 'association string', @test.association.string
@@ -198,22 +207,24 @@ class ActivePodioTest < Test::Unit::TestCase
198
207
  @test.key4 = 'new'
199
208
  assert_equal 'new', @test.key4
200
209
  end
201
-
202
- test 'should handle non failing api requests' do
203
- @test = TestModel.new
204
- assert @test.save
205
- end
206
-
207
- [Podio::BadRequestError, Podio::AuthorizationError].each do |exception_class|
208
- test "should handle failing api requests with #{exception_class.name} exception" do
209
- @test = TestModel.new
210
- assert_equal false, @test.save(exception_class)
211
- assert_equal 'test status', @test.error_code
212
- assert_equal 'test desc', @test.error_message
213
- assert_equal 'test parms', @test.error_parameters
214
- end
215
- end
216
-
210
+
211
+ test 'should instantiate exception properly' do
212
+ exc = Podio::BadRequestError.new(
213
+ {
214
+ "error" => "forbidden",
215
+ "error_detail" => nil,
216
+ "error_description" => "Only available for clients with a trust level of 4 or higher. To get your API client upgraded to a higher trust level contact support at support@podio.com.",
217
+ "error_parameters" => {"foo" => "bar"},
218
+ "error_propagate" => false
219
+ }, 400, "https://api.podio.com/foo/bar")
220
+
221
+ assert_equal exc.code, "forbidden"
222
+ assert_equal exc.sub_code, nil
223
+ assert_equal exc.message, "Only available for clients with a trust level of 4 or higher. To get your API client upgraded to a higher trust level contact support at support@podio.com."
224
+ assert_equal exc.propagate, false
225
+ assert_equal exc.parameters["foo"], "bar"
226
+ end
227
+
217
228
  test 'should return instance from member' do
218
229
  assert TestModel.member(:string => 'string').instance_of?(TestModel)
219
230
  end
@@ -289,5 +300,4 @@ class ActivePodioTest < Test::Unit::TestCase
289
300
  @test = TestModel.new(:test_id => 42)
290
301
  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
302
  end
292
-
293
- end
303
+ end
@@ -7,17 +7,28 @@ class ClientTest < Test::Unit::TestCase
7
7
  assert_equal Podio::Client, Podio.client.class
8
8
  assert_equal 'client_id', Podio.client.api_key
9
9
  assert_equal 'client_secret', Podio.client.api_secret
10
+
11
+ assert_equal 'Basic Y2xpZW50X2lkOmNsaWVudF9zZWNyZXQ=', Podio.client.connection.headers['authorization']
10
12
  end
11
-
13
+
12
14
  test 'should initialize client' do
15
+ podio = Podio::Client.new()
16
+
17
+ assert_equal 'https://api.podio.com', podio.api_url
18
+ assert_nil podio.connection.headers['authorization']
19
+ end
20
+
21
+ test 'should initialize client with key and secret' do
13
22
  podio = Podio::Client.new(:api_url => 'https://new.podio.com', :api_key => 'new_client_id', :api_secret => 'new_client_secret')
14
23
 
15
24
  assert_equal 'https://new.podio.com', podio.api_url
16
25
  assert_equal 'new_client_id', podio.api_key
17
26
  assert_equal 'new_client_secret', podio.api_secret
27
+
28
+ assert_equal 'Basic bmV3X2NsaWVudF9pZDpuZXdfY2xpZW50X3NlY3JldA==', podio.connection.headers['authorization']
18
29
  end
19
30
 
20
- test 'should setup connection' do
31
+ test 'should setup connection with existing token' do
21
32
  token = Podio::OAuthToken.new('access_token' => 'access', 'refresh_token' => 'refresh')
22
33
  podio = Podio::Client.new(:oauth_token => token)
23
34
 
metadata CHANGED
@@ -1,8 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: podio
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
5
- prerelease:
4
+ version: 1.0.0
6
5
  platform: ruby
7
6
  authors:
8
7
  - Florian Munz
@@ -10,57 +9,95 @@ authors:
10
9
  autorequire:
11
10
  bindir: bin
12
11
  cert_chain: []
13
- date: 2012-09-04 00:00:00.000000000 Z
12
+ date: 2014-01-30 00:00:00.000000000 Z
14
13
  dependencies:
15
14
  - !ruby/object:Gem::Dependency
16
15
  name: faraday
17
- requirement: &2152006820 !ruby/object:Gem::Requirement
18
- none: false
16
+ requirement: !ruby/object:Gem::Requirement
19
17
  requirements:
20
18
  - - ~>
21
19
  - !ruby/object:Gem::Version
22
- version: 0.7.0
20
+ version: 0.8.0
23
21
  type: :runtime
24
22
  prerelease: false
25
- version_requirements: *2152006820
23
+ version_requirements: !ruby/object:Gem::Requirement
24
+ requirements:
25
+ - - ~>
26
+ - !ruby/object:Gem::Version
27
+ version: 0.8.0
26
28
  - !ruby/object:Gem::Dependency
27
29
  name: activesupport
28
- requirement: &2152005480 !ruby/object:Gem::Requirement
29
- none: false
30
+ requirement: !ruby/object:Gem::Requirement
30
31
  requirements:
31
- - - ~>
32
+ - - '>='
32
33
  - !ruby/object:Gem::Version
33
34
  version: '3.0'
34
35
  type: :runtime
35
36
  prerelease: false
36
- version_requirements: *2152005480
37
+ version_requirements: !ruby/object:Gem::Requirement
38
+ requirements:
39
+ - - '>='
40
+ - !ruby/object:Gem::Version
41
+ version: '3.0'
37
42
  - !ruby/object:Gem::Dependency
38
43
  name: activemodel
39
- requirement: &2152004840 !ruby/object:Gem::Requirement
40
- none: false
44
+ requirement: !ruby/object:Gem::Requirement
41
45
  requirements:
42
- - - ~>
46
+ - - '>='
43
47
  - !ruby/object:Gem::Version
44
48
  version: '3.0'
45
49
  type: :runtime
46
50
  prerelease: false
47
- version_requirements: *2152004840
51
+ version_requirements: !ruby/object:Gem::Requirement
52
+ requirements:
53
+ - - '>='
54
+ - !ruby/object:Gem::Version
55
+ version: '3.0'
48
56
  - !ruby/object:Gem::Dependency
49
57
  name: multi_json
50
- requirement: &2152004340 !ruby/object:Gem::Requirement
51
- none: false
58
+ requirement: !ruby/object:Gem::Requirement
52
59
  requirements:
53
- - - ! '>='
60
+ - - '>='
54
61
  - !ruby/object:Gem::Version
55
62
  version: '0'
56
63
  type: :runtime
57
64
  prerelease: false
58
- version_requirements: *2152004340
59
- description: ! 'The official Ruby wrapper for the Podio API used and maintained by
60
- the Podio team
61
-
62
- '
63
- email: florian@podio.com
65
+ version_requirements: !ruby/object:Gem::Requirement
66
+ requirements:
67
+ - - '>='
68
+ - !ruby/object:Gem::Version
69
+ version: '0'
70
+ - !ruby/object:Gem::Dependency
71
+ name: rake
72
+ requirement: !ruby/object:Gem::Requirement
73
+ requirements:
74
+ - - '>='
75
+ - !ruby/object:Gem::Version
76
+ version: '0'
77
+ type: :development
78
+ prerelease: false
79
+ version_requirements: !ruby/object:Gem::Requirement
80
+ requirements:
81
+ - - '>='
82
+ - !ruby/object:Gem::Version
83
+ version: '0'
84
+ - !ruby/object:Gem::Dependency
85
+ name: yard
86
+ requirement: !ruby/object:Gem::Requirement
87
+ requirements:
88
+ - - '>='
89
+ - !ruby/object:Gem::Version
90
+ version: '0'
91
+ type: :development
92
+ prerelease: false
93
+ version_requirements: !ruby/object:Gem::Requirement
94
+ requirements:
95
+ - - '>='
96
+ - !ruby/object:Gem::Version
97
+ version: '0'
98
+ description: The official Ruby wrapper for the Podio API used and maintained by the
99
+ Podio team
100
+ email: munz@podio.com
64
101
  executables: []
65
102
  extensions: []
66
103
  extra_rdoc_files: []
@@ -71,13 +108,13 @@ files:
71
108
  - LICENSE
72
109
  - README.md
73
110
  - Rakefile
74
- - examples/sinatra.rb
111
+ - examples/oauth_web_flow/Gemfile
112
+ - examples/oauth_web_flow/sinatra.rb
75
113
  - lib/podio.rb
76
114
  - lib/podio/active_podio/base.rb
77
115
  - lib/podio/active_podio/updatable.rb
78
116
  - lib/podio/client.rb
79
117
  - lib/podio/error.rb
80
- - lib/podio/middleware/date_conversion.rb
81
118
  - lib/podio/middleware/error_response.rb
82
119
  - lib/podio/middleware/json_request.rb
83
120
  - lib/podio/middleware/json_response.rb
@@ -93,36 +130,47 @@ files:
93
130
  - lib/podio/models/application_email.rb
94
131
  - lib/podio/models/application_field.rb
95
132
  - lib/podio/models/batch.rb
96
- - lib/podio/models/bulletin.rb
97
133
  - lib/podio/models/by_line.rb
98
134
  - lib/podio/models/calendar_event.rb
99
135
  - lib/podio/models/calendar_mute.rb
100
136
  - lib/podio/models/category.rb
101
137
  - lib/podio/models/comment.rb
102
- - lib/podio/models/connection.rb
138
+ - lib/podio/models/condition.rb
139
+ - lib/podio/models/condition_set.rb
103
140
  - lib/podio/models/contact.rb
104
141
  - lib/podio/models/contract.rb
105
142
  - lib/podio/models/contract_accounting.rb
143
+ - lib/podio/models/contract_event.rb
106
144
  - lib/podio/models/contract_price.rb
145
+ - lib/podio/models/contract_price_v2.rb
146
+ - lib/podio/models/contract_user.rb
107
147
  - lib/podio/models/conversation.rb
148
+ - lib/podio/models/conversation_event.rb
108
149
  - lib/podio/models/conversation_message.rb
109
150
  - lib/podio/models/conversation_participant.rb
151
+ - lib/podio/models/date_election.rb
152
+ - lib/podio/models/email_contact.rb
110
153
  - lib/podio/models/email_subscription_setting.rb
111
154
  - lib/podio/models/embed.rb
155
+ - lib/podio/models/experiment.rb
112
156
  - lib/podio/models/external_file.rb
113
157
  - lib/podio/models/file_attachment.rb
114
158
  - lib/podio/models/filter.rb
115
159
  - lib/podio/models/form.rb
160
+ - lib/podio/models/friend.rb
161
+ - lib/podio/models/grant.rb
116
162
  - lib/podio/models/hook.rb
117
163
  - lib/podio/models/importer.rb
118
164
  - lib/podio/models/integration.rb
165
+ - lib/podio/models/invoice.rb
119
166
  - lib/podio/models/item.rb
120
167
  - lib/podio/models/item_diff.rb
121
168
  - lib/podio/models/item_field.rb
122
169
  - lib/podio/models/item_revision.rb
123
170
  - lib/podio/models/linked_account.rb
124
171
  - lib/podio/models/linked_account_data.rb
125
- - lib/podio/models/news.rb
172
+ - lib/podio/models/live.rb
173
+ - lib/podio/models/net_promoter_score.rb
126
174
  - lib/podio/models/notification.rb
127
175
  - lib/podio/models/notification_group.rb
128
176
  - lib/podio/models/o_auth.rb
@@ -131,7 +179,9 @@ files:
131
179
  - lib/podio/models/organization_contact.rb
132
180
  - lib/podio/models/organization_member.rb
133
181
  - lib/podio/models/organization_profile.rb
182
+ - lib/podio/models/pin.rb
134
183
  - lib/podio/models/profile.rb
184
+ - lib/podio/models/promotion.rb
135
185
  - lib/podio/models/question.rb
136
186
  - lib/podio/models/question_answer.rb
137
187
  - lib/podio/models/question_option.rb
@@ -146,6 +196,7 @@ files:
146
196
  - lib/podio/models/space_invitation.rb
147
197
  - lib/podio/models/space_member.rb
148
198
  - lib/podio/models/status.rb
199
+ - lib/podio/models/stream_activity_group.rb
149
200
  - lib/podio/models/stream_mute.rb
150
201
  - lib/podio/models/stream_object.rb
151
202
  - lib/podio/models/subscription.rb
@@ -162,34 +213,36 @@ files:
162
213
  - lib/podio/response_wrapper.rb
163
214
  - lib/podio/version.rb
164
215
  - podio.gemspec
216
+ - script/config.example.rb
217
+ - script/referenceGenerator.rb
165
218
  - test/active_podio_test.rb
166
219
  - test/client_test.rb
167
220
  - test/fixtures/fixtures.yaml
168
221
  - test/models_sanity_test.rb
169
222
  - test/test_helper.rb
170
223
  homepage: https://github.com/podio/podio-rb
171
- licenses: []
224
+ licenses:
225
+ - MIT
226
+ metadata: {}
172
227
  post_install_message:
173
228
  rdoc_options: []
174
229
  require_paths:
175
230
  - lib
176
231
  required_ruby_version: !ruby/object:Gem::Requirement
177
- none: false
178
232
  requirements:
179
- - - ! '>='
233
+ - - '>='
180
234
  - !ruby/object:Gem::Version
181
235
  version: '0'
182
236
  required_rubygems_version: !ruby/object:Gem::Requirement
183
- none: false
184
237
  requirements:
185
- - - ! '>='
238
+ - - '>='
186
239
  - !ruby/object:Gem::Version
187
240
  version: '0'
188
241
  requirements: []
189
242
  rubyforge_project:
190
- rubygems_version: 1.8.6
243
+ rubygems_version: 2.0.14
191
244
  signing_key:
192
- specification_version: 3
245
+ specification_version: 4
193
246
  summary: Ruby wrapper for the Podio API
194
247
  test_files:
195
248
  - test/active_podio_test.rb
@@ -1,37 +0,0 @@
1
- module Podio
2
- module Middleware
3
- class DateConversion < Faraday::Response::Middleware
4
- def on_complete(env)
5
- convert_dates(env[:body]) if env[:body].is_a?(Hash)
6
- end
7
-
8
- # Converts all attributes ending with "_on" to datetime and ending with "date" to date
9
- def convert_dates(body)
10
- [body].flatten.compact.each do |hash|
11
- hash.each do |key, value|
12
- if value.is_a?(Hash)
13
- convert_dates(value)
14
- elsif value.is_a?(Array)
15
- value.each_with_index { |item, index| hash[key][index] = convert_field(key, item) }
16
- else
17
- hash[key] = convert_field(key, value)
18
- end
19
- end
20
- end
21
- end
22
-
23
- private
24
-
25
- def convert_field(key, value)
26
- if key.present?
27
- if key[-3..-1] == "_on"
28
- return value.try(:to_s).try(:to_datetime)
29
- elsif key[-4..-1] == "date"
30
- return value.try(:to_s).try(:to_date)
31
- end
32
- end
33
- value
34
- end
35
- end
36
- end
37
- end
@@ -1,60 +0,0 @@
1
- class Podio::Bulletin < ActivePodio::Base
2
- property :bulletin_id, :integer
3
- property :title, :string
4
- property :summary, :string
5
- property :text, :string
6
- property :locale, :string
7
- property :target_group, :string
8
- property :created_on, :datetime
9
- property :sent_on, :datetime
10
-
11
- has_one :created_by, :class => 'ByLine'
12
- has_one :sent_by, :class => 'ByLine'
13
-
14
- alias_method :id, :bulletin_id
15
-
16
- class << self
17
- def create(attributes)
18
- response = Podio.connection.post do |req|
19
- req.url "/bulletin/"
20
- req.body = attributes
21
- end
22
-
23
- response.body['bulletin_id']
24
- end
25
-
26
- def update(id, attributes)
27
- response = Podio.connection.put do |req|
28
- req.url "/bulletin/#{id}"
29
- req.body = attributes
30
- end
31
-
32
- response.status
33
- end
34
-
35
- def find(id, options={})
36
- member Podio.connection.get("/bulletin/#{id}").body
37
- end
38
-
39
- def find_visible
40
- list Podio.connection.get("/bulletin/").body
41
- end
42
-
43
- def find_all
44
- list Podio.connection.get("/bulletin/?show_drafts=1").body
45
- end
46
-
47
- def find_all_by_locale(locale)
48
- list Podio.connection.get("/bulletin/?locale=locale").body
49
- end
50
-
51
- def preview!(id)
52
- Podio.connection.post("/bulletin/#{id}/preview").body
53
- end
54
-
55
- def send!(id)
56
- Podio.connection.post("/bulletin/#{id}/send").body
57
- end
58
-
59
- end
60
- end