class Twilio::REST::Sync::V1::ServiceContext::SyncListContext
Public Class Methods
Initialize the SyncListContext
@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 List resource to fetch.
@param [String] sid The SID of the Sync
List resource to fetch. Can be the Sync
List resource's `sid` or its `unique_name`.
@return [SyncListContext] SyncListContext
Twilio::REST::InstanceContext::new
# File lib/twilio-ruby/rest/sync/v1/service/sync_list.rb 180 def initialize(version, service_sid, sid) 181 super(version) 182 183 # Path Solution 184 @solution = {service_sid: service_sid, sid: sid, } 185 @uri = "/Services/#{@solution[:service_sid]}/Lists/#{@solution[:sid]}" 186 187 # Dependents 188 @sync_list_items = nil 189 @sync_list_permissions = nil 190 end
Public Instance Methods
Delete the SyncListInstance
@return [Boolean] true if delete succeeds, false otherwise
# File lib/twilio-ruby/rest/sync/v1/service/sync_list.rb 204 def delete 205 @version.delete('DELETE', @uri) 206 end
Fetch the SyncListInstance
@return [SyncListInstance] Fetched SyncListInstance
# File lib/twilio-ruby/rest/sync/v1/service/sync_list.rb 195 def fetch 196 payload = @version.fetch('GET', @uri) 197 198 SyncListInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) 199 end
Provide a detailed, user friendly representation
# File lib/twilio-ruby/rest/sync/v1/service/sync_list.rb 277 def inspect 278 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 279 "#<Twilio.Sync.V1.SyncListContext #{context}>" 280 end
Access the sync_list_items
@return [SyncListItemList] @return [SyncListItemContext] if index was passed.
# File lib/twilio-ruby/rest/sync/v1/service/sync_list.rb 228 def sync_list_items(index=:unset) 229 raise ArgumentError, 'index cannot be nil' if index.nil? 230 231 if index != :unset 232 return SyncListItemContext.new(@version, @solution[:service_sid], @solution[:sid], index, ) 233 end 234 235 unless @sync_list_items 236 @sync_list_items = SyncListItemList.new( 237 @version, 238 service_sid: @solution[:service_sid], 239 list_sid: @solution[:sid], 240 ) 241 end 242 243 @sync_list_items 244 end
Access the sync_list_permissions
@return [SyncListPermissionList] @return [SyncListPermissionContext] if identity was passed.
# File lib/twilio-ruby/rest/sync/v1/service/sync_list.rb 250 def sync_list_permissions(identity=:unset) 251 raise ArgumentError, 'identity cannot be nil' if identity.nil? 252 253 if identity != :unset 254 return SyncListPermissionContext.new(@version, @solution[:service_sid], @solution[:sid], identity, ) 255 end 256 257 unless @sync_list_permissions 258 @sync_list_permissions = SyncListPermissionList.new( 259 @version, 260 service_sid: @solution[:service_sid], 261 list_sid: @solution[:sid], 262 ) 263 end 264 265 @sync_list_permissions 266 end
Provide a user friendly representation
# File lib/twilio-ruby/rest/sync/v1/service/sync_list.rb 270 def to_s 271 context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') 272 "#<Twilio.Sync.V1.SyncListContext #{context}>" 273 end
Update the SyncListInstance
@param [String] ttl An alias for `collection_ttl`. If both 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 List expires (time-to-live) and is deleted.
@return [SyncListInstance] Updated SyncListInstance
# File lib/twilio-ruby/rest/sync/v1/service/sync_list.rb 216 def update(ttl: :unset, collection_ttl: :unset) 217 data = Twilio::Values.of({'Ttl' => ttl, 'CollectionTtl' => collection_ttl, }) 218 219 payload = @version.update('POST', @uri, data: data) 220 221 SyncListInstance.new(@version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) 222 end