class Twilio::REST::Preview::Sync::ServiceContext::SyncMapContext::SyncMapItemContext
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 SyncMapItemContext
@param [Version] version Version
that contains the resource @param [String] service_sid The service_sid @param [String] map_sid The map_sid @param [String] key The key @return [SyncMapItemContext] SyncMapItemContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb 195 def initialize(version, service_sid, map_sid, key) 196 super(version) 197 198 # Path Solution 199 @solution = {service_sid: service_sid, map_sid: map_sid, key: key, } 200 @uri = "/Services/#{@solution[:service_sid]}/Maps/#{@solution[:map_sid]}/Items/#{@solution[:key]}" 201 end
Public Instance Methods
Delete the SyncMapItemInstance
@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_map/sync_map_item.rb 222 def delete(if_match: :unset) 223 headers = Twilio::Values.of({'If-Match' => if_match, }) 224 225 @version.delete('DELETE', @uri, headers: headers) 226 end
Fetch the SyncMapItemInstance
@return [SyncMapItemInstance] Fetched SyncMapItemInstance
# File lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb 206 def fetch 207 payload = @version.fetch('GET', @uri) 208 209 SyncMapItemInstance.new( 210 @version, 211 payload, 212 service_sid: @solution[:service_sid], 213 map_sid: @solution[:map_sid], 214 key: @solution[:key], 215 ) 216 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb 257 def inspect 258 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 259 "#<Twilio.Preview.Sync.SyncMapItemContext #{context}>" 260 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb 250 def to_s 251 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 252 "#<Twilio.Preview.Sync.SyncMapItemContext #{context}>" 253 end
Update the SyncMapItemInstance
@param [Hash] data The data @param [String] if_match The If-Match HTTP
request header @return [SyncMapItemInstance] Updated SyncMapItemInstance
# File lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb 233 def update(data: nil, if_match: :unset) 234 data = Twilio::Values.of({'Data' => Twilio.serialize_object(data), }) 235 headers = Twilio::Values.of({'If-Match' => if_match, }) 236 237 payload = @version.update('POST', @uri, data: data, headers: headers) 238 239 SyncMapItemInstance.new( 240 @version, 241 payload, 242 service_sid: @solution[:service_sid], 243 map_sid: @solution[:map_sid], 244 key: @solution[:key], 245 ) 246 end