lib/twilio-ruby/rest/instance_resource.rb in twilio-ruby-3.4.0 vs lib/twilio-ruby/rest/instance_resource.rb in twilio-ruby-3.4.1
- old
+ new
@@ -36,23 +36,21 @@
#
# After returning, the object will contain the most recent state of the
# instance resource, including the newly updated properties.
def update(params = {})
raise "Can't update a resource without a REST Client" unless @client
- response = @client.post @uri, params
- set_up_properties_from response
+ set_up_properties_from(@client.post(@uri, params))
self
end
##
# Refresh the attributes of this instance resource object by fetching it
# from Twilio. Calling this makes an HTTP GET request to <tt>@uri</tt>.
def refresh
raise "Can't refresh a resource without a REST Client" unless @client
@updated = false
- response = @client.get @uri
- set_up_properties_from response
+ set_up_properties_from(@client.get(@uri))
self
end
##
# Delete an instance resource from Twilio. This operation isn't always
@@ -66,11 +64,10 @@
##
# Lazily load attributes of the instance resource by waiting to fetch it
# until an attempt is made to access an unknown attribute.
def method_missing(method, *args)
super if @updated
- response = @client.get @uri
- set_up_properties_from response
+ set_up_properties_from(@client.get(@uri))
self.send method, *args
end
protected