twilio-ruby 5.28.0 → 5.29.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +5 -5
- data/.travis.yml +11 -6
- data/CHANGES.md +33 -0
- data/README.md +3 -2
- data/lib/twilio-ruby/rest/api/v2010/account/call.rb +18 -20
- data/lib/twilio-ruby/rest/api/v2010/account/call/notification.rb +7 -6
- data/lib/twilio-ruby/rest/api/v2010/account/call/recording.rb +7 -6
- data/lib/twilio-ruby/rest/api/v2010/account/conference/participant.rb +6 -4
- data/lib/twilio-ruby/rest/api/v2010/account/notification.rb +0 -14
- data/lib/twilio-ruby/rest/api/v2010/account/queue.rb +1 -1
- data/lib/twilio-ruby/rest/api/v2010/account/queue/member.rb +6 -4
- data/lib/twilio-ruby/rest/api/v2010/account/recording.rb +9 -6
- data/lib/twilio-ruby/rest/authy.rb +8 -8
- data/lib/twilio-ruby/rest/authy/v1.rb +15 -15
- data/lib/twilio-ruby/rest/conversations/v1/conversation/participant.rb +6 -3
- data/lib/twilio-ruby/rest/flex_api.rb +15 -15
- data/lib/twilio-ruby/rest/flex_api/v1.rb +20 -20
- data/lib/twilio-ruby/rest/messaging.rb +9 -9
- data/lib/twilio-ruby/rest/messaging/v1.rb +13 -13
- data/lib/twilio-ruby/rest/preview.rb +20 -20
- data/lib/twilio-ruby/rest/preview/bulk_exports/export.rb +38 -0
- data/lib/twilio-ruby/rest/preview/bulk_exports/export/export_custom_job.rb +298 -0
- data/lib/twilio-ruby/rest/preview/bulk_exports/export/job.rb +232 -0
- data/lib/twilio-ruby/rest/preview/marketplace.rb +13 -13
- data/lib/twilio-ruby/rest/preview/trusted_comms.rb +14 -14
- data/lib/twilio-ruby/rest/preview/trusted_comms/branded_call.rb +40 -5
- data/lib/twilio-ruby/rest/preview/trusted_comms/cps.rb +7 -7
- data/lib/twilio-ruby/rest/preview/trusted_comms/current_call.rb +51 -51
- data/lib/twilio-ruby/rest/preview/trusted_comms/device.rb +10 -10
- data/lib/twilio-ruby/rest/preview/trusted_comms/phone_call.rb +96 -19
- data/lib/twilio-ruby/rest/sync/v1/service.rb +3 -3
- data/lib/twilio-ruby/rest/sync/v1/service/document/document_permission.rb +8 -2
- data/lib/twilio-ruby/rest/sync/v1/service/sync_list/sync_list_permission.rb +10 -6
- data/lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_permission.rb +10 -6
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/task/reservation.rb +271 -176
- data/lib/twilio-ruby/rest/taskrouter/v1/workspace/worker/reservation.rb +282 -137
- data/lib/twilio-ruby/rest/video.rb +9 -9
- data/lib/twilio-ruby/rest/video/v1.rb +15 -15
- data/lib/twilio-ruby/rest/voice/v1/dialing_permissions.rb +2 -1
- data/lib/twilio-ruby/rest/voice/v1/dialing_permissions/country.rb +9 -7
- data/lib/twilio-ruby/rest/voice/v1/dialing_permissions/settings.rb +3 -3
- data/lib/twilio-ruby/rest/wireless.rb +6 -6
- data/lib/twilio-ruby/rest/wireless/v1.rb +8 -8
- data/lib/twilio-ruby/rest/wireless/v1/command.rb +5 -4
- data/lib/twilio-ruby/rest/wireless/v1/rate_plan.rb +4 -5
- data/lib/twilio-ruby/rest/wireless/v1/sim.rb +114 -98
- data/lib/twilio-ruby/rest/wireless/v1/sim/data_session.rb +4 -4
- data/lib/twilio-ruby/rest/wireless/v1/sim/usage_record.rb +16 -10
- data/lib/twilio-ruby/security/request_validator.rb +61 -8
- data/lib/twilio-ruby/version.rb +1 -1
- data/spec/integration/api/v2010/account/message_spec.rb +4 -4
- data/spec/integration/api/v2010/account/notification_spec.rb +0 -28
- data/spec/integration/conversations/v1/conversation/participant_spec.rb +27 -0
- data/spec/integration/preview/bulk_exports/export/export_custom_job_spec.rb +129 -0
- data/spec/integration/preview/bulk_exports/export/job_spec.rb +77 -0
- data/spec/integration/preview/trusted_comms/branded_call_spec.rb +6 -1
- data/spec/integration/preview/trusted_comms/cps_spec.rb +1 -1
- data/spec/integration/preview/trusted_comms/current_call_spec.rb +10 -10
- data/spec/integration/preview/trusted_comms/device_spec.rb +1 -1
- data/spec/integration/preview/trusted_comms/phone_call_spec.rb +15 -4
- data/spec/integration/wireless/v1/sim_spec.rb +84 -0
- data/spec/security/request_validator_spec.rb +41 -0
- metadata +9 -4
@@ -16,8 +16,8 @@ module Twilio
|
|
16
16
|
# Initialize the DataSessionList
|
17
17
|
# @param [Version] version Version that contains the resource
|
18
18
|
# @param [String] sim_sid The SID of the [Sim
|
19
|
-
# resource](https://www.twilio.com/docs/wireless/api/sim) that the Data
|
20
|
-
# for.
|
19
|
+
# resource](https://www.twilio.com/docs/wireless/api/sim-resource) that the Data
|
20
|
+
# Session is for.
|
21
21
|
# @return [DataSessionList] DataSessionList
|
22
22
|
def initialize(version, sim_sid: nil)
|
23
23
|
super(version)
|
@@ -165,8 +165,8 @@ module Twilio
|
|
165
165
|
# @param [Version] version Version that contains the resource
|
166
166
|
# @param [Hash] payload payload that contains response from Twilio
|
167
167
|
# @param [String] sim_sid The SID of the [Sim
|
168
|
-
# resource](https://www.twilio.com/docs/wireless/api/sim) that the Data
|
169
|
-
# for.
|
168
|
+
# resource](https://www.twilio.com/docs/wireless/api/sim-resource) that the Data
|
169
|
+
# Session is for.
|
170
170
|
# @return [DataSessionInstance] DataSessionInstance
|
171
171
|
def initialize(version, payload, sim_sid: nil)
|
172
172
|
super(version)
|
@@ -16,8 +16,8 @@ module Twilio
|
|
16
16
|
# Initialize the UsageRecordList
|
17
17
|
# @param [Version] version Version that contains the resource
|
18
18
|
# @param [String] sim_sid The SID of the [Sim
|
19
|
-
# resource](https://www.twilio.com/docs/wireless/api/sim) that this Usage
|
20
|
-
# is for.
|
19
|
+
# resource](https://www.twilio.com/docs/wireless/api/sim-resource) that this Usage
|
20
|
+
# Record is for.
|
21
21
|
# @return [UsageRecordList] UsageRecordList
|
22
22
|
def initialize(version, sim_sid: nil)
|
23
23
|
super(version)
|
@@ -33,11 +33,13 @@ module Twilio
|
|
33
33
|
# memory before returning.
|
34
34
|
# @param [Time] end_ Only include usage that occurred on or before this date,
|
35
35
|
# specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html).
|
36
|
+
# The default is the current time.
|
36
37
|
# @param [Time] start Only include usage that has occurred on or after this date,
|
37
38
|
# specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html).
|
39
|
+
# The default is on month before the `end` parameter value.
|
38
40
|
# @param [usage_record.Granularity] granularity How to summarize the usage by
|
39
|
-
# time. Can be: `daily`, `hourly`, or `all`.
|
40
|
-
# Record that describes the usage for the entire period.
|
41
|
+
# time. Can be: `daily`, `hourly`, or `all`. The default is `all`. A value of
|
42
|
+
# `all` returns one Usage Record that describes the usage for the entire period.
|
41
43
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
42
44
|
# guarantees to never return more than limit. Default is no limit
|
43
45
|
# @param [Integer] page_size Number of records to fetch per request, when
|
@@ -61,11 +63,13 @@ module Twilio
|
|
61
63
|
# is reached.
|
62
64
|
# @param [Time] end_ Only include usage that occurred on or before this date,
|
63
65
|
# specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html).
|
66
|
+
# The default is the current time.
|
64
67
|
# @param [Time] start Only include usage that has occurred on or after this date,
|
65
68
|
# specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html).
|
69
|
+
# The default is on month before the `end` parameter value.
|
66
70
|
# @param [usage_record.Granularity] granularity How to summarize the usage by
|
67
|
-
# time. Can be: `daily`, `hourly`, or `all`.
|
68
|
-
# Record that describes the usage for the entire period.
|
71
|
+
# time. Can be: `daily`, `hourly`, or `all`. The default is `all`. A value of
|
72
|
+
# `all` returns one Usage Record that describes the usage for the entire period.
|
69
73
|
# @param [Integer] limit Upper limit for the number of records to return. stream()
|
70
74
|
# guarantees to never return more than limit. Default is no limit.
|
71
75
|
# @param [Integer] page_size Number of records to fetch per request, when
|
@@ -100,11 +104,13 @@ module Twilio
|
|
100
104
|
# Request is executed immediately.
|
101
105
|
# @param [Time] end_ Only include usage that occurred on or before this date,
|
102
106
|
# specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html).
|
107
|
+
# The default is the current time.
|
103
108
|
# @param [Time] start Only include usage that has occurred on or after this date,
|
104
109
|
# specified in [ISO 8601](https://www.iso.org/iso-8601-date-and-time-format.html).
|
110
|
+
# The default is on month before the `end` parameter value.
|
105
111
|
# @param [usage_record.Granularity] granularity How to summarize the usage by
|
106
|
-
# time. Can be: `daily`, `hourly`, or `all`.
|
107
|
-
# Record that describes the usage for the entire period.
|
112
|
+
# time. Can be: `daily`, `hourly`, or `all`. The default is `all`. A value of
|
113
|
+
# `all` returns one Usage Record that describes the usage for the entire period.
|
108
114
|
# @param [String] page_token PageToken provided by the API
|
109
115
|
# @param [Integer] page_number Page Number, this value is simply for client state
|
110
116
|
# @param [Integer] page_size Number of records to return, defaults to 50
|
@@ -181,8 +187,8 @@ module Twilio
|
|
181
187
|
# @param [Version] version Version that contains the resource
|
182
188
|
# @param [Hash] payload payload that contains response from Twilio
|
183
189
|
# @param [String] sim_sid The SID of the [Sim
|
184
|
-
# resource](https://www.twilio.com/docs/wireless/api/sim) that this Usage
|
185
|
-
# is for.
|
190
|
+
# resource](https://www.twilio.com/docs/wireless/api/sim-resource) that this Usage
|
191
|
+
# Record is for.
|
186
192
|
# @return [UsageRecordInstance] UsageRecordInstance
|
187
193
|
def initialize(version, payload, sim_sid: nil)
|
188
194
|
super(version)
|
@@ -25,16 +25,25 @@ module Twilio
|
|
25
25
|
#
|
26
26
|
# @return [Boolean] whether or not the computed signature matches the signature parameter
|
27
27
|
def validate(url, params, signature)
|
28
|
+
parsed_url = URI(url)
|
29
|
+
url_with_port = add_port(parsed_url)
|
30
|
+
url_without_port = remove_port(parsed_url)
|
31
|
+
|
32
|
+
valid_body = true # default succeed, since body not always provided
|
28
33
|
params_hash = body_or_hash(params)
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
body_hash = URI.decode_www_form(URI(url).query).to_h['bodySHA256']
|
35
|
-
expected_hash = build_hash_for(params)
|
36
|
-
secure_compare(expected_signature, signature) && secure_compare(expected_hash, body_hash)
|
34
|
+
unless params_hash.is_a? Enumerable
|
35
|
+
body_hash = URI.decode_www_form(parsed_url.query).to_h['bodySHA256']
|
36
|
+
params_hash = build_hash_for(params)
|
37
|
+
valid_body = !(params_hash.nil? || body_hash.nil?) && secure_compare(params_hash, body_hash)
|
38
|
+
params_hash = {}
|
37
39
|
end
|
40
|
+
|
41
|
+
# Check signature of the url with and without port numbers
|
42
|
+
# since signature generation on the back end is inconsistent
|
43
|
+
valid_signature_with_port = secure_compare(build_signature_for(url_with_port, params_hash), signature)
|
44
|
+
valid_signature_without_port = secure_compare(build_signature_for(url_without_port, params_hash), signature)
|
45
|
+
|
46
|
+
valid_body && (valid_signature_with_port || valid_signature_without_port)
|
38
47
|
end
|
39
48
|
|
40
49
|
##
|
@@ -92,6 +101,50 @@ module Twilio
|
|
92
101
|
params_or_body
|
93
102
|
end
|
94
103
|
end
|
104
|
+
|
105
|
+
##
|
106
|
+
# Adds the standard port to the url if it doesn't already have one
|
107
|
+
#
|
108
|
+
# @param [URI] parsed_url The parsed request url
|
109
|
+
#
|
110
|
+
# @return [String] The URL with a port number
|
111
|
+
def add_port(parsed_url)
|
112
|
+
if parsed_url.port.nil? || parsed_url.port == parsed_url.default_port
|
113
|
+
build_url_with_port_for(parsed_url)
|
114
|
+
else
|
115
|
+
parsed_url.to_s
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
##
|
120
|
+
# Removes the port from the url
|
121
|
+
#
|
122
|
+
# @param [URI] parsed_url The parsed request url
|
123
|
+
#
|
124
|
+
# @return [String] The URL without a port number
|
125
|
+
def remove_port(parsed_url)
|
126
|
+
parsed_url.port = nil
|
127
|
+
parsed_url.to_s
|
128
|
+
end
|
129
|
+
|
130
|
+
##
|
131
|
+
# Builds the url from its component pieces, with the standard port
|
132
|
+
#
|
133
|
+
# @param [URI] parsed_url The parsed request url
|
134
|
+
#
|
135
|
+
# @return [String] The URL with the standard port number
|
136
|
+
def build_url_with_port_for(parsed_url)
|
137
|
+
url = ''
|
138
|
+
|
139
|
+
url += parsed_url.scheme ? "#{parsed_url.scheme}://" : ''
|
140
|
+
url += parsed_url.userinfo ? "#{parsed_url.userinfo}@" : ''
|
141
|
+
url += parsed_url.host ? "#{parsed_url.host}:#{parsed_url.port}" : ''
|
142
|
+
url += parsed_url.path
|
143
|
+
url += parsed_url.query ? "?#{parsed_url.query}" : ''
|
144
|
+
url += parsed_url.fragment ? "##{parsed_url.fragment}" : ''
|
145
|
+
|
146
|
+
url
|
147
|
+
end
|
95
148
|
end
|
96
149
|
end
|
97
150
|
end
|
data/lib/twilio-ruby/version.rb
CHANGED
@@ -44,8 +44,8 @@ describe 'Message' do
|
|
44
44
|
"messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
45
45
|
"num_media": "0",
|
46
46
|
"num_segments": "1",
|
47
|
-
"price":
|
48
|
-
"price_unit":
|
47
|
+
"price": null,
|
48
|
+
"price_unit": null,
|
49
49
|
"sid": "SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
50
50
|
"status": "sent",
|
51
51
|
"subresource_uris": {
|
@@ -81,8 +81,8 @@ describe 'Message' do
|
|
81
81
|
"messaging_service_sid": null,
|
82
82
|
"num_media": "0",
|
83
83
|
"num_segments": "1",
|
84
|
-
"price":
|
85
|
-
"price_unit":
|
84
|
+
"price": null,
|
85
|
+
"price_unit": null,
|
86
86
|
"sid": "SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
87
87
|
"status": "sent",
|
88
88
|
"subresource_uris": {
|
@@ -57,34 +57,6 @@ describe 'Notification' do
|
|
57
57
|
expect(actual).to_not eq(nil)
|
58
58
|
end
|
59
59
|
|
60
|
-
it "can delete" do
|
61
|
-
@holodeck.mock(Twilio::Response.new(500, ''))
|
62
|
-
|
63
|
-
expect {
|
64
|
-
@client.api.v2010.accounts('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
65
|
-
.notifications('NOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
|
66
|
-
}.to raise_exception(Twilio::REST::TwilioError)
|
67
|
-
|
68
|
-
values = {}
|
69
|
-
expect(
|
70
|
-
@holodeck.has_request?(Holodeck::Request.new(
|
71
|
-
method: 'delete',
|
72
|
-
url: 'https://api.twilio.com/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Notifications/NOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json',
|
73
|
-
))).to eq(true)
|
74
|
-
end
|
75
|
-
|
76
|
-
it "receives delete responses" do
|
77
|
-
@holodeck.mock(Twilio::Response.new(
|
78
|
-
204,
|
79
|
-
nil,
|
80
|
-
))
|
81
|
-
|
82
|
-
actual = @client.api.v2010.accounts('ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
83
|
-
.notifications('NOXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
|
84
|
-
|
85
|
-
expect(actual).to eq(true)
|
86
|
-
end
|
87
|
-
|
88
60
|
it "can read" do
|
89
61
|
@holodeck.mock(Twilio::Response.new(500, ''))
|
90
62
|
|
@@ -77,6 +77,33 @@ describe 'Participant' do
|
|
77
77
|
expect(actual).to_not eq(nil)
|
78
78
|
end
|
79
79
|
|
80
|
+
it "receives create_gmms responses" do
|
81
|
+
@holodeck.mock(Twilio::Response.new(
|
82
|
+
201,
|
83
|
+
%q[
|
84
|
+
{
|
85
|
+
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
86
|
+
"conversation_sid": "CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
87
|
+
"sid": "MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
88
|
+
"identity": "IDENTITY",
|
89
|
+
"attributes": "{ \\"role\\": \\"driver\\" }",
|
90
|
+
"messaging_binding": {
|
91
|
+
"type": "sms",
|
92
|
+
"projected_address": "+15017122661"
|
93
|
+
},
|
94
|
+
"date_created": "2015-12-16T22:18:37Z",
|
95
|
+
"date_updated": "2015-12-16T22:18:38Z",
|
96
|
+
"url": "https://conversations.twilio.com/v1/Conversations/CHaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Participants/MBaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"
|
97
|
+
}
|
98
|
+
]
|
99
|
+
))
|
100
|
+
|
101
|
+
actual = @client.conversations.v1.conversations('CHXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX') \
|
102
|
+
.participants.create()
|
103
|
+
|
104
|
+
expect(actual).to_not eq(nil)
|
105
|
+
end
|
106
|
+
|
80
107
|
it "can update" do
|
81
108
|
@holodeck.mock(Twilio::Response.new(500, ''))
|
82
109
|
|
@@ -0,0 +1,129 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
#
|
7
|
+
# frozen_string_literal: true
|
8
|
+
|
9
|
+
require 'spec_helper.rb'
|
10
|
+
|
11
|
+
describe 'ExportCustomJob' do
|
12
|
+
it "can read" do
|
13
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
14
|
+
|
15
|
+
expect {
|
16
|
+
@client.preview.bulk_exports.exports('resource_type') \
|
17
|
+
.export_custom_jobs.list()
|
18
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
19
|
+
|
20
|
+
values = {}
|
21
|
+
expect(
|
22
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
23
|
+
method: 'get',
|
24
|
+
url: 'https://preview.twilio.com/BulkExports/Exports/resource_type/Jobs',
|
25
|
+
))).to eq(true)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "receives read_empty responses" do
|
29
|
+
@holodeck.mock(Twilio::Response.new(
|
30
|
+
200,
|
31
|
+
%q[
|
32
|
+
{
|
33
|
+
"meta": {
|
34
|
+
"previous_page_url": null,
|
35
|
+
"url": "https://preview.twilio.com/BulkExports/Exports/Messages/Jobs?PageSize=50&Page=0",
|
36
|
+
"page_size": 50,
|
37
|
+
"key": "jobs",
|
38
|
+
"first_page_url": "https://preview.twilio.com/BulkExports/Exports/Messages/Jobs?PageSize=50&Page=0",
|
39
|
+
"next_page_url": null,
|
40
|
+
"page": 0
|
41
|
+
},
|
42
|
+
"jobs": []
|
43
|
+
}
|
44
|
+
]
|
45
|
+
))
|
46
|
+
|
47
|
+
actual = @client.preview.bulk_exports.exports('resource_type') \
|
48
|
+
.export_custom_jobs.list()
|
49
|
+
|
50
|
+
expect(actual).to_not eq(nil)
|
51
|
+
end
|
52
|
+
|
53
|
+
it "receives read_full responses" do
|
54
|
+
@holodeck.mock(Twilio::Response.new(
|
55
|
+
200,
|
56
|
+
%q[
|
57
|
+
{
|
58
|
+
"meta": {
|
59
|
+
"previous_page_url": null,
|
60
|
+
"url": "https://preview.twilio.com/BulkExports/Exports/Messages/Jobs?PageSize=50&Page=0",
|
61
|
+
"page_size": 50,
|
62
|
+
"key": "jobs",
|
63
|
+
"first_page_url": "https://preview.twilio.com/BulkExports/Exports/Messages/Jobs?PageSize=50&Page=0",
|
64
|
+
"next_page_url": null,
|
65
|
+
"page": 0
|
66
|
+
},
|
67
|
+
"jobs": [
|
68
|
+
{
|
69
|
+
"start_day": "start_day",
|
70
|
+
"job_sid": "JSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
71
|
+
"friendly_name": "friendly_name",
|
72
|
+
"webhook_method": "webhook_method",
|
73
|
+
"details": {},
|
74
|
+
"end_day": "end_day",
|
75
|
+
"webhook_url": "webhook_url",
|
76
|
+
"email": "email",
|
77
|
+
"resource_type": "resource_type"
|
78
|
+
}
|
79
|
+
]
|
80
|
+
}
|
81
|
+
]
|
82
|
+
))
|
83
|
+
|
84
|
+
actual = @client.preview.bulk_exports.exports('resource_type') \
|
85
|
+
.export_custom_jobs.list()
|
86
|
+
|
87
|
+
expect(actual).to_not eq(nil)
|
88
|
+
end
|
89
|
+
|
90
|
+
it "can create" do
|
91
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
92
|
+
|
93
|
+
expect {
|
94
|
+
@client.preview.bulk_exports.exports('resource_type') \
|
95
|
+
.export_custom_jobs.create()
|
96
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
97
|
+
|
98
|
+
values = {}
|
99
|
+
expect(
|
100
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
101
|
+
method: 'post',
|
102
|
+
url: 'https://preview.twilio.com/BulkExports/Exports/resource_type/Jobs',
|
103
|
+
))).to eq(true)
|
104
|
+
end
|
105
|
+
|
106
|
+
it "receives create responses" do
|
107
|
+
@holodeck.mock(Twilio::Response.new(
|
108
|
+
201,
|
109
|
+
%q[
|
110
|
+
{
|
111
|
+
"start_day": "start_day",
|
112
|
+
"job_sid": "JSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
113
|
+
"friendly_name": "friendly_name",
|
114
|
+
"webhook_method": "webhook_method",
|
115
|
+
"details": {},
|
116
|
+
"end_day": "end_day",
|
117
|
+
"webhook_url": "webhook_url",
|
118
|
+
"email": "email",
|
119
|
+
"resource_type": "resource_type"
|
120
|
+
}
|
121
|
+
]
|
122
|
+
))
|
123
|
+
|
124
|
+
actual = @client.preview.bulk_exports.exports('resource_type') \
|
125
|
+
.export_custom_jobs.create()
|
126
|
+
|
127
|
+
expect(actual).to_not eq(nil)
|
128
|
+
end
|
129
|
+
end
|
@@ -0,0 +1,77 @@
|
|
1
|
+
##
|
2
|
+
# This code was generated by
|
3
|
+
# \ / _ _ _| _ _
|
4
|
+
# | (_)\/(_)(_|\/| |(/_ v1.0.0
|
5
|
+
# / /
|
6
|
+
#
|
7
|
+
# frozen_string_literal: true
|
8
|
+
|
9
|
+
require 'spec_helper.rb'
|
10
|
+
|
11
|
+
describe 'Job' do
|
12
|
+
it "can fetch" do
|
13
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
14
|
+
|
15
|
+
expect {
|
16
|
+
@client.preview.bulk_exports.exports \
|
17
|
+
.jobs('JSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
|
18
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
19
|
+
|
20
|
+
values = {}
|
21
|
+
expect(
|
22
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
23
|
+
method: 'get',
|
24
|
+
url: 'https://preview.twilio.com/BulkExports/Exports/Jobs/JSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
25
|
+
))).to eq(true)
|
26
|
+
end
|
27
|
+
|
28
|
+
it "receives fetch responses" do
|
29
|
+
@holodeck.mock(Twilio::Response.new(
|
30
|
+
200,
|
31
|
+
%q[
|
32
|
+
{
|
33
|
+
"start_day": "start_day",
|
34
|
+
"job_sid": "JSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
35
|
+
"url": "https://preview.twilio.com/BulkExports/Exports/Jobs/JSaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
|
36
|
+
"friendly_name": "friendly_name",
|
37
|
+
"end_day": "end_day",
|
38
|
+
"details": {},
|
39
|
+
"resource_type": "resource_type"
|
40
|
+
}
|
41
|
+
]
|
42
|
+
))
|
43
|
+
|
44
|
+
actual = @client.preview.bulk_exports.exports \
|
45
|
+
.jobs('JSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').fetch()
|
46
|
+
|
47
|
+
expect(actual).to_not eq(nil)
|
48
|
+
end
|
49
|
+
|
50
|
+
it "can delete" do
|
51
|
+
@holodeck.mock(Twilio::Response.new(500, ''))
|
52
|
+
|
53
|
+
expect {
|
54
|
+
@client.preview.bulk_exports.exports \
|
55
|
+
.jobs('JSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
|
56
|
+
}.to raise_exception(Twilio::REST::TwilioError)
|
57
|
+
|
58
|
+
values = {}
|
59
|
+
expect(
|
60
|
+
@holodeck.has_request?(Holodeck::Request.new(
|
61
|
+
method: 'delete',
|
62
|
+
url: 'https://preview.twilio.com/BulkExports/Exports/Jobs/JSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX',
|
63
|
+
))).to eq(true)
|
64
|
+
end
|
65
|
+
|
66
|
+
it "receives delete responses" do
|
67
|
+
@holodeck.mock(Twilio::Response.new(
|
68
|
+
204,
|
69
|
+
nil,
|
70
|
+
))
|
71
|
+
|
72
|
+
actual = @client.preview.bulk_exports.exports \
|
73
|
+
.jobs('JSXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX').delete()
|
74
|
+
|
75
|
+
expect(actual).to eq(true)
|
76
|
+
end
|
77
|
+
end
|