Class: Twilio::REST::Preview::Sync::ServiceContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Preview::Sync::ServiceContext
- Defined in:
- lib/twilio-ruby/rest/preview/sync/service.rb,
lib/twilio-ruby/rest/preview/sync/service/document.rb,
lib/twilio-ruby/rest/preview/sync/service/sync_map.rb,
lib/twilio-ruby/rest/preview/sync/service/sync_list.rb,
lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb,
lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb,
lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb,
lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_permission.rb,
lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_permission.rb
Overview
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 [email protected].
Defined Under Namespace
Classes: DocumentContext, DocumentInstance, DocumentList, DocumentPage, SyncListContext, SyncListInstance, SyncListList, SyncListPage, SyncMapContext, SyncMapInstance, SyncMapList, SyncMapPage
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the ServiceInstance.
-
#documents(sid = :unset) ⇒ DocumentList, DocumentContext
Access the documents.
-
#fetch ⇒ ServiceInstance
Fetch the ServiceInstance.
-
#initialize(version, sid) ⇒ ServiceContext
constructor
Initialize the ServiceContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#sync_lists(sid = :unset) ⇒ SyncListList, SyncListContext
Access the sync_lists.
-
#sync_maps(sid = :unset) ⇒ SyncMapList, SyncMapContext
Access the sync_maps.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(webhook_url: :unset, friendly_name: :unset, reachability_webhooks_enabled: :unset, acl_enabled: :unset) ⇒ ServiceInstance
Update the ServiceInstance.
Constructor Details
#initialize(version, sid) ⇒ ServiceContext
Initialize the ServiceContext
162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 162 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Services/#{@solution[:sid]}" # Dependents @sync_lists = nil @sync_maps = nil @documents = nil end |
Instance Method Details
#delete ⇒ Boolean
Delete the ServiceInstance
177 178 179 180 |
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 177 def delete @version.delete('DELETE', @uri) end |
#documents(sid = :unset) ⇒ DocumentList, DocumentContext
Access the documents
266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 |
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 266 def documents(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return DocumentContext.new(@version, @solution[:sid],sid ) end unless @documents @documents = DocumentList.new( @version, service_sid: @solution[:sid], ) end @documents end |
#fetch ⇒ ServiceInstance
Fetch the ServiceInstance
185 186 187 188 189 190 191 192 193 |
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 185 def fetch payload = @version.fetch('GET', @uri) ServiceInstance.new( @version, payload, sid: @solution[:sid], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
291 292 293 294 |
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 291 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Preview.Sync.ServiceContext #{context}>" end |
#sync_lists(sid = :unset) ⇒ SyncListList, SyncListContext
Access the sync_lists
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 |
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 228 def sync_lists(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return SyncListContext.new(@version, @solution[:sid],sid ) end unless @sync_lists @sync_lists = SyncListList.new( @version, service_sid: @solution[:sid], ) end @sync_lists end |
#sync_maps(sid = :unset) ⇒ SyncMapList, SyncMapContext
Access the sync_maps
247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 |
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 247 def sync_maps(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return SyncMapContext.new(@version, @solution[:sid],sid ) end unless @sync_maps @sync_maps = SyncMapList.new( @version, service_sid: @solution[:sid], ) end @sync_maps end |
#to_s ⇒ Object
Provide a user friendly representation
284 285 286 287 |
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 284 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Preview.Sync.ServiceContext #{context}>" end |
#update(webhook_url: :unset, friendly_name: :unset, reachability_webhooks_enabled: :unset, acl_enabled: :unset) ⇒ ServiceInstance
Update the ServiceInstance
202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 |
# File 'lib/twilio-ruby/rest/preview/sync/service.rb', line 202 def update( webhook_url: :unset, friendly_name: :unset, reachability_webhooks_enabled: :unset, acl_enabled: :unset ) data = Twilio::Values.of({ 'WebhookUrl' => webhook_url, 'FriendlyName' => friendly_name, 'ReachabilityWebhooksEnabled' => reachability_webhooks_enabled, 'AclEnabled' => acl_enabled, }) payload = @version.update('POST', @uri, data: data) ServiceInstance.new( @version, payload, sid: @solution[:sid], ) end |