class Twilio::REST::Preview::Sync::ServiceContext::SyncListContext::SyncListItemContext
PLEASE NOTE that this class contains preview products that are subject to change. Use them with caution. If you currently do not have developer preview access, please contact help@twilio.com.
Public Class Methods
Initialize the SyncListItemContext
@param [Version] version Version
that contains the resource @param [String] service_sid The service_sid @param [String] list_sid The list_sid @param [String] index The index @return [SyncListItemContext] SyncListItemContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb 194 def initialize(version, service_sid, list_sid, index) 195 super(version) 196 197 # Path Solution 198 @solution = {service_sid: service_sid, list_sid: list_sid, index: index, } 199 @uri = "/Services/#{@solution[:service_sid]}/Lists/#{@solution[:list_sid]}/Items/#{@solution[:index]}" 200 end
Public Instance Methods
Delete the SyncListItemInstance
@param [String] if_match The If-Match HTTP
request header @return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb 221 def delete(if_match: :unset) 222 headers = Twilio::Values.of({'If-Match' => if_match, }) 223 224 @version.delete('DELETE', @uri, headers: headers) 225 end
Fetch the SyncListItemInstance
@return [SyncListItemInstance] Fetched SyncListItemInstance
# File lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb 205 def fetch 206 payload = @version.fetch('GET', @uri) 207 208 SyncListItemInstance.new( 209 @version, 210 payload, 211 service_sid: @solution[:service_sid], 212 list_sid: @solution[:list_sid], 213 index: @solution[:index], 214 ) 215 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb 256 def inspect 257 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 258 "#<Twilio.Preview.Sync.SyncListItemContext #{context}>" 259 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb 249 def to_s 250 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 251 "#<Twilio.Preview.Sync.SyncListItemContext #{context}>" 252 end
Update the SyncListItemInstance
@param [Hash] data The data @param [String] if_match The If-Match HTTP
request header @return [SyncListItemInstance] Updated SyncListItemInstance
# File lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb 232 def update(data: nil, if_match: :unset) 233 data = Twilio::Values.of({'Data' => Twilio.serialize_object(data), }) 234 headers = Twilio::Values.of({'If-Match' => if_match, }) 235 236 payload = @version.update('POST', @uri, data: data, headers: headers) 237 238 SyncListItemInstance.new( 239 @version, 240 payload, 241 service_sid: @solution[:service_sid], 242 list_sid: @solution[:list_sid], 243 index: @solution[:index], 244 ) 245 end