twilio-ruby 5.2.3 → 5.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (59) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGES.md +26 -0
  3. data/README.md +3 -3
  4. data/UPGRADE.md +30 -0
  5. data/lib/twilio-ruby.rb +0 -18
  6. data/lib/twilio-ruby/rest/api/v2010/account/incoming_phone_number.rb +2 -2
  7. data/lib/twilio-ruby/rest/chat/v2/service.rb +24 -2
  8. data/lib/twilio-ruby/rest/chat/v2/service/channel/message.rb +5 -3
  9. data/lib/twilio-ruby/rest/client.rb +3 -3
  10. data/lib/twilio-ruby/rest/ip_messaging/v2/service.rb +24 -2
  11. data/lib/twilio-ruby/rest/ip_messaging/v2/service/channel/message.rb +5 -3
  12. data/lib/twilio-ruby/rest/notify/v1/service/notification.rb +12 -12
  13. data/lib/twilio-ruby/rest/taskrouter/v1/workspace.rb +38 -0
  14. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue.rb +40 -0
  15. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics.rb +350 -0
  16. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics.rb +264 -0
  17. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queue_statistics.rb +10 -2
  18. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task_queue/task_queues_statistics.rb +15 -3
  19. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker.rb +38 -0
  20. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/worker_statistics.rb +6 -2
  21. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_cumulative_statistics.rb +274 -0
  22. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_real_time_statistics.rb +213 -0
  23. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/workers_statistics.rb +14 -10
  24. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow.rb +40 -0
  25. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics.rb +357 -0
  26. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_real_time_statistics.rb +243 -0
  27. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workflow/workflow_statistics.rb +10 -2
  28. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_cumulative_statistics.rb +339 -0
  29. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_real_time_statistics.rb +239 -0
  30. data/lib/twilio-ruby/rest/taskrouter/v1/workspace/workspace_statistics.rb +10 -2
  31. data/lib/twilio-ruby/rest/video/v1/room.rb +7 -0
  32. data/lib/twilio-ruby/security/request_validator.rb +1 -1
  33. data/lib/twilio-ruby/version.rb +1 -1
  34. data/spec/integration/chat/v2/service/channel/message_spec.rb +41 -7
  35. data/spec/integration/chat/v2/service_spec.rb +8 -0
  36. data/spec/integration/ip_messaging/v2/service/channel/message_spec.rb +41 -7
  37. data/spec/integration/ip_messaging/v2/service_spec.rb +8 -0
  38. data/spec/integration/taskrouter/v1/workspace/task_queue/task_queue_cumulative_statistics_spec.rb +94 -0
  39. data/spec/integration/taskrouter/v1/workspace/task_queue/task_queue_real_time_statistics_spec.rb +79 -0
  40. data/spec/integration/taskrouter/v1/workspace/task_queue_spec.rb +8 -0
  41. data/spec/integration/taskrouter/v1/workspace/worker/worker_statistics_spec.rb +21 -38
  42. data/spec/integration/taskrouter/v1/workspace/worker/workers_cumulative_statistics_spec.rb +87 -0
  43. data/spec/integration/taskrouter/v1/workspace/worker/workers_real_time_statistics_spec.rb +68 -0
  44. data/spec/integration/taskrouter/v1/workspace/worker/workers_statistics_spec.rb +34 -61
  45. data/spec/integration/taskrouter/v1/workspace/worker_spec.rb +8 -0
  46. data/spec/integration/taskrouter/v1/workspace/workflow/workflow_cumulative_statistics_spec.rb +95 -0
  47. data/spec/integration/taskrouter/v1/workspace/workflow/workflow_real_time_statistics_spec.rb +55 -0
  48. data/spec/integration/taskrouter/v1/workspace/workflow_spec.rb +12 -4
  49. data/spec/integration/taskrouter/v1/workspace/workspace_cumulative_statistics_spec.rb +92 -0
  50. data/spec/integration/taskrouter/v1/workspace/workspace_real_time_statistics_spec.rb +70 -0
  51. data/spec/integration/taskrouter/v1/workspace_spec.rb +8 -0
  52. data/spec/integration/video/v1/room_spec.rb +12 -0
  53. data/spec/security/request_validator_spec.rb +0 -28
  54. data/spec/twilio_spec.rb +0 -15
  55. metadata +28 -9
  56. data/lib/rack/twilio_webhook_authentication.rb +0 -46
  57. data/lib/twilio-ruby/util/configuration.rb +0 -7
  58. data/spec/rack/twilio_webhook_authentication_spec.rb +0 -106
  59. data/spec/util/configuration_spec.rb +0 -15
@@ -0,0 +1,239 @@
1
+ ##
2
+ # This code was generated by
3
+ # \ / _ _ _| _ _
4
+ # | (_)\/(_)(_|\/| |(/_ v1.0.0
5
+ # / /
6
+
7
+ module Twilio
8
+ module REST
9
+ class Taskrouter < Domain
10
+ class V1 < Version
11
+ class WorkspaceContext < InstanceContext
12
+ class WorkspaceRealTimeStatisticsList < ListResource
13
+ ##
14
+ # Initialize the WorkspaceRealTimeStatisticsList
15
+ # @param [Version] version Version that contains the resource
16
+ # @param [String] workspace_sid The workspace_sid
17
+ # @return [WorkspaceRealTimeStatisticsList] WorkspaceRealTimeStatisticsList
18
+ def initialize(version, workspace_sid: nil)
19
+ super(version)
20
+
21
+ # Path Solution
22
+ @solution = {
23
+ workspace_sid: workspace_sid
24
+ }
25
+ end
26
+
27
+ ##
28
+ # Provide a user friendly representation
29
+ def to_s
30
+ '#<Twilio.Taskrouter.V1.WorkspaceRealTimeStatisticsList>'
31
+ end
32
+ end
33
+
34
+ class WorkspaceRealTimeStatisticsPage < Page
35
+ ##
36
+ # Initialize the WorkspaceRealTimeStatisticsPage
37
+ # @param [Version] version Version that contains the resource
38
+ # @param [Response] response Response from the API
39
+ # @param [Hash] solution Path solution for the resource
40
+ # @return [WorkspaceRealTimeStatisticsPage] WorkspaceRealTimeStatisticsPage
41
+ def initialize(version, response, solution)
42
+ super(version, response)
43
+
44
+ # Path Solution
45
+ @solution = solution
46
+ end
47
+
48
+ ##
49
+ # Build an instance of WorkspaceRealTimeStatisticsInstance
50
+ # @param [Hash] payload Payload response from the API
51
+ # @return [WorkspaceRealTimeStatisticsInstance] WorkspaceRealTimeStatisticsInstance
52
+ def get_instance(payload)
53
+ WorkspaceRealTimeStatisticsInstance.new(
54
+ @version,
55
+ payload,
56
+ workspace_sid: @solution[:workspace_sid],
57
+ )
58
+ end
59
+
60
+ ##
61
+ # Provide a user friendly representation
62
+ def to_s
63
+ '<Twilio.Taskrouter.V1.WorkspaceRealTimeStatisticsPage>'
64
+ end
65
+ end
66
+
67
+ class WorkspaceRealTimeStatisticsContext < InstanceContext
68
+ ##
69
+ # Initialize the WorkspaceRealTimeStatisticsContext
70
+ # @param [Version] version Version that contains the resource
71
+ # @param [String] workspace_sid The workspace_sid
72
+ # @return [WorkspaceRealTimeStatisticsContext] WorkspaceRealTimeStatisticsContext
73
+ def initialize(version, workspace_sid)
74
+ super(version)
75
+
76
+ # Path Solution
77
+ @solution = {
78
+ workspace_sid: workspace_sid,
79
+ }
80
+ @uri = "/Workspaces/#{@solution[:workspace_sid]}/RealTimeStatistics"
81
+ end
82
+
83
+ ##
84
+ # Fetch a WorkspaceRealTimeStatisticsInstance
85
+ # @param [String] task_channel The task_channel
86
+ # @return [WorkspaceRealTimeStatisticsInstance] Fetched WorkspaceRealTimeStatisticsInstance
87
+ def fetch(task_channel: :unset)
88
+ params = Twilio::Values.of({
89
+ 'TaskChannel' => task_channel,
90
+ })
91
+
92
+ payload = @version.fetch(
93
+ 'GET',
94
+ @uri,
95
+ params,
96
+ )
97
+
98
+ WorkspaceRealTimeStatisticsInstance.new(
99
+ @version,
100
+ payload,
101
+ workspace_sid: @solution[:workspace_sid],
102
+ )
103
+ end
104
+
105
+ ##
106
+ # Provide a user friendly representation
107
+ def to_s
108
+ context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
109
+ "#<Twilio.Taskrouter.V1.WorkspaceRealTimeStatisticsContext #{context}>"
110
+ end
111
+ end
112
+
113
+ class WorkspaceRealTimeStatisticsInstance < InstanceResource
114
+ ##
115
+ # Initialize the WorkspaceRealTimeStatisticsInstance
116
+ # @param [Version] version Version that contains the resource
117
+ # @param [Hash] payload payload that contains response from Twilio
118
+ # @param [String] workspace_sid The workspace_sid
119
+ # @return [WorkspaceRealTimeStatisticsInstance] WorkspaceRealTimeStatisticsInstance
120
+ def initialize(version, payload, workspace_sid: nil)
121
+ super(version)
122
+
123
+ # Marshaled Properties
124
+ @properties = {
125
+ 'account_sid' => payload['account_sid'],
126
+ 'activity_statistics' => payload['activity_statistics'],
127
+ 'longest_task_waiting_age' => payload['longest_task_waiting_age'].to_i,
128
+ 'tasks_by_priority' => payload['tasks_by_priority'],
129
+ 'tasks_by_status' => payload['tasks_by_status'],
130
+ 'total_tasks' => payload['total_tasks'].to_i,
131
+ 'total_workers' => payload['total_workers'].to_i,
132
+ 'workspace_sid' => payload['workspace_sid'],
133
+ 'url' => payload['url'],
134
+ }
135
+
136
+ # Context
137
+ @instance_context = nil
138
+ @params = {
139
+ 'workspace_sid' => workspace_sid,
140
+ }
141
+ end
142
+
143
+ ##
144
+ # Generate an instance context for the instance, the context is capable of
145
+ # performing various actions. All instance actions are proxied to the context
146
+ # @return [WorkspaceRealTimeStatisticsContext] WorkspaceRealTimeStatisticsContext for this WorkspaceRealTimeStatisticsInstance
147
+ def context
148
+ unless @instance_context
149
+ @instance_context = WorkspaceRealTimeStatisticsContext.new(
150
+ @version,
151
+ @params['workspace_sid'],
152
+ )
153
+ end
154
+ @instance_context
155
+ end
156
+
157
+ ##
158
+ # @return [String] The account_sid
159
+ def account_sid
160
+ @properties['account_sid']
161
+ end
162
+
163
+ ##
164
+ # @return [Hash] The activity_statistics
165
+ def activity_statistics
166
+ @properties['activity_statistics']
167
+ end
168
+
169
+ ##
170
+ # @return [String] The longest_task_waiting_age
171
+ def longest_task_waiting_age
172
+ @properties['longest_task_waiting_age']
173
+ end
174
+
175
+ ##
176
+ # @return [Hash] The tasks_by_priority
177
+ def tasks_by_priority
178
+ @properties['tasks_by_priority']
179
+ end
180
+
181
+ ##
182
+ # @return [Hash] The tasks_by_status
183
+ def tasks_by_status
184
+ @properties['tasks_by_status']
185
+ end
186
+
187
+ ##
188
+ # @return [String] The total_tasks
189
+ def total_tasks
190
+ @properties['total_tasks']
191
+ end
192
+
193
+ ##
194
+ # @return [String] The total_workers
195
+ def total_workers
196
+ @properties['total_workers']
197
+ end
198
+
199
+ ##
200
+ # @return [String] The workspace_sid
201
+ def workspace_sid
202
+ @properties['workspace_sid']
203
+ end
204
+
205
+ ##
206
+ # @return [String] The url
207
+ def url
208
+ @properties['url']
209
+ end
210
+
211
+ ##
212
+ # Fetch a WorkspaceRealTimeStatisticsInstance
213
+ # @param [String] task_channel The task_channel
214
+ # @return [WorkspaceRealTimeStatisticsInstance] Fetched WorkspaceRealTimeStatisticsInstance
215
+ def fetch(task_channel: :unset)
216
+ context.fetch(
217
+ task_channel: task_channel,
218
+ )
219
+ end
220
+
221
+ ##
222
+ # Provide a user friendly representation
223
+ def to_s
224
+ values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
225
+ "<Twilio.Taskrouter.V1.WorkspaceRealTimeStatisticsInstance #{values}>"
226
+ end
227
+
228
+ ##
229
+ # Provide a detailed, user friendly representation
230
+ def inspect
231
+ values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
232
+ "<Twilio.Taskrouter.V1.WorkspaceRealTimeStatisticsInstance #{values}>"
233
+ end
234
+ end
235
+ end
236
+ end
237
+ end
238
+ end
239
+ end
@@ -85,12 +85,16 @@ module Twilio
85
85
  # @param [String] minutes The minutes
86
86
  # @param [Time] start_date The start_date
87
87
  # @param [Time] end_date The end_date
88
+ # @param [String] task_channel The task_channel
89
+ # @param [String] split_by_wait_time The split_by_wait_time
88
90
  # @return [WorkspaceStatisticsInstance] Fetched WorkspaceStatisticsInstance
89
- def fetch(minutes: :unset, start_date: :unset, end_date: :unset)
91
+ def fetch(minutes: :unset, start_date: :unset, end_date: :unset, task_channel: :unset, split_by_wait_time: :unset)
90
92
  params = Twilio::Values.of({
91
93
  'Minutes' => minutes,
92
94
  'StartDate' => Twilio.serialize_iso8601_datetime(start_date),
93
95
  'EndDate' => Twilio.serialize_iso8601_datetime(end_date),
96
+ 'TaskChannel' => task_channel,
97
+ 'SplitByWaitTime' => split_by_wait_time,
94
98
  })
95
99
 
96
100
  payload = @version.fetch(
@@ -189,12 +193,16 @@ module Twilio
189
193
  # @param [String] minutes The minutes
190
194
  # @param [Time] start_date The start_date
191
195
  # @param [Time] end_date The end_date
196
+ # @param [String] task_channel The task_channel
197
+ # @param [String] split_by_wait_time The split_by_wait_time
192
198
  # @return [WorkspaceStatisticsInstance] Fetched WorkspaceStatisticsInstance
193
- def fetch(minutes: :unset, start_date: :unset, end_date: :unset)
199
+ def fetch(minutes: :unset, start_date: :unset, end_date: :unset, task_channel: :unset, split_by_wait_time: :unset)
194
200
  context.fetch(
195
201
  minutes: minutes,
196
202
  start_date: start_date,
197
203
  end_date: end_date,
204
+ task_channel: task_channel,
205
+ split_by_wait_time: split_by_wait_time,
198
206
  )
199
207
  end
200
208
 
@@ -331,6 +331,7 @@ module Twilio
331
331
  'type' => payload['type'],
332
332
  'max_participants' => payload['max_participants'].to_i,
333
333
  'record_participants_on_connect' => payload['record_participants_on_connect'],
334
+ 'video_codecs' => payload['video_codecs'],
334
335
  'url' => payload['url'],
335
336
  'links' => payload['links'],
336
337
  }
@@ -440,6 +441,12 @@ module Twilio
440
441
  @properties['record_participants_on_connect']
441
442
  end
442
443
 
444
+ ##
445
+ # @return [room.VideoCodec] The video_codecs
446
+ def video_codecs
447
+ @properties['video_codecs']
448
+ end
449
+
443
450
  ##
444
451
  # @return [String] The url
445
452
  def url
@@ -2,7 +2,7 @@ module Twilio
2
2
  module Security
3
3
  class RequestValidator
4
4
  def initialize(auth_token = nil)
5
- @auth_token = auth_token || Twilio.auth_token
5
+ @auth_token = auth_token
6
6
  raise ArgumentError, 'Auth token is required' if @auth_token.nil?
7
7
  end
8
8
 
@@ -1,3 +1,3 @@
1
1
  module Twilio
2
- VERSION = '5.2.3'
2
+ VERSION = '5.3.0'
3
3
  end
@@ -99,17 +99,14 @@ describe 'Message' do
99
99
  expect {
100
100
  @client.chat.v2.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
101
101
  .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
102
- .messages.create(body: "body")
102
+ .messages.create()
103
103
  }.to raise_exception(Twilio::REST::TwilioError)
104
104
 
105
- values = {
106
- 'Body' => "body",
107
- }
105
+ values = {}
108
106
  expect(
109
107
  @holodeck.has_request?(Holodeck::Request.new(
110
108
  method: 'post',
111
109
  url: 'https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages',
112
- data: values,
113
110
  ))).to eq(true)
114
111
  end
115
112
 
@@ -140,7 +137,7 @@ describe 'Message' do
140
137
 
141
138
  actual = @client.chat.v2.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
142
139
  .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
143
- .messages.create(body: "body")
140
+ .messages.create()
144
141
 
145
142
  expect(actual).to_not eq(nil)
146
143
  end
@@ -172,7 +169,44 @@ describe 'Message' do
172
169
 
173
170
  actual = @client.chat.v2.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
174
171
  .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
175
- .messages.create(body: "body")
172
+ .messages.create()
173
+
174
+ expect(actual).to_not eq(nil)
175
+ end
176
+
177
+ it "receives create_media responses" do
178
+ @holodeck.mock(Twilio::Response.new(
179
+ 201,
180
+ %q[
181
+ {
182
+ "sid": "IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
183
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
184
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
185
+ "to": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
186
+ "channel_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
187
+ "attributes": null,
188
+ "date_created": "2016-03-24T20:37:57Z",
189
+ "date_updated": "2016-03-24T20:37:57Z",
190
+ "last_updated_by": "system",
191
+ "was_edited": false,
192
+ "from": "system",
193
+ "body": "Hello",
194
+ "index": 0,
195
+ "type": "text",
196
+ "media": {
197
+ "sid": "MEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
198
+ "size": 99999999999999,
199
+ "content_type": "application/pdf",
200
+ "filename": "hello.pdf"
201
+ },
202
+ "url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
203
+ }
204
+ ]
205
+ ))
206
+
207
+ actual = @client.chat.v2.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
208
+ .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
209
+ .messages.create()
176
210
 
177
211
  expect(actual).to_not eq(nil)
178
212
  end
@@ -47,6 +47,8 @@ describe 'Service' do
47
47
  "notifications": {},
48
48
  "post_webhook_url": "post_webhook_url",
49
49
  "pre_webhook_url": "pre_webhook_url",
50
+ "pre_webhook_retry_count": 2,
51
+ "post_webhook_retry_count": 3,
50
52
  "reachability_enabled": false,
51
53
  "read_status_enabled": false,
52
54
  "sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
@@ -138,6 +140,8 @@ describe 'Service' do
138
140
  "notifications": {},
139
141
  "post_webhook_url": "post_webhook_url",
140
142
  "pre_webhook_url": "pre_webhook_url",
143
+ "pre_webhook_retry_count": 2,
144
+ "post_webhook_retry_count": 3,
141
145
  "reachability_enabled": false,
142
146
  "read_status_enabled": false,
143
147
  "sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
@@ -235,6 +239,8 @@ describe 'Service' do
235
239
  "notifications": {},
236
240
  "post_webhook_url": "post_webhook_url",
237
241
  "pre_webhook_url": "pre_webhook_url",
242
+ "pre_webhook_retry_count": 2,
243
+ "post_webhook_retry_count": 3,
238
244
  "reachability_enabled": false,
239
245
  "read_status_enabled": false,
240
246
  "sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
@@ -317,6 +323,8 @@ describe 'Service' do
317
323
  },
318
324
  "post_webhook_url": "post_webhook_url",
319
325
  "pre_webhook_url": "pre_webhook_url",
326
+ "pre_webhook_retry_count": 2,
327
+ "post_webhook_retry_count": 3,
320
328
  "reachability_enabled": false,
321
329
  "read_status_enabled": false,
322
330
  "sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
@@ -99,17 +99,14 @@ describe 'Message' do
99
99
  expect {
100
100
  @client.ip_messaging.v2.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
101
101
  .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
102
- .messages.create(body: "body")
102
+ .messages.create()
103
103
  }.to raise_exception(Twilio::REST::TwilioError)
104
104
 
105
- values = {
106
- 'Body' => "body",
107
- }
105
+ values = {}
108
106
  expect(
109
107
  @holodeck.has_request?(Holodeck::Request.new(
110
108
  method: 'post',
111
109
  url: 'https://ip-messaging.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages',
112
- data: values,
113
110
  ))).to eq(true)
114
111
  end
115
112
 
@@ -140,7 +137,7 @@ describe 'Message' do
140
137
 
141
138
  actual = @client.ip_messaging.v2.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
142
139
  .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
143
- .messages.create(body: "body")
140
+ .messages.create()
144
141
 
145
142
  expect(actual).to_not eq(nil)
146
143
  end
@@ -172,7 +169,44 @@ describe 'Message' do
172
169
 
173
170
  actual = @client.ip_messaging.v2.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
174
171
  .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
175
- .messages.create(body: "body")
172
+ .messages.create()
173
+
174
+ expect(actual).to_not eq(nil)
175
+ end
176
+
177
+ it "receives create_media responses" do
178
+ @holodeck.mock(Twilio::Response.new(
179
+ 201,
180
+ %q[
181
+ {
182
+ "sid": "IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
183
+ "account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
184
+ "service_sid": "ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
185
+ "to": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
186
+ "channel_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
187
+ "attributes": null,
188
+ "date_created": "2016-03-24T20:37:57Z",
189
+ "date_updated": "2016-03-24T20:37:57Z",
190
+ "last_updated_by": "system",
191
+ "was_edited": false,
192
+ "from": "system",
193
+ "body": "Hello",
194
+ "index": 0,
195
+ "type": "text",
196
+ "media": {
197
+ "sid": "MEaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
198
+ "size": 99999999999999,
199
+ "content_type": "application/pdf",
200
+ "filename": "hello.pdf"
201
+ },
202
+ "url": "https://chat.twilio.com/v2/Services/ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Channels/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/IMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
203
+ }
204
+ ]
205
+ ))
206
+
207
+ actual = @client.ip_messaging.v2.services("ISaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
208
+ .channels("CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa") \
209
+ .messages.create()
176
210
 
177
211
  expect(actual).to_not eq(nil)
178
212
  end