Class: Twilio::REST::Sync::V1::ServiceContext::SyncMapContext::SyncMapItemContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Sync::V1::ServiceContext::SyncMapContext::SyncMapItemContext
- Defined in:
- lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb
Instance Method Summary collapse
-
#delete(if_match: :unset) ⇒ Boolean
Delete the SyncMapItemInstance.
-
#fetch ⇒ SyncMapItemInstance
Fetch the SyncMapItemInstance.
-
#initialize(version, service_sid, map_sid, key) ⇒ SyncMapItemContext
constructor
Initialize the SyncMapItemContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(data: :unset, ttl: :unset, item_ttl: :unset, collection_ttl: :unset, if_match: :unset) ⇒ SyncMapItemInstance
Update the SyncMapItemInstance.
Constructor Details
#initialize(version, service_sid, map_sid, key) ⇒ SyncMapItemContext
Initialize the SyncMapItemContext
198 199 200 201 202 203 204 205 206 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb', line 198 def initialize(version, service_sid, map_sid, key) super(version) # Path Solution @solution = { service_sid: service_sid, map_sid: map_sid, key: key, } @uri = "/Services/#{@solution[:service_sid]}/Maps/#{@solution[:map_sid]}/Items/#{@solution[:key]}" end |
Instance Method Details
#delete(if_match: :unset) ⇒ Boolean
Delete the SyncMapItemInstance
211 212 213 214 215 216 217 218 219 220 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb', line 211 def delete( if_match: :unset ) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'If-Match' => if_match, }) @version.delete('DELETE', @uri, headers: headers) end |
#fetch ⇒ SyncMapItemInstance
Fetch the SyncMapItemInstance
225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb', line 225 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) SyncMapItemInstance.new( @version, payload, service_sid: @solution[:service_sid], map_sid: @solution[:map_sid], key: @solution[:key], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
292 293 294 295 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb', line 292 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Sync.V1.SyncMapItemContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
285 286 287 288 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb', line 285 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Sync.V1.SyncMapItemContext #{context}>" end |
#update(data: :unset, ttl: :unset, item_ttl: :unset, collection_ttl: :unset, if_match: :unset) ⇒ SyncMapItemInstance
Update the SyncMapItemInstance
251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/twilio-ruby/rest/sync/v1/service/sync_map/sync_map_item.rb', line 251 def update( data: :unset, ttl: :unset, item_ttl: :unset, collection_ttl: :unset, if_match: :unset ) data = Twilio::Values.of({ 'Data' => Twilio.serialize_object(data), 'Ttl' => ttl, 'ItemTtl' => item_ttl, 'CollectionTtl' => collection_ttl, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'If-Match' => if_match, }) payload = @version.update('POST', @uri, data: data, headers: headers) SyncMapItemInstance.new( @version, payload, service_sid: @solution[:service_sid], map_sid: @solution[:map_sid], key: @solution[:key], ) end |