class Twilio::REST::Sync::V1::ServiceContext::SyncMapContext

Public Class Methods

new(version, service_sid, sid) click to toggle source

Initialize the SyncMapContext @param [Version] version Version that contains the resource @param [String] service_sid The SID of the {Sync

Service}[https://www.twilio.com/docs/sync/api/service] with the Sync Map
resource to fetch.

@param [String] sid The SID of the Sync Map resource to fetch. Can be the Sync

Map's `sid` or its `unique_name`.

@return [SyncMapContext] SyncMapContext

Calls superclass method Twilio::REST::InstanceContext::new
    # File lib/twilio-ruby/rest/sync/v1/service/sync_map.rb
179 def initialize(version, service_sid, sid)
180   super(version)
181 
182   # Path Solution
183   @solution = {service_sid: service_sid, sid: sid, }
184   @uri = "/Services/#{@solution[:service_sid]}/Maps/#{@solution[:sid]}"
185 
186   # Dependents
187   @sync_map_items = nil
188   @sync_map_permissions = nil
189 end

Public Instance Methods

delete() click to toggle source

Delete the SyncMapInstance @return [Boolean] true if delete succeeds, false otherwise

    # File lib/twilio-ruby/rest/sync/v1/service/sync_map.rb
203 def delete
204    @version.delete('DELETE', @uri)
205 end
fetch() click to toggle source

Fetch the SyncMapInstance @return [SyncMapInstance] Fetched SyncMapInstance

    # File lib/twilio-ruby/rest/sync/v1/service/sync_map.rb
194 def fetch
195   payload = @version.fetch('GET', @uri)
196 
197   SyncMapInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], )
198 end
inspect() click to toggle source

Provide a detailed, user friendly representation

    # File lib/twilio-ruby/rest/sync/v1/service/sync_map.rb
276 def inspect
277   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
278   "#<Twilio.Sync.V1.SyncMapContext #{context}>"
279 end
sync_map_items(key=:unset) click to toggle source

Access the sync_map_items @return [SyncMapItemList] @return [SyncMapItemContext] if key was passed.

    # File lib/twilio-ruby/rest/sync/v1/service/sync_map.rb
227 def sync_map_items(key=:unset)
228   raise ArgumentError, 'key cannot be nil' if key.nil?
229 
230   if key != :unset
231     return SyncMapItemContext.new(@version, @solution[:service_sid], @solution[:sid], key, )
232   end
233 
234   unless @sync_map_items
235     @sync_map_items = SyncMapItemList.new(
236         @version,
237         service_sid: @solution[:service_sid],
238         map_sid: @solution[:sid],
239     )
240   end
241 
242   @sync_map_items
243 end
sync_map_permissions(identity=:unset) click to toggle source

Access the sync_map_permissions @return [SyncMapPermissionList] @return [SyncMapPermissionContext] if identity was passed.

    # File lib/twilio-ruby/rest/sync/v1/service/sync_map.rb
249 def sync_map_permissions(identity=:unset)
250   raise ArgumentError, 'identity cannot be nil' if identity.nil?
251 
252   if identity != :unset
253     return SyncMapPermissionContext.new(@version, @solution[:service_sid], @solution[:sid], identity, )
254   end
255 
256   unless @sync_map_permissions
257     @sync_map_permissions = SyncMapPermissionList.new(
258         @version,
259         service_sid: @solution[:service_sid],
260         map_sid: @solution[:sid],
261     )
262   end
263 
264   @sync_map_permissions
265 end
to_s() click to toggle source

Provide a user friendly representation

    # File lib/twilio-ruby/rest/sync/v1/service/sync_map.rb
269 def to_s
270   context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
271   "#<Twilio.Sync.V1.SyncMapContext #{context}>"
272 end
update(ttl: :unset, collection_ttl: :unset) click to toggle source

Update the SyncMapInstance @param [String] ttl An alias for `collection_ttl`. If both parameters are

provided, this value is ignored.

@param [String] collection_ttl How long, {in

seconds}[https://www.twilio.com/docs/sync/limits#sync-payload-limits], before
the Sync Map expires (time-to-live) and is deleted.

@return [SyncMapInstance] Updated SyncMapInstance

    # File lib/twilio-ruby/rest/sync/v1/service/sync_map.rb
215 def update(ttl: :unset, collection_ttl: :unset)
216   data = Twilio::Values.of({'Ttl' => ttl, 'CollectionTtl' => collection_ttl, })
217 
218   payload = @version.update('POST', @uri, data: data)
219 
220   SyncMapInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], )
221 end