Skip to content

Commit 8638ae0

Browse files
committed
chore: response headers
1 parent e3d16eb commit 8638ae0

File tree

2 files changed

+35
-0
lines changed

2 files changed

+35
-0
lines changed

lib/twilio-ruby/framework/rest/resource.rb

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,22 @@ def initialize(version)
2121
end
2222

2323
class InstanceResourceMetadata
24+
def initialize(payload, headers, status_code)
25+
@payload = payload
26+
@headers = headers
27+
@status_code = status_code
28+
end
29+
30+
def headers
31+
@headers
32+
end
33+
34+
def status_code
35+
@status_code
36+
end
37+
end
38+
39+
class InstanceListResource
2440
def initialize(version, headers, status_code)
2541
@version = version
2642
@headers = headers
@@ -30,6 +46,7 @@ def initialize(version, headers, status_code)
3046
def headers
3147
@headers
3248
end
49+
3350
def status_code
3451
@status_code
3552
end

lib/twilio-ruby/framework/rest/version.rb

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -217,6 +217,24 @@ def update_with_metadata(method, uri, params: {}, data: {}, headers: {}, auth: n
217217

218218
response
219219
end
220+
221+
def delete_with_metadata(method, uri, params: {}, data: {}, headers: {}, auth: nil, timeout: nil)
222+
response = request(
223+
method,
224+
uri,
225+
params,
226+
data,
227+
headers,
228+
auth,
229+
timeout
230+
)
231+
232+
if response.status_code < 200 || response.status_code >= 400
233+
raise exception(response, 'Unable to delete record')
234+
end
235+
236+
response
237+
end
220238
end
221239
end
222240
end

0 commit comments

Comments
 (0)