diff --git a/lib/twilio-ruby/rest/preview.rb b/lib/twilio-ruby/rest/preview.rb index 39ff48698..d616f5060 100644 --- a/lib/twilio-ruby/rest/preview.rb +++ b/lib/twilio-ruby/rest/preview.rb @@ -52,15 +52,6 @@ def installed_add_ons(sid=:unset) self.marketplace.installed_add_ons(sid) end - ## - # @param [String] sid The sid - # @return [Twilio::REST::Preview::Sync::ServiceInstance] if sid was passed. - # @return [Twilio::REST::Preview::Sync::ServiceList] - def services(sid=:unset) - warn "services is deprecated. Use sync.services instead." - self.sync.services(sid) - end - ## # @param [String] sid The sid # @return [Twilio::REST::Preview::Wireless::CommandInstance] if sid was passed. diff --git a/lib/twilio-ruby/rest/preview/sync.rb b/lib/twilio-ruby/rest/preview/sync.rb deleted file mode 100644 index d057e9628..000000000 --- a/lib/twilio-ruby/rest/preview/sync.rb +++ /dev/null @@ -1,49 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Preview -# This is the public Twilio REST API. -# -# NOTE: This class is auto generated by OpenAPI Generator. -# https://openapi-generator.tech -# Do not edit the class manually. -# - -module Twilio - module REST - class Preview - class Sync < Version - ## - # Initialize the Sync version of Preview - def initialize(domain) - super - @version = 'Sync' - @services = nil - end - - ## - # @param [String] sid - # @return [Twilio::REST::Preview::Sync::ServiceContext] if sid was passed. - # @return [Twilio::REST::Preview::Sync::ServiceList] - def services(sid=:unset) - if sid.nil? - raise ArgumentError, 'sid cannot be nil' - end - if sid == :unset - @services ||= ServiceList.new self - else - ServiceContext.new(self, sid) - end - end - ## - # Provide a user friendly representation - def to_s - ''; - end - end - end - end -end diff --git a/lib/twilio-ruby/rest/preview/sync/service.rb b/lib/twilio-ruby/rest/preview/sync/service.rb deleted file mode 100644 index 7f3f48e49..000000000 --- a/lib/twilio-ruby/rest/preview/sync/service.rb +++ /dev/null @@ -1,512 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Preview -# This is the public Twilio REST API. -# -# NOTE: This class is auto generated by OpenAPI Generator. -# https://openapi-generator.tech -# Do not edit the class manually. -# - - -module Twilio - module REST - class Preview < PreviewBase - class Sync < Version - class ServiceList < ListResource - - ## - # Initialize the ServiceList - # @param [Version] version Version that contains the resource - # @return [ServiceList] ServiceList - def initialize(version) - super(version) - # Path Solution - @solution = { } - @uri = "/Services" - - end - ## - # Create the ServiceInstance - # @param [String] friendly_name - # @param [String] webhook_url - # @param [Boolean] reachability_webhooks_enabled - # @param [Boolean] acl_enabled - # @return [ServiceInstance] Created ServiceInstance - def create( - friendly_name: :unset, - webhook_url: :unset, - reachability_webhooks_enabled: :unset, - acl_enabled: :unset - ) - - data = Twilio::Values.of({ - 'FriendlyName' => friendly_name, - 'WebhookUrl' => webhook_url, - 'ReachabilityWebhooksEnabled' => reachability_webhooks_enabled, - 'AclEnabled' => acl_enabled, - }) - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - payload = @version.create('POST', @uri, data: data, headers: headers) - ServiceInstance.new( - @version, - payload, - ) - end - - - ## - # Lists ServiceInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @param [Integer] limit Upper limit for the number of records to return. stream() - # guarantees to never return more than limit. Default is no limit - # @param [Integer] page_size Number of records to fetch per request, when - # not set will use the default value of 50 records. If no page_size is defined - # but a limit is defined, stream() will attempt to read the limit with the most - # efficient page size, i.e. min(limit, 1000) - # @return [Array] Array of up to limit results - def list(limit: nil, page_size: nil) - self.stream( - limit: limit, - page_size: page_size - ).entries - end - - ## - # Streams Instance records from the API as an Enumerable. - # This operation lazily loads records as efficiently as possible until the limit - # is reached. - # @param [Integer] limit Upper limit for the number of records to return. stream() - # guarantees to never return more than limit. Default is no limit - # @param [Integer] page_size Number of records to fetch per request, when - # not set will use the default value of 50 records. If no page_size is defined - # but a limit is defined, stream() will attempt to read the limit with the most - # efficient page size, i.e. min(limit, 1000) - # @return [Enumerable] Enumerable that will yield up to limit results - def stream(limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields ServiceInstance records from the API. - # This operation lazily loads records as efficiently as possible until the limit - # is reached. - def each - limits = @version.read_limits - - page = self.page(page_size: limits[:page_size], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of ServiceInstance records from the API. - # Request is executed immediately. - # @param [String] page_token PageToken provided by the API - # @param [Integer] page_number Page Number, this value is simply for client state - # @param [Integer] page_size Number of records to return, defaults to 50 - # @return [Page] Page of ServiceInstance - def page(page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - ServicePage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of ServiceInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of ServiceInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - ServicePage.new(@version, response, @solution) - end - - - - # Provide a user friendly representation - def to_s - '#' - end - end - - - class ServiceContext < InstanceContext - ## - # Initialize the ServiceContext - # @param [Version] version Version that contains the resource - # @param [String] sid - # @return [ServiceContext] ServiceContext - def initialize(version, sid) - super(version) - - # Path Solution - @solution = { sid: sid, } - @uri = "/Services/#{@solution[:sid]}" - - # Dependents - @sync_maps = nil - @documents = nil - @sync_lists = nil - end - ## - # Delete the ServiceInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - @version.delete('DELETE', @uri, headers: headers) - end - - ## - # Fetch the ServiceInstance - # @return [ServiceInstance] Fetched ServiceInstance - def fetch - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - payload = @version.fetch('GET', @uri, headers: headers) - ServiceInstance.new( - @version, - payload, - sid: @solution[:sid], - ) - end - - ## - # Update the ServiceInstance - # @param [String] webhook_url - # @param [String] friendly_name - # @param [Boolean] reachability_webhooks_enabled - # @param [Boolean] acl_enabled - # @return [ServiceInstance] Updated ServiceInstance - 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, - }) - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - payload = @version.update('POST', @uri, data: data, headers: headers) - ServiceInstance.new( - @version, - payload, - sid: @solution[:sid], - ) - end - - ## - # Access the sync_maps - # @return [SyncMapList] - # @return [SyncMapContext] if sid was passed. - 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, ) - end - - @sync_maps - end - ## - # Access the documents - # @return [DocumentList] - # @return [DocumentContext] if sid was passed. - 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 - ## - # Access the sync_lists - # @return [SyncListList] - # @return [SyncListContext] if sid was passed. - 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, ) - end - - @sync_lists - end - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class ServicePage < Page - ## - # Initialize the ServicePage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [ServicePage] ServicePage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of ServiceInstance - # @param [Hash] payload Payload response from the API - # @return [ServiceInstance] ServiceInstance - def get_instance(payload) - ServiceInstance.new(@version, payload) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class ServiceInstance < InstanceResource - ## - # Initialize the ServiceInstance - # @param [Version] version Version that contains the resource - # @param [Hash] payload payload that contains response from Twilio - # @param [String] account_sid The SID of the - # {Account}[https://www.twilio.com/docs/iam/api/account] that created this Service - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [ServiceInstance] ServiceInstance - def initialize(version, payload , sid: nil) - super(version) - - # Marshaled Properties - @properties = { - 'sid' => payload['sid'], - 'account_sid' => payload['account_sid'], - 'friendly_name' => payload['friendly_name'], - 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), - 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), - 'url' => payload['url'], - 'webhook_url' => payload['webhook_url'], - 'reachability_webhooks_enabled' => payload['reachability_webhooks_enabled'], - 'acl_enabled' => payload['acl_enabled'], - 'links' => payload['links'], - } - - # Context - @instance_context = nil - @params = { 'sid' => sid || @properties['sid'] , } - end - - ## - # Generate an instance context for the instance, the context is capable of - # performing various actions. All instance actions are proxied to the context - # @return [ServiceContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = ServiceContext.new(@version , @params['sid']) - end - @instance_context - end - - ## - # @return [String] - def sid - @properties['sid'] - end - - ## - # @return [String] - def account_sid - @properties['account_sid'] - end - - ## - # @return [String] - def friendly_name - @properties['friendly_name'] - end - - ## - # @return [Time] - def date_created - @properties['date_created'] - end - - ## - # @return [Time] - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] - def url - @properties['url'] - end - - ## - # @return [String] - def webhook_url - @properties['webhook_url'] - end - - ## - # @return [Boolean] - def reachability_webhooks_enabled - @properties['reachability_webhooks_enabled'] - end - - ## - # @return [Boolean] - def acl_enabled - @properties['acl_enabled'] - end - - ## - # @return [Hash] - def links - @properties['links'] - end - - ## - # Delete the ServiceInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the ServiceInstance - # @return [ServiceInstance] Fetched ServiceInstance - def fetch - - context.fetch - end - - ## - # Update the ServiceInstance - # @param [String] webhook_url - # @param [String] friendly_name - # @param [Boolean] reachability_webhooks_enabled - # @param [Boolean] acl_enabled - # @return [ServiceInstance] Updated ServiceInstance - def update( - webhook_url: :unset, - friendly_name: :unset, - reachability_webhooks_enabled: :unset, - acl_enabled: :unset - ) - - context.update( - webhook_url: webhook_url, - friendly_name: friendly_name, - reachability_webhooks_enabled: reachability_webhooks_enabled, - acl_enabled: acl_enabled, - ) - end - - ## - # Access the sync_maps - # @return [sync_maps] sync_maps - def sync_maps - context.sync_maps - end - - ## - # Access the documents - # @return [documents] documents - def documents - context.documents - end - - ## - # Access the sync_lists - # @return [sync_lists] sync_lists - def sync_lists - context.sync_lists - end - - ## - # Provide a user friendly representation - def to_s - values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") - "" - end - - ## - # Provide a detailed, user friendly representation - def inspect - values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") - "" - end - end - - end - end - end -end diff --git a/lib/twilio-ruby/rest/preview/sync/service/document.rb b/lib/twilio-ruby/rest/preview/sync/service/document.rb deleted file mode 100644 index 914427a07..000000000 --- a/lib/twilio-ruby/rest/preview/sync/service/document.rb +++ /dev/null @@ -1,455 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Preview -# This is the public Twilio REST API. -# -# NOTE: This class is auto generated by OpenAPI Generator. -# https://openapi-generator.tech -# Do not edit the class manually. -# - - -module Twilio - module REST - class Preview < PreviewBase - class Sync < Version - class ServiceContext < InstanceContext - - class DocumentList < ListResource - - ## - # Initialize the DocumentList - # @param [Version] version Version that contains the resource - # @return [DocumentList] DocumentList - def initialize(version, service_sid: nil) - super(version) - # Path Solution - @solution = { service_sid: service_sid } - @uri = "/Services/#{@solution[:service_sid]}/Documents" - - end - ## - # Create the DocumentInstance - # @param [String] unique_name - # @param [Object] data - # @return [DocumentInstance] Created DocumentInstance - def create( - unique_name: :unset, - data: :unset - ) - - data = Twilio::Values.of({ - 'UniqueName' => unique_name, - 'Data' => Twilio.serialize_object(data), - }) - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - payload = @version.create('POST', @uri, data: data, headers: headers) - DocumentInstance.new( - @version, - payload, - service_sid: @solution[:service_sid], - ) - end - - - ## - # Lists DocumentInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @param [Integer] limit Upper limit for the number of records to return. stream() - # guarantees to never return more than limit. Default is no limit - # @param [Integer] page_size Number of records to fetch per request, when - # not set will use the default value of 50 records. If no page_size is defined - # but a limit is defined, stream() will attempt to read the limit with the most - # efficient page size, i.e. min(limit, 1000) - # @return [Array] Array of up to limit results - def list(limit: nil, page_size: nil) - self.stream( - limit: limit, - page_size: page_size - ).entries - end - - ## - # Streams Instance records from the API as an Enumerable. - # This operation lazily loads records as efficiently as possible until the limit - # is reached. - # @param [Integer] limit Upper limit for the number of records to return. stream() - # guarantees to never return more than limit. Default is no limit - # @param [Integer] page_size Number of records to fetch per request, when - # not set will use the default value of 50 records. If no page_size is defined - # but a limit is defined, stream() will attempt to read the limit with the most - # efficient page size, i.e. min(limit, 1000) - # @return [Enumerable] Enumerable that will yield up to limit results - def stream(limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields DocumentInstance records from the API. - # This operation lazily loads records as efficiently as possible until the limit - # is reached. - def each - limits = @version.read_limits - - page = self.page(page_size: limits[:page_size], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of DocumentInstance records from the API. - # Request is executed immediately. - # @param [String] page_token PageToken provided by the API - # @param [Integer] page_number Page Number, this value is simply for client state - # @param [Integer] page_size Number of records to return, defaults to 50 - # @return [Page] Page of DocumentInstance - def page(page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - DocumentPage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of DocumentInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of DocumentInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - DocumentPage.new(@version, response, @solution) - end - - - - # Provide a user friendly representation - def to_s - '#' - end - end - - - class DocumentContext < InstanceContext - ## - # Initialize the DocumentContext - # @param [Version] version Version that contains the resource - # @param [String] service_sid - # @param [String] sid - # @return [DocumentContext] DocumentContext - def initialize(version, service_sid, sid) - super(version) - - # Path Solution - @solution = { service_sid: service_sid, sid: sid, } - @uri = "/Services/#{@solution[:service_sid]}/Documents/#{@solution[:sid]}" - - # Dependents - @document_permissions = nil - end - ## - # Delete the DocumentInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - @version.delete('DELETE', @uri, headers: headers) - end - - ## - # Fetch the DocumentInstance - # @return [DocumentInstance] Fetched DocumentInstance - def fetch - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - payload = @version.fetch('GET', @uri, headers: headers) - DocumentInstance.new( - @version, - payload, - service_sid: @solution[:service_sid], - sid: @solution[:sid], - ) - end - - ## - # Update the DocumentInstance - # @param [Object] data - # @param [String] if_match The If-Match HTTP request header - # @return [DocumentInstance] Updated DocumentInstance - def update( - data: nil, - if_match: :unset - ) - - data = Twilio::Values.of({ - 'Data' => Twilio.serialize_object(data), - }) - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'If-Match' => if_match, }) - - payload = @version.update('POST', @uri, data: data, headers: headers) - DocumentInstance.new( - @version, - payload, - service_sid: @solution[:service_sid], - sid: @solution[:sid], - ) - end - - ## - # Access the document_permissions - # @return [DocumentPermissionList] - # @return [DocumentPermissionContext] if sid was passed. - def document_permissions(identity=:unset) - - raise ArgumentError, 'identity cannot be nil' if identity.nil? - - if identity != :unset - return DocumentPermissionContext.new(@version, @solution[:service_sid], @solution[:sid],identity ) - end - - unless @document_permissions - @document_permissions = DocumentPermissionList.new( - @version, ) - end - - @document_permissions - end - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class DocumentPage < Page - ## - # Initialize the DocumentPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [DocumentPage] DocumentPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of DocumentInstance - # @param [Hash] payload Payload response from the API - # @return [DocumentInstance] DocumentInstance - def get_instance(payload) - DocumentInstance.new(@version, payload, service_sid: @solution[:service_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class DocumentInstance < InstanceResource - ## - # Initialize the DocumentInstance - # @param [Version] version Version that contains the resource - # @param [Hash] payload payload that contains response from Twilio - # @param [String] account_sid The SID of the - # {Account}[https://www.twilio.com/docs/iam/api/account] that created this Document - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [DocumentInstance] DocumentInstance - def initialize(version, payload , service_sid: nil, sid: nil) - super(version) - - # Marshaled Properties - @properties = { - 'sid' => payload['sid'], - 'unique_name' => payload['unique_name'], - 'account_sid' => payload['account_sid'], - 'service_sid' => payload['service_sid'], - 'url' => payload['url'], - 'links' => payload['links'], - 'revision' => payload['revision'], - 'data' => payload['data'], - 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), - 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), - 'created_by' => payload['created_by'], - } - - # Context - @instance_context = nil - @params = { 'service_sid' => service_sid || @properties['service_sid'] ,'sid' => sid || @properties['sid'] , } - end - - ## - # Generate an instance context for the instance, the context is capable of - # performing various actions. All instance actions are proxied to the context - # @return [DocumentContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = DocumentContext.new(@version , @params['service_sid'], @params['sid']) - end - @instance_context - end - - ## - # @return [String] - def sid - @properties['sid'] - end - - ## - # @return [String] - def unique_name - @properties['unique_name'] - end - - ## - # @return [String] - def account_sid - @properties['account_sid'] - end - - ## - # @return [String] - def service_sid - @properties['service_sid'] - end - - ## - # @return [String] - def url - @properties['url'] - end - - ## - # @return [Hash] - def links - @properties['links'] - end - - ## - # @return [String] - def revision - @properties['revision'] - end - - ## - # @return [Hash] - def data - @properties['data'] - end - - ## - # @return [Time] - def date_created - @properties['date_created'] - end - - ## - # @return [Time] - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] - def created_by - @properties['created_by'] - end - - ## - # Delete the DocumentInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the DocumentInstance - # @return [DocumentInstance] Fetched DocumentInstance - def fetch - - context.fetch - end - - ## - # Update the DocumentInstance - # @param [Object] data - # @param [String] if_match The If-Match HTTP request header - # @return [DocumentInstance] Updated DocumentInstance - def update( - data: nil, - if_match: :unset - ) - - context.update( - data: data, - if_match: if_match, - ) - end - - ## - # Access the document_permissions - # @return [document_permissions] document_permissions - def document_permissions - context.document_permissions - end - - ## - # Provide a user friendly representation - def to_s - values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") - "" - end - - ## - # Provide a detailed, user friendly representation - def inspect - values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") - "" - end - end - - end - end - end - end -end - - diff --git a/lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb b/lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb deleted file mode 100644 index 870297d1a..000000000 --- a/lib/twilio-ruby/rest/preview/sync/service/document/document_permission.rb +++ /dev/null @@ -1,394 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Preview -# This is the public Twilio REST API. -# -# NOTE: This class is auto generated by OpenAPI Generator. -# https://openapi-generator.tech -# Do not edit the class manually. -# - - -module Twilio - module REST - class Preview < PreviewBase - class Sync < Version - class ServiceContext < InstanceContext - class DocumentContext < InstanceContext - - class DocumentPermissionList < ListResource - - ## - # Initialize the DocumentPermissionList - # @param [Version] version Version that contains the resource - # @return [DocumentPermissionList] DocumentPermissionList - def initialize(version, service_sid: nil, document_sid: nil) - super(version) - # Path Solution - @solution = { service_sid: service_sid, document_sid: document_sid } - @uri = "/Services/#{@solution[:service_sid]}/Documents/#{@solution[:document_sid]}/Permissions" - - end - - ## - # Lists DocumentPermissionInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @param [Integer] limit Upper limit for the number of records to return. stream() - # guarantees to never return more than limit. Default is no limit - # @param [Integer] page_size Number of records to fetch per request, when - # not set will use the default value of 50 records. If no page_size is defined - # but a limit is defined, stream() will attempt to read the limit with the most - # efficient page size, i.e. min(limit, 1000) - # @return [Array] Array of up to limit results - def list(limit: nil, page_size: nil) - self.stream( - limit: limit, - page_size: page_size - ).entries - end - - ## - # Streams Instance records from the API as an Enumerable. - # This operation lazily loads records as efficiently as possible until the limit - # is reached. - # @param [Integer] limit Upper limit for the number of records to return. stream() - # guarantees to never return more than limit. Default is no limit - # @param [Integer] page_size Number of records to fetch per request, when - # not set will use the default value of 50 records. If no page_size is defined - # but a limit is defined, stream() will attempt to read the limit with the most - # efficient page size, i.e. min(limit, 1000) - # @return [Enumerable] Enumerable that will yield up to limit results - def stream(limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields DocumentPermissionInstance records from the API. - # This operation lazily loads records as efficiently as possible until the limit - # is reached. - def each - limits = @version.read_limits - - page = self.page(page_size: limits[:page_size], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of DocumentPermissionInstance records from the API. - # Request is executed immediately. - # @param [String] page_token PageToken provided by the API - # @param [Integer] page_number Page Number, this value is simply for client state - # @param [Integer] page_size Number of records to return, defaults to 50 - # @return [Page] Page of DocumentPermissionInstance - def page(page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - DocumentPermissionPage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of DocumentPermissionInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of DocumentPermissionInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - DocumentPermissionPage.new(@version, response, @solution) - end - - - - # Provide a user friendly representation - def to_s - '#' - end - end - - - class DocumentPermissionContext < InstanceContext - ## - # Initialize the DocumentPermissionContext - # @param [Version] version Version that contains the resource - # @param [String] service_sid The unique SID identifier of the Sync Service Instance. - # @param [String] document_sid Identifier of the Sync Document. Either a SID or a unique name. - # @param [String] identity Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. - # @return [DocumentPermissionContext] DocumentPermissionContext - def initialize(version, service_sid, document_sid, identity) - super(version) - - # Path Solution - @solution = { service_sid: service_sid, document_sid: document_sid, identity: identity, } - @uri = "/Services/#{@solution[:service_sid]}/Documents/#{@solution[:document_sid]}/Permissions/#{@solution[:identity]}" - - - end - ## - # Delete the DocumentPermissionInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - @version.delete('DELETE', @uri, headers: headers) - end - - ## - # Fetch the DocumentPermissionInstance - # @return [DocumentPermissionInstance] Fetched DocumentPermissionInstance - def fetch - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - payload = @version.fetch('GET', @uri, headers: headers) - DocumentPermissionInstance.new( - @version, - payload, - service_sid: @solution[:service_sid], - document_sid: @solution[:document_sid], - identity: @solution[:identity], - ) - end - - ## - # Update the DocumentPermissionInstance - # @param [Boolean] read Boolean flag specifying whether the identity can read the Sync Document. - # @param [Boolean] write Boolean flag specifying whether the identity can update the Sync Document. - # @param [Boolean] manage Boolean flag specifying whether the identity can delete the Sync Document. - # @return [DocumentPermissionInstance] Updated DocumentPermissionInstance - def update( - read: nil, - write: nil, - manage: nil - ) - - data = Twilio::Values.of({ - 'Read' => read, - 'Write' => write, - 'Manage' => manage, - }) - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - payload = @version.update('POST', @uri, data: data, headers: headers) - DocumentPermissionInstance.new( - @version, - payload, - service_sid: @solution[:service_sid], - document_sid: @solution[:document_sid], - identity: @solution[:identity], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class DocumentPermissionPage < Page - ## - # Initialize the DocumentPermissionPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [DocumentPermissionPage] DocumentPermissionPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of DocumentPermissionInstance - # @param [Hash] payload Payload response from the API - # @return [DocumentPermissionInstance] DocumentPermissionInstance - def get_instance(payload) - DocumentPermissionInstance.new(@version, payload, service_sid: @solution[:service_sid], document_sid: @solution[:document_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class DocumentPermissionInstance < InstanceResource - ## - # Initialize the DocumentPermissionInstance - # @param [Version] version Version that contains the resource - # @param [Hash] payload payload that contains response from Twilio - # @param [String] account_sid The SID of the - # {Account}[https://www.twilio.com/docs/iam/api/account] that created this DocumentPermission - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [DocumentPermissionInstance] DocumentPermissionInstance - def initialize(version, payload , service_sid: nil, document_sid: nil, identity: nil) - super(version) - - # Marshaled Properties - @properties = { - 'account_sid' => payload['account_sid'], - 'service_sid' => payload['service_sid'], - 'document_sid' => payload['document_sid'], - 'identity' => payload['identity'], - 'read' => payload['read'], - 'write' => payload['write'], - 'manage' => payload['manage'], - 'url' => payload['url'], - } - - # Context - @instance_context = nil - @params = { 'service_sid' => service_sid || @properties['service_sid'] ,'document_sid' => document_sid || @properties['document_sid'] ,'identity' => identity || @properties['identity'] , } - end - - ## - # Generate an instance context for the instance, the context is capable of - # performing various actions. All instance actions are proxied to the context - # @return [DocumentPermissionContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = DocumentPermissionContext.new(@version , @params['service_sid'], @params['document_sid'], @params['identity']) - end - @instance_context - end - - ## - # @return [String] The unique SID identifier of the Twilio Account. - def account_sid - @properties['account_sid'] - end - - ## - # @return [String] The unique SID identifier of the Sync Service Instance. - def service_sid - @properties['service_sid'] - end - - ## - # @return [String] The unique SID identifier of the Sync Document to which the Permission applies. - def document_sid - @properties['document_sid'] - end - - ## - # @return [String] Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. - def identity - @properties['identity'] - end - - ## - # @return [Boolean] Boolean flag specifying whether the identity can read the Sync Document. - def read - @properties['read'] - end - - ## - # @return [Boolean] Boolean flag specifying whether the identity can update the Sync Document. - def write - @properties['write'] - end - - ## - # @return [Boolean] Boolean flag specifying whether the identity can delete the Sync Document. - def manage - @properties['manage'] - end - - ## - # @return [String] Contains an absolute URL for this Sync Document Permission. - def url - @properties['url'] - end - - ## - # Delete the DocumentPermissionInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the DocumentPermissionInstance - # @return [DocumentPermissionInstance] Fetched DocumentPermissionInstance - def fetch - - context.fetch - end - - ## - # Update the DocumentPermissionInstance - # @param [Boolean] read Boolean flag specifying whether the identity can read the Sync Document. - # @param [Boolean] write Boolean flag specifying whether the identity can update the Sync Document. - # @param [Boolean] manage Boolean flag specifying whether the identity can delete the Sync Document. - # @return [DocumentPermissionInstance] Updated DocumentPermissionInstance - def update( - read: nil, - write: nil, - manage: nil - ) - - context.update( - read: read, - write: write, - manage: manage, - ) - end - - ## - # Provide a user friendly representation - def to_s - values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") - "" - end - - ## - # Provide a detailed, user friendly representation - def inspect - values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") - "" - end - end - - end - end - end - end - end -end - - diff --git a/lib/twilio-ruby/rest/preview/sync/service/sync_list.rb b/lib/twilio-ruby/rest/preview/sync/service/sync_list.rb deleted file mode 100644 index 90e9ca071..000000000 --- a/lib/twilio-ruby/rest/preview/sync/service/sync_list.rb +++ /dev/null @@ -1,431 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Preview -# This is the public Twilio REST API. -# -# NOTE: This class is auto generated by OpenAPI Generator. -# https://openapi-generator.tech -# Do not edit the class manually. -# - - -module Twilio - module REST - class Preview < PreviewBase - class Sync < Version - class ServiceContext < InstanceContext - - class SyncListList < ListResource - - ## - # Initialize the SyncListList - # @param [Version] version Version that contains the resource - # @return [SyncListList] SyncListList - def initialize(version, service_sid: nil) - super(version) - # Path Solution - @solution = { service_sid: service_sid } - @uri = "/Services/#{@solution[:service_sid]}/Lists" - - end - ## - # Create the SyncListInstance - # @param [String] unique_name - # @return [SyncListInstance] Created SyncListInstance - def create( - unique_name: :unset - ) - - data = Twilio::Values.of({ - 'UniqueName' => unique_name, - }) - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - payload = @version.create('POST', @uri, data: data, headers: headers) - SyncListInstance.new( - @version, - payload, - service_sid: @solution[:service_sid], - ) - end - - - ## - # Lists SyncListInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @param [Integer] limit Upper limit for the number of records to return. stream() - # guarantees to never return more than limit. Default is no limit - # @param [Integer] page_size Number of records to fetch per request, when - # not set will use the default value of 50 records. If no page_size is defined - # but a limit is defined, stream() will attempt to read the limit with the most - # efficient page size, i.e. min(limit, 1000) - # @return [Array] Array of up to limit results - def list(limit: nil, page_size: nil) - self.stream( - limit: limit, - page_size: page_size - ).entries - end - - ## - # Streams Instance records from the API as an Enumerable. - # This operation lazily loads records as efficiently as possible until the limit - # is reached. - # @param [Integer] limit Upper limit for the number of records to return. stream() - # guarantees to never return more than limit. Default is no limit - # @param [Integer] page_size Number of records to fetch per request, when - # not set will use the default value of 50 records. If no page_size is defined - # but a limit is defined, stream() will attempt to read the limit with the most - # efficient page size, i.e. min(limit, 1000) - # @return [Enumerable] Enumerable that will yield up to limit results - def stream(limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields SyncListInstance records from the API. - # This operation lazily loads records as efficiently as possible until the limit - # is reached. - def each - limits = @version.read_limits - - page = self.page(page_size: limits[:page_size], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of SyncListInstance records from the API. - # Request is executed immediately. - # @param [String] page_token PageToken provided by the API - # @param [Integer] page_number Page Number, this value is simply for client state - # @param [Integer] page_size Number of records to return, defaults to 50 - # @return [Page] Page of SyncListInstance - def page(page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - SyncListPage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of SyncListInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of SyncListInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - SyncListPage.new(@version, response, @solution) - end - - - - # Provide a user friendly representation - def to_s - '#' - end - end - - - class SyncListContext < InstanceContext - ## - # Initialize the SyncListContext - # @param [Version] version Version that contains the resource - # @param [String] service_sid - # @param [String] sid - # @return [SyncListContext] SyncListContext - def initialize(version, service_sid, sid) - super(version) - - # Path Solution - @solution = { service_sid: service_sid, sid: sid, } - @uri = "/Services/#{@solution[:service_sid]}/Lists/#{@solution[:sid]}" - - # Dependents - @sync_list_permissions = nil - @sync_list_items = nil - end - ## - # Delete the SyncListInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - @version.delete('DELETE', @uri, headers: headers) - end - - ## - # Fetch the SyncListInstance - # @return [SyncListInstance] Fetched SyncListInstance - def fetch - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - payload = @version.fetch('GET', @uri, headers: headers) - SyncListInstance.new( - @version, - payload, - service_sid: @solution[:service_sid], - sid: @solution[:sid], - ) - end - - ## - # Access the sync_list_permissions - # @return [SyncListPermissionList] - # @return [SyncListPermissionContext] if sid was passed. - def sync_list_permissions(identity=:unset) - - raise ArgumentError, 'identity cannot be nil' if identity.nil? - - if identity != :unset - return SyncListPermissionContext.new(@version, @solution[:service_sid], @solution[:sid],identity ) - end - - unless @sync_list_permissions - @sync_list_permissions = SyncListPermissionList.new( - @version, ) - end - - @sync_list_permissions - end - ## - # Access the sync_list_items - # @return [SyncListItemList] - # @return [SyncListItemContext] if sid was passed. - def sync_list_items(index=:unset) - - raise ArgumentError, 'index cannot be nil' if index.nil? - - if index != :unset - return SyncListItemContext.new(@version, @solution[:service_sid], @solution[:sid],index ) - end - - unless @sync_list_items - @sync_list_items = SyncListItemList.new( - @version, ) - end - - @sync_list_items - end - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class SyncListPage < Page - ## - # Initialize the SyncListPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [SyncListPage] SyncListPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of SyncListInstance - # @param [Hash] payload Payload response from the API - # @return [SyncListInstance] SyncListInstance - def get_instance(payload) - SyncListInstance.new(@version, payload, service_sid: @solution[:service_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class SyncListInstance < InstanceResource - ## - # Initialize the SyncListInstance - # @param [Version] version Version that contains the resource - # @param [Hash] payload payload that contains response from Twilio - # @param [String] account_sid The SID of the - # {Account}[https://www.twilio.com/docs/iam/api/account] that created this SyncList - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [SyncListInstance] SyncListInstance - def initialize(version, payload , service_sid: nil, sid: nil) - super(version) - - # Marshaled Properties - @properties = { - 'sid' => payload['sid'], - 'unique_name' => payload['unique_name'], - 'account_sid' => payload['account_sid'], - 'service_sid' => payload['service_sid'], - 'url' => payload['url'], - 'links' => payload['links'], - 'revision' => payload['revision'], - 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), - 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), - 'created_by' => payload['created_by'], - } - - # Context - @instance_context = nil - @params = { 'service_sid' => service_sid || @properties['service_sid'] ,'sid' => sid || @properties['sid'] , } - end - - ## - # Generate an instance context for the instance, the context is capable of - # performing various actions. All instance actions are proxied to the context - # @return [SyncListContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = SyncListContext.new(@version , @params['service_sid'], @params['sid']) - end - @instance_context - end - - ## - # @return [String] - def sid - @properties['sid'] - end - - ## - # @return [String] - def unique_name - @properties['unique_name'] - end - - ## - # @return [String] - def account_sid - @properties['account_sid'] - end - - ## - # @return [String] - def service_sid - @properties['service_sid'] - end - - ## - # @return [String] - def url - @properties['url'] - end - - ## - # @return [Hash] - def links - @properties['links'] - end - - ## - # @return [String] - def revision - @properties['revision'] - end - - ## - # @return [Time] - def date_created - @properties['date_created'] - end - - ## - # @return [Time] - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] - def created_by - @properties['created_by'] - end - - ## - # Delete the SyncListInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the SyncListInstance - # @return [SyncListInstance] Fetched SyncListInstance - def fetch - - context.fetch - end - - ## - # Access the sync_list_permissions - # @return [sync_list_permissions] sync_list_permissions - def sync_list_permissions - context.sync_list_permissions - end - - ## - # Access the sync_list_items - # @return [sync_list_items] sync_list_items - def sync_list_items - context.sync_list_items - end - - ## - # Provide a user friendly representation - def to_s - values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") - "" - end - - ## - # Provide a detailed, user friendly representation - def inspect - values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") - "" - end - end - - end - end - end - end -end - - diff --git a/lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb b/lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb deleted file mode 100644 index aa23eadff..000000000 --- a/lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_item.rb +++ /dev/null @@ -1,450 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Preview -# This is the public Twilio REST API. -# -# NOTE: This class is auto generated by OpenAPI Generator. -# https://openapi-generator.tech -# Do not edit the class manually. -# - - -module Twilio - module REST - class Preview < PreviewBase - class Sync < Version - class ServiceContext < InstanceContext - class SyncListContext < InstanceContext - - class SyncListItemList < ListResource - - ## - # Initialize the SyncListItemList - # @param [Version] version Version that contains the resource - # @return [SyncListItemList] SyncListItemList - def initialize(version, service_sid: nil, list_sid: nil) - super(version) - # Path Solution - @solution = { service_sid: service_sid, list_sid: list_sid } - @uri = "/Services/#{@solution[:service_sid]}/Lists/#{@solution[:list_sid]}/Items" - - end - ## - # Create the SyncListItemInstance - # @param [Object] data - # @return [SyncListItemInstance] Created SyncListItemInstance - def create( - data: nil - ) - - data = Twilio::Values.of({ - 'Data' => Twilio.serialize_object(data), - }) - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - payload = @version.create('POST', @uri, data: data, headers: headers) - SyncListItemInstance.new( - @version, - payload, - service_sid: @solution[:service_sid], - list_sid: @solution[:list_sid], - ) - end - - - ## - # Lists SyncListItemInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @param [QueryResultOrder] order - # @param [String] from - # @param [QueryFromBoundType] bounds - # @param [Integer] limit Upper limit for the number of records to return. stream() - # guarantees to never return more than limit. Default is no limit - # @param [Integer] page_size Number of records to fetch per request, when - # not set will use the default value of 50 records. If no page_size is defined - # but a limit is defined, stream() will attempt to read the limit with the most - # efficient page size, i.e. min(limit, 1000) - # @return [Array] Array of up to limit results - def list(order: :unset, from: :unset, bounds: :unset, limit: nil, page_size: nil) - self.stream( - order: order, - from: from, - bounds: bounds, - limit: limit, - page_size: page_size - ).entries - end - - ## - # Streams Instance records from the API as an Enumerable. - # This operation lazily loads records as efficiently as possible until the limit - # is reached. - # @param [QueryResultOrder] order - # @param [String] from - # @param [QueryFromBoundType] bounds - # @param [Integer] limit Upper limit for the number of records to return. stream() - # guarantees to never return more than limit. Default is no limit - # @param [Integer] page_size Number of records to fetch per request, when - # not set will use the default value of 50 records. If no page_size is defined - # but a limit is defined, stream() will attempt to read the limit with the most - # efficient page size, i.e. min(limit, 1000) - # @return [Enumerable] Enumerable that will yield up to limit results - def stream(order: :unset, from: :unset, bounds: :unset, limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - order: order, - from: from, - bounds: bounds, - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields SyncListItemInstance records from the API. - # This operation lazily loads records as efficiently as possible until the limit - # is reached. - def each - limits = @version.read_limits - - page = self.page(page_size: limits[:page_size], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of SyncListItemInstance records from the API. - # Request is executed immediately. - # @param [QueryResultOrder] order - # @param [String] from - # @param [QueryFromBoundType] bounds - # @param [String] page_token PageToken provided by the API - # @param [Integer] page_number Page Number, this value is simply for client state - # @param [Integer] page_size Number of records to return, defaults to 50 - # @return [Page] Page of SyncListItemInstance - def page(order: :unset, from: :unset, bounds: :unset, page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'Order' => order, - 'From' => from, - 'Bounds' => bounds, - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - SyncListItemPage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of SyncListItemInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of SyncListItemInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - SyncListItemPage.new(@version, response, @solution) - end - - - - # Provide a user friendly representation - def to_s - '#' - end - end - - - class SyncListItemContext < InstanceContext - ## - # Initialize the SyncListItemContext - # @param [Version] version Version that contains the resource - # @param [String] service_sid - # @param [String] list_sid - # @param [String] index - # @return [SyncListItemContext] SyncListItemContext - def initialize(version, service_sid, list_sid, index) - super(version) - - # Path Solution - @solution = { service_sid: service_sid, list_sid: list_sid, index: index, } - @uri = "/Services/#{@solution[:service_sid]}/Lists/#{@solution[:list_sid]}/Items/#{@solution[:index]}" - - - end - ## - # Delete the SyncListItemInstance - # @param [String] if_match The If-Match HTTP request header - # @return [Boolean] True if delete succeeds, false otherwise - 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 the SyncListItemInstance - # @return [SyncListItemInstance] Fetched SyncListItemInstance - def fetch - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - payload = @version.fetch('GET', @uri, headers: headers) - SyncListItemInstance.new( - @version, - payload, - service_sid: @solution[:service_sid], - list_sid: @solution[:list_sid], - index: @solution[:index], - ) - end - - ## - # Update the SyncListItemInstance - # @param [Object] data - # @param [String] if_match The If-Match HTTP request header - # @return [SyncListItemInstance] Updated SyncListItemInstance - def update( - data: nil, - if_match: :unset - ) - - data = Twilio::Values.of({ - 'Data' => Twilio.serialize_object(data), - }) - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', 'If-Match' => if_match, }) - - payload = @version.update('POST', @uri, data: data, headers: headers) - SyncListItemInstance.new( - @version, - payload, - service_sid: @solution[:service_sid], - list_sid: @solution[:list_sid], - index: @solution[:index], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class SyncListItemPage < Page - ## - # Initialize the SyncListItemPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [SyncListItemPage] SyncListItemPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of SyncListItemInstance - # @param [Hash] payload Payload response from the API - # @return [SyncListItemInstance] SyncListItemInstance - def get_instance(payload) - SyncListItemInstance.new(@version, payload, service_sid: @solution[:service_sid], list_sid: @solution[:list_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class SyncListItemInstance < InstanceResource - ## - # Initialize the SyncListItemInstance - # @param [Version] version Version that contains the resource - # @param [Hash] payload payload that contains response from Twilio - # @param [String] account_sid The SID of the - # {Account}[https://www.twilio.com/docs/iam/api/account] that created this SyncListItem - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [SyncListItemInstance] SyncListItemInstance - def initialize(version, payload , service_sid: nil, list_sid: nil, index: nil) - super(version) - - # Marshaled Properties - @properties = { - 'index' => payload['index'] == nil ? payload['index'] : payload['index'].to_i, - 'account_sid' => payload['account_sid'], - 'service_sid' => payload['service_sid'], - 'list_sid' => payload['list_sid'], - 'url' => payload['url'], - 'revision' => payload['revision'], - 'data' => payload['data'], - 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), - 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), - 'created_by' => payload['created_by'], - } - - # Context - @instance_context = nil - @params = { 'service_sid' => service_sid || @properties['service_sid'] ,'list_sid' => list_sid || @properties['list_sid'] ,'index' => index || @properties['index'] , } - end - - ## - # Generate an instance context for the instance, the context is capable of - # performing various actions. All instance actions are proxied to the context - # @return [SyncListItemContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = SyncListItemContext.new(@version , @params['service_sid'], @params['list_sid'], @params['index']) - end - @instance_context - end - - ## - # @return [String] - def index - @properties['index'] - end - - ## - # @return [String] - def account_sid - @properties['account_sid'] - end - - ## - # @return [String] - def service_sid - @properties['service_sid'] - end - - ## - # @return [String] - def list_sid - @properties['list_sid'] - end - - ## - # @return [String] - def url - @properties['url'] - end - - ## - # @return [String] - def revision - @properties['revision'] - end - - ## - # @return [Hash] - def data - @properties['data'] - end - - ## - # @return [Time] - def date_created - @properties['date_created'] - end - - ## - # @return [Time] - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] - def created_by - @properties['created_by'] - end - - ## - # Delete the SyncListItemInstance - # @param [String] if_match The If-Match HTTP request header - # @return [Boolean] True if delete succeeds, false otherwise - def delete( - if_match: :unset - ) - - context.delete( - if_match: if_match, - ) - end - - ## - # Fetch the SyncListItemInstance - # @return [SyncListItemInstance] Fetched SyncListItemInstance - def fetch - - context.fetch - end - - ## - # Update the SyncListItemInstance - # @param [Object] data - # @param [String] if_match The If-Match HTTP request header - # @return [SyncListItemInstance] Updated SyncListItemInstance - def update( - data: nil, - if_match: :unset - ) - - context.update( - data: data, - if_match: if_match, - ) - end - - ## - # Provide a user friendly representation - def to_s - values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") - "" - end - - ## - # Provide a detailed, user friendly representation - def inspect - values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") - "" - end - end - - end - end - end - end - end -end - - diff --git a/lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_permission.rb b/lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_permission.rb deleted file mode 100644 index 5a79557ef..000000000 --- a/lib/twilio-ruby/rest/preview/sync/service/sync_list/sync_list_permission.rb +++ /dev/null @@ -1,394 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Preview -# This is the public Twilio REST API. -# -# NOTE: This class is auto generated by OpenAPI Generator. -# https://openapi-generator.tech -# Do not edit the class manually. -# - - -module Twilio - module REST - class Preview < PreviewBase - class Sync < Version - class ServiceContext < InstanceContext - class SyncListContext < InstanceContext - - class SyncListPermissionList < ListResource - - ## - # Initialize the SyncListPermissionList - # @param [Version] version Version that contains the resource - # @return [SyncListPermissionList] SyncListPermissionList - def initialize(version, service_sid: nil, list_sid: nil) - super(version) - # Path Solution - @solution = { service_sid: service_sid, list_sid: list_sid } - @uri = "/Services/#{@solution[:service_sid]}/Lists/#{@solution[:list_sid]}/Permissions" - - end - - ## - # Lists SyncListPermissionInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @param [Integer] limit Upper limit for the number of records to return. stream() - # guarantees to never return more than limit. Default is no limit - # @param [Integer] page_size Number of records to fetch per request, when - # not set will use the default value of 50 records. If no page_size is defined - # but a limit is defined, stream() will attempt to read the limit with the most - # efficient page size, i.e. min(limit, 1000) - # @return [Array] Array of up to limit results - def list(limit: nil, page_size: nil) - self.stream( - limit: limit, - page_size: page_size - ).entries - end - - ## - # Streams Instance records from the API as an Enumerable. - # This operation lazily loads records as efficiently as possible until the limit - # is reached. - # @param [Integer] limit Upper limit for the number of records to return. stream() - # guarantees to never return more than limit. Default is no limit - # @param [Integer] page_size Number of records to fetch per request, when - # not set will use the default value of 50 records. If no page_size is defined - # but a limit is defined, stream() will attempt to read the limit with the most - # efficient page size, i.e. min(limit, 1000) - # @return [Enumerable] Enumerable that will yield up to limit results - def stream(limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields SyncListPermissionInstance records from the API. - # This operation lazily loads records as efficiently as possible until the limit - # is reached. - def each - limits = @version.read_limits - - page = self.page(page_size: limits[:page_size], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of SyncListPermissionInstance records from the API. - # Request is executed immediately. - # @param [String] page_token PageToken provided by the API - # @param [Integer] page_number Page Number, this value is simply for client state - # @param [Integer] page_size Number of records to return, defaults to 50 - # @return [Page] Page of SyncListPermissionInstance - def page(page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - SyncListPermissionPage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of SyncListPermissionInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of SyncListPermissionInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - SyncListPermissionPage.new(@version, response, @solution) - end - - - - # Provide a user friendly representation - def to_s - '#' - end - end - - - class SyncListPermissionContext < InstanceContext - ## - # Initialize the SyncListPermissionContext - # @param [Version] version Version that contains the resource - # @param [String] service_sid The unique SID identifier of the Sync Service Instance. - # @param [String] list_sid Identifier of the Sync List. Either a SID or a unique name. - # @param [String] identity Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. - # @return [SyncListPermissionContext] SyncListPermissionContext - def initialize(version, service_sid, list_sid, identity) - super(version) - - # Path Solution - @solution = { service_sid: service_sid, list_sid: list_sid, identity: identity, } - @uri = "/Services/#{@solution[:service_sid]}/Lists/#{@solution[:list_sid]}/Permissions/#{@solution[:identity]}" - - - end - ## - # Delete the SyncListPermissionInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - @version.delete('DELETE', @uri, headers: headers) - end - - ## - # Fetch the SyncListPermissionInstance - # @return [SyncListPermissionInstance] Fetched SyncListPermissionInstance - def fetch - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - payload = @version.fetch('GET', @uri, headers: headers) - SyncListPermissionInstance.new( - @version, - payload, - service_sid: @solution[:service_sid], - list_sid: @solution[:list_sid], - identity: @solution[:identity], - ) - end - - ## - # Update the SyncListPermissionInstance - # @param [Boolean] read Boolean flag specifying whether the identity can read the Sync List. - # @param [Boolean] write Boolean flag specifying whether the identity can create, update and delete Items of the Sync List. - # @param [Boolean] manage Boolean flag specifying whether the identity can delete the Sync List. - # @return [SyncListPermissionInstance] Updated SyncListPermissionInstance - def update( - read: nil, - write: nil, - manage: nil - ) - - data = Twilio::Values.of({ - 'Read' => read, - 'Write' => write, - 'Manage' => manage, - }) - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - payload = @version.update('POST', @uri, data: data, headers: headers) - SyncListPermissionInstance.new( - @version, - payload, - service_sid: @solution[:service_sid], - list_sid: @solution[:list_sid], - identity: @solution[:identity], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class SyncListPermissionPage < Page - ## - # Initialize the SyncListPermissionPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [SyncListPermissionPage] SyncListPermissionPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of SyncListPermissionInstance - # @param [Hash] payload Payload response from the API - # @return [SyncListPermissionInstance] SyncListPermissionInstance - def get_instance(payload) - SyncListPermissionInstance.new(@version, payload, service_sid: @solution[:service_sid], list_sid: @solution[:list_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class SyncListPermissionInstance < InstanceResource - ## - # Initialize the SyncListPermissionInstance - # @param [Version] version Version that contains the resource - # @param [Hash] payload payload that contains response from Twilio - # @param [String] account_sid The SID of the - # {Account}[https://www.twilio.com/docs/iam/api/account] that created this SyncListPermission - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [SyncListPermissionInstance] SyncListPermissionInstance - def initialize(version, payload , service_sid: nil, list_sid: nil, identity: nil) - super(version) - - # Marshaled Properties - @properties = { - 'account_sid' => payload['account_sid'], - 'service_sid' => payload['service_sid'], - 'list_sid' => payload['list_sid'], - 'identity' => payload['identity'], - 'read' => payload['read'], - 'write' => payload['write'], - 'manage' => payload['manage'], - 'url' => payload['url'], - } - - # Context - @instance_context = nil - @params = { 'service_sid' => service_sid || @properties['service_sid'] ,'list_sid' => list_sid || @properties['list_sid'] ,'identity' => identity || @properties['identity'] , } - end - - ## - # Generate an instance context for the instance, the context is capable of - # performing various actions. All instance actions are proxied to the context - # @return [SyncListPermissionContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = SyncListPermissionContext.new(@version , @params['service_sid'], @params['list_sid'], @params['identity']) - end - @instance_context - end - - ## - # @return [String] The unique SID identifier of the Twilio Account. - def account_sid - @properties['account_sid'] - end - - ## - # @return [String] The unique SID identifier of the Sync Service Instance. - def service_sid - @properties['service_sid'] - end - - ## - # @return [String] The unique SID identifier of the Sync List to which the Permission applies. - def list_sid - @properties['list_sid'] - end - - ## - # @return [String] Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. - def identity - @properties['identity'] - end - - ## - # @return [Boolean] Boolean flag specifying whether the identity can read the Sync List and its Items. - def read - @properties['read'] - end - - ## - # @return [Boolean] Boolean flag specifying whether the identity can create, update and delete Items of the Sync List. - def write - @properties['write'] - end - - ## - # @return [Boolean] Boolean flag specifying whether the identity can delete the Sync List. - def manage - @properties['manage'] - end - - ## - # @return [String] Contains an absolute URL for this Sync List Permission. - def url - @properties['url'] - end - - ## - # Delete the SyncListPermissionInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the SyncListPermissionInstance - # @return [SyncListPermissionInstance] Fetched SyncListPermissionInstance - def fetch - - context.fetch - end - - ## - # Update the SyncListPermissionInstance - # @param [Boolean] read Boolean flag specifying whether the identity can read the Sync List. - # @param [Boolean] write Boolean flag specifying whether the identity can create, update and delete Items of the Sync List. - # @param [Boolean] manage Boolean flag specifying whether the identity can delete the Sync List. - # @return [SyncListPermissionInstance] Updated SyncListPermissionInstance - def update( - read: nil, - write: nil, - manage: nil - ) - - context.update( - read: read, - write: write, - manage: manage, - ) - end - - ## - # Provide a user friendly representation - def to_s - values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") - "" - end - - ## - # Provide a detailed, user friendly representation - def inspect - values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") - "" - end - end - - end - end - end - end - end -end - - diff --git a/lib/twilio-ruby/rest/preview/sync/service/sync_map.rb b/lib/twilio-ruby/rest/preview/sync/service/sync_map.rb deleted file mode 100644 index 2f07ce63f..000000000 --- a/lib/twilio-ruby/rest/preview/sync/service/sync_map.rb +++ /dev/null @@ -1,431 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Preview -# This is the public Twilio REST API. -# -# NOTE: This class is auto generated by OpenAPI Generator. -# https://openapi-generator.tech -# Do not edit the class manually. -# - - -module Twilio - module REST - class Preview < PreviewBase - class Sync < Version - class ServiceContext < InstanceContext - - class SyncMapList < ListResource - - ## - # Initialize the SyncMapList - # @param [Version] version Version that contains the resource - # @return [SyncMapList] SyncMapList - def initialize(version, service_sid: nil) - super(version) - # Path Solution - @solution = { service_sid: service_sid } - @uri = "/Services/#{@solution[:service_sid]}/Maps" - - end - ## - # Create the SyncMapInstance - # @param [String] unique_name - # @return [SyncMapInstance] Created SyncMapInstance - def create( - unique_name: :unset - ) - - data = Twilio::Values.of({ - 'UniqueName' => unique_name, - }) - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - payload = @version.create('POST', @uri, data: data, headers: headers) - SyncMapInstance.new( - @version, - payload, - service_sid: @solution[:service_sid], - ) - end - - - ## - # Lists SyncMapInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @param [Integer] limit Upper limit for the number of records to return. stream() - # guarantees to never return more than limit. Default is no limit - # @param [Integer] page_size Number of records to fetch per request, when - # not set will use the default value of 50 records. If no page_size is defined - # but a limit is defined, stream() will attempt to read the limit with the most - # efficient page size, i.e. min(limit, 1000) - # @return [Array] Array of up to limit results - def list(limit: nil, page_size: nil) - self.stream( - limit: limit, - page_size: page_size - ).entries - end - - ## - # Streams Instance records from the API as an Enumerable. - # This operation lazily loads records as efficiently as possible until the limit - # is reached. - # @param [Integer] limit Upper limit for the number of records to return. stream() - # guarantees to never return more than limit. Default is no limit - # @param [Integer] page_size Number of records to fetch per request, when - # not set will use the default value of 50 records. If no page_size is defined - # but a limit is defined, stream() will attempt to read the limit with the most - # efficient page size, i.e. min(limit, 1000) - # @return [Enumerable] Enumerable that will yield up to limit results - def stream(limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields SyncMapInstance records from the API. - # This operation lazily loads records as efficiently as possible until the limit - # is reached. - def each - limits = @version.read_limits - - page = self.page(page_size: limits[:page_size], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of SyncMapInstance records from the API. - # Request is executed immediately. - # @param [String] page_token PageToken provided by the API - # @param [Integer] page_number Page Number, this value is simply for client state - # @param [Integer] page_size Number of records to return, defaults to 50 - # @return [Page] Page of SyncMapInstance - def page(page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - SyncMapPage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of SyncMapInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of SyncMapInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - SyncMapPage.new(@version, response, @solution) - end - - - - # Provide a user friendly representation - def to_s - '#' - end - end - - - class SyncMapContext < InstanceContext - ## - # Initialize the SyncMapContext - # @param [Version] version Version that contains the resource - # @param [String] service_sid - # @param [String] sid - # @return [SyncMapContext] SyncMapContext - def initialize(version, service_sid, sid) - super(version) - - # Path Solution - @solution = { service_sid: service_sid, sid: sid, } - @uri = "/Services/#{@solution[:service_sid]}/Maps/#{@solution[:sid]}" - - # Dependents - @sync_map_items = nil - @sync_map_permissions = nil - end - ## - # Delete the SyncMapInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - @version.delete('DELETE', @uri, headers: headers) - end - - ## - # Fetch the SyncMapInstance - # @return [SyncMapInstance] Fetched SyncMapInstance - def fetch - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - payload = @version.fetch('GET', @uri, headers: headers) - SyncMapInstance.new( - @version, - payload, - service_sid: @solution[:service_sid], - sid: @solution[:sid], - ) - end - - ## - # Access the sync_map_items - # @return [SyncMapItemList] - # @return [SyncMapItemContext] if sid was passed. - def sync_map_items(key=:unset) - - raise ArgumentError, 'key cannot be nil' if key.nil? - - if key != :unset - return SyncMapItemContext.new(@version, @solution[:service_sid], @solution[:sid],key ) - end - - unless @sync_map_items - @sync_map_items = SyncMapItemList.new( - @version, ) - end - - @sync_map_items - end - ## - # Access the sync_map_permissions - # @return [SyncMapPermissionList] - # @return [SyncMapPermissionContext] if sid was passed. - def sync_map_permissions(identity=:unset) - - raise ArgumentError, 'identity cannot be nil' if identity.nil? - - if identity != :unset - return SyncMapPermissionContext.new(@version, @solution[:service_sid], @solution[:sid],identity ) - end - - unless @sync_map_permissions - @sync_map_permissions = SyncMapPermissionList.new( - @version, ) - end - - @sync_map_permissions - end - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class SyncMapPage < Page - ## - # Initialize the SyncMapPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [SyncMapPage] SyncMapPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of SyncMapInstance - # @param [Hash] payload Payload response from the API - # @return [SyncMapInstance] SyncMapInstance - def get_instance(payload) - SyncMapInstance.new(@version, payload, service_sid: @solution[:service_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class SyncMapInstance < InstanceResource - ## - # Initialize the SyncMapInstance - # @param [Version] version Version that contains the resource - # @param [Hash] payload payload that contains response from Twilio - # @param [String] account_sid The SID of the - # {Account}[https://www.twilio.com/docs/iam/api/account] that created this SyncMap - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [SyncMapInstance] SyncMapInstance - def initialize(version, payload , service_sid: nil, sid: nil) - super(version) - - # Marshaled Properties - @properties = { - 'sid' => payload['sid'], - 'unique_name' => payload['unique_name'], - 'account_sid' => payload['account_sid'], - 'service_sid' => payload['service_sid'], - 'url' => payload['url'], - 'links' => payload['links'], - 'revision' => payload['revision'], - 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), - 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), - 'created_by' => payload['created_by'], - } - - # Context - @instance_context = nil - @params = { 'service_sid' => service_sid || @properties['service_sid'] ,'sid' => sid || @properties['sid'] , } - end - - ## - # Generate an instance context for the instance, the context is capable of - # performing various actions. All instance actions are proxied to the context - # @return [SyncMapContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = SyncMapContext.new(@version , @params['service_sid'], @params['sid']) - end - @instance_context - end - - ## - # @return [String] - def sid - @properties['sid'] - end - - ## - # @return [String] - def unique_name - @properties['unique_name'] - end - - ## - # @return [String] - def account_sid - @properties['account_sid'] - end - - ## - # @return [String] - def service_sid - @properties['service_sid'] - end - - ## - # @return [String] - def url - @properties['url'] - end - - ## - # @return [Hash] - def links - @properties['links'] - end - - ## - # @return [String] - def revision - @properties['revision'] - end - - ## - # @return [Time] - def date_created - @properties['date_created'] - end - - ## - # @return [Time] - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] - def created_by - @properties['created_by'] - end - - ## - # Delete the SyncMapInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the SyncMapInstance - # @return [SyncMapInstance] Fetched SyncMapInstance - def fetch - - context.fetch - end - - ## - # Access the sync_map_items - # @return [sync_map_items] sync_map_items - def sync_map_items - context.sync_map_items - end - - ## - # Access the sync_map_permissions - # @return [sync_map_permissions] sync_map_permissions - def sync_map_permissions - context.sync_map_permissions - end - - ## - # Provide a user friendly representation - def to_s - values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") - "" - end - - ## - # Provide a detailed, user friendly representation - def inspect - values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") - "" - end - end - - end - end - end - end -end - - diff --git a/lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb b/lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb deleted file mode 100644 index 84ed3eae5..000000000 --- a/lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_item.rb +++ /dev/null @@ -1,453 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Preview -# This is the public Twilio REST API. -# -# NOTE: This class is auto generated by OpenAPI Generator. -# https://openapi-generator.tech -# Do not edit the class manually. -# - - -module Twilio - module REST - class Preview < PreviewBase - class Sync < Version - class ServiceContext < InstanceContext - class SyncMapContext < InstanceContext - - class SyncMapItemList < ListResource - - ## - # Initialize the SyncMapItemList - # @param [Version] version Version that contains the resource - # @return [SyncMapItemList] SyncMapItemList - def initialize(version, service_sid: nil, map_sid: nil) - super(version) - # Path Solution - @solution = { service_sid: service_sid, map_sid: map_sid } - @uri = "/Services/#{@solution[:service_sid]}/Maps/#{@solution[:map_sid]}/Items" - - end - ## - # Create the SyncMapItemInstance - # @param [String] key - # @param [Object] data - # @return [SyncMapItemInstance] Created SyncMapItemInstance - def create( - key: nil, - data: nil - ) - - data = Twilio::Values.of({ - 'Key' => key, - 'Data' => Twilio.serialize_object(data), - }) - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - payload = @version.create('POST', @uri, data: data, headers: headers) - SyncMapItemInstance.new( - @version, - payload, - service_sid: @solution[:service_sid], - map_sid: @solution[:map_sid], - ) - end - - - ## - # Lists SyncMapItemInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @param [QueryResultOrder] order - # @param [String] from - # @param [QueryFromBoundType] bounds - # @param [Integer] limit Upper limit for the number of records to return. stream() - # guarantees to never return more than limit. Default is no limit - # @param [Integer] page_size Number of records to fetch per request, when - # not set will use the default value of 50 records. If no page_size is defined - # but a limit is defined, stream() will attempt to read the limit with the most - # efficient page size, i.e. min(limit, 1000) - # @return [Array] Array of up to limit results - def list(order: :unset, from: :unset, bounds: :unset, limit: nil, page_size: nil) - self.stream( - order: order, - from: from, - bounds: bounds, - limit: limit, - page_size: page_size - ).entries - end - - ## - # Streams Instance records from the API as an Enumerable. - # This operation lazily loads records as efficiently as possible until the limit - # is reached. - # @param [QueryResultOrder] order - # @param [String] from - # @param [QueryFromBoundType] bounds - # @param [Integer] limit Upper limit for the number of records to return. stream() - # guarantees to never return more than limit. Default is no limit - # @param [Integer] page_size Number of records to fetch per request, when - # not set will use the default value of 50 records. If no page_size is defined - # but a limit is defined, stream() will attempt to read the limit with the most - # efficient page size, i.e. min(limit, 1000) - # @return [Enumerable] Enumerable that will yield up to limit results - def stream(order: :unset, from: :unset, bounds: :unset, limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - order: order, - from: from, - bounds: bounds, - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields SyncMapItemInstance records from the API. - # This operation lazily loads records as efficiently as possible until the limit - # is reached. - def each - limits = @version.read_limits - - page = self.page(page_size: limits[:page_size], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of SyncMapItemInstance records from the API. - # Request is executed immediately. - # @param [QueryResultOrder] order - # @param [String] from - # @param [QueryFromBoundType] bounds - # @param [String] page_token PageToken provided by the API - # @param [Integer] page_number Page Number, this value is simply for client state - # @param [Integer] page_size Number of records to return, defaults to 50 - # @return [Page] Page of SyncMapItemInstance - def page(order: :unset, from: :unset, bounds: :unset, page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'Order' => order, - 'From' => from, - 'Bounds' => bounds, - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - SyncMapItemPage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of SyncMapItemInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of SyncMapItemInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - SyncMapItemPage.new(@version, response, @solution) - end - - - - # Provide a user friendly representation - def to_s - '#' - end - end - - - class SyncMapItemContext < InstanceContext - ## - # Initialize the SyncMapItemContext - # @param [Version] version Version that contains the resource - # @param [String] service_sid - # @param [String] map_sid - # @param [String] key - # @return [SyncMapItemContext] SyncMapItemContext - 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 - ## - # Delete the SyncMapItemInstance - # @param [String] if_match The If-Match HTTP request header - # @return [Boolean] True if delete succeeds, false otherwise - 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 the SyncMapItemInstance - # @return [SyncMapItemInstance] Fetched SyncMapItemInstance - 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 - - ## - # Update the SyncMapItemInstance - # @param [Object] data - # @param [String] if_match The If-Match HTTP request header - # @return [SyncMapItemInstance] Updated SyncMapItemInstance - def update( - data: nil, - if_match: :unset - ) - - data = Twilio::Values.of({ - 'Data' => Twilio.serialize_object(data), - }) - - 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 - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class SyncMapItemPage < Page - ## - # Initialize the SyncMapItemPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [SyncMapItemPage] SyncMapItemPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of SyncMapItemInstance - # @param [Hash] payload Payload response from the API - # @return [SyncMapItemInstance] SyncMapItemInstance - def get_instance(payload) - SyncMapItemInstance.new(@version, payload, service_sid: @solution[:service_sid], map_sid: @solution[:map_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class SyncMapItemInstance < InstanceResource - ## - # Initialize the SyncMapItemInstance - # @param [Version] version Version that contains the resource - # @param [Hash] payload payload that contains response from Twilio - # @param [String] account_sid The SID of the - # {Account}[https://www.twilio.com/docs/iam/api/account] that created this SyncMapItem - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [SyncMapItemInstance] SyncMapItemInstance - def initialize(version, payload , service_sid: nil, map_sid: nil, key: nil) - super(version) - - # Marshaled Properties - @properties = { - 'key' => payload['key'], - 'account_sid' => payload['account_sid'], - 'service_sid' => payload['service_sid'], - 'map_sid' => payload['map_sid'], - 'url' => payload['url'], - 'revision' => payload['revision'], - 'data' => payload['data'], - 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), - 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), - 'created_by' => payload['created_by'], - } - - # Context - @instance_context = nil - @params = { 'service_sid' => service_sid || @properties['service_sid'] ,'map_sid' => map_sid || @properties['map_sid'] ,'key' => key || @properties['key'] , } - end - - ## - # Generate an instance context for the instance, the context is capable of - # performing various actions. All instance actions are proxied to the context - # @return [SyncMapItemContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = SyncMapItemContext.new(@version , @params['service_sid'], @params['map_sid'], @params['key']) - end - @instance_context - end - - ## - # @return [String] - def key - @properties['key'] - end - - ## - # @return [String] - def account_sid - @properties['account_sid'] - end - - ## - # @return [String] - def service_sid - @properties['service_sid'] - end - - ## - # @return [String] - def map_sid - @properties['map_sid'] - end - - ## - # @return [String] - def url - @properties['url'] - end - - ## - # @return [String] - def revision - @properties['revision'] - end - - ## - # @return [Hash] - def data - @properties['data'] - end - - ## - # @return [Time] - def date_created - @properties['date_created'] - end - - ## - # @return [Time] - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] - def created_by - @properties['created_by'] - end - - ## - # Delete the SyncMapItemInstance - # @param [String] if_match The If-Match HTTP request header - # @return [Boolean] True if delete succeeds, false otherwise - def delete( - if_match: :unset - ) - - context.delete( - if_match: if_match, - ) - end - - ## - # Fetch the SyncMapItemInstance - # @return [SyncMapItemInstance] Fetched SyncMapItemInstance - def fetch - - context.fetch - end - - ## - # Update the SyncMapItemInstance - # @param [Object] data - # @param [String] if_match The If-Match HTTP request header - # @return [SyncMapItemInstance] Updated SyncMapItemInstance - def update( - data: nil, - if_match: :unset - ) - - context.update( - data: data, - if_match: if_match, - ) - end - - ## - # Provide a user friendly representation - def to_s - values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") - "" - end - - ## - # Provide a detailed, user friendly representation - def inspect - values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") - "" - end - end - - end - end - end - end - end -end - - diff --git a/lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_permission.rb b/lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_permission.rb deleted file mode 100644 index 259360acd..000000000 --- a/lib/twilio-ruby/rest/preview/sync/service/sync_map/sync_map_permission.rb +++ /dev/null @@ -1,394 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Preview -# This is the public Twilio REST API. -# -# NOTE: This class is auto generated by OpenAPI Generator. -# https://openapi-generator.tech -# Do not edit the class manually. -# - - -module Twilio - module REST - class Preview < PreviewBase - class Sync < Version - class ServiceContext < InstanceContext - class SyncMapContext < InstanceContext - - class SyncMapPermissionList < ListResource - - ## - # Initialize the SyncMapPermissionList - # @param [Version] version Version that contains the resource - # @return [SyncMapPermissionList] SyncMapPermissionList - def initialize(version, service_sid: nil, map_sid: nil) - super(version) - # Path Solution - @solution = { service_sid: service_sid, map_sid: map_sid } - @uri = "/Services/#{@solution[:service_sid]}/Maps/#{@solution[:map_sid]}/Permissions" - - end - - ## - # Lists SyncMapPermissionInstance records from the API as a list. - # Unlike stream(), this operation is eager and will load `limit` records into - # memory before returning. - # @param [Integer] limit Upper limit for the number of records to return. stream() - # guarantees to never return more than limit. Default is no limit - # @param [Integer] page_size Number of records to fetch per request, when - # not set will use the default value of 50 records. If no page_size is defined - # but a limit is defined, stream() will attempt to read the limit with the most - # efficient page size, i.e. min(limit, 1000) - # @return [Array] Array of up to limit results - def list(limit: nil, page_size: nil) - self.stream( - limit: limit, - page_size: page_size - ).entries - end - - ## - # Streams Instance records from the API as an Enumerable. - # This operation lazily loads records as efficiently as possible until the limit - # is reached. - # @param [Integer] limit Upper limit for the number of records to return. stream() - # guarantees to never return more than limit. Default is no limit - # @param [Integer] page_size Number of records to fetch per request, when - # not set will use the default value of 50 records. If no page_size is defined - # but a limit is defined, stream() will attempt to read the limit with the most - # efficient page size, i.e. min(limit, 1000) - # @return [Enumerable] Enumerable that will yield up to limit results - def stream(limit: nil, page_size: nil) - limits = @version.read_limits(limit, page_size) - - page = self.page( - page_size: limits[:page_size], ) - - @version.stream(page, limit: limits[:limit], page_limit: limits[:page_limit]) - end - - ## - # When passed a block, yields SyncMapPermissionInstance records from the API. - # This operation lazily loads records as efficiently as possible until the limit - # is reached. - def each - limits = @version.read_limits - - page = self.page(page_size: limits[:page_size], ) - - @version.stream(page, - limit: limits[:limit], - page_limit: limits[:page_limit]).each {|x| yield x} - end - - ## - # Retrieve a single page of SyncMapPermissionInstance records from the API. - # Request is executed immediately. - # @param [String] page_token PageToken provided by the API - # @param [Integer] page_number Page Number, this value is simply for client state - # @param [Integer] page_size Number of records to return, defaults to 50 - # @return [Page] Page of SyncMapPermissionInstance - def page(page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - - response = @version.page('GET', @uri, params: params) - - SyncMapPermissionPage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of SyncMapPermissionInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of SyncMapPermissionInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - SyncMapPermissionPage.new(@version, response, @solution) - end - - - - # Provide a user friendly representation - def to_s - '#' - end - end - - - class SyncMapPermissionContext < InstanceContext - ## - # Initialize the SyncMapPermissionContext - # @param [Version] version Version that contains the resource - # @param [String] service_sid The unique SID identifier of the Sync Service Instance. - # @param [String] map_sid Identifier of the Sync Map. Either a SID or a unique name. - # @param [String] identity Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. - # @return [SyncMapPermissionContext] SyncMapPermissionContext - def initialize(version, service_sid, map_sid, identity) - super(version) - - # Path Solution - @solution = { service_sid: service_sid, map_sid: map_sid, identity: identity, } - @uri = "/Services/#{@solution[:service_sid]}/Maps/#{@solution[:map_sid]}/Permissions/#{@solution[:identity]}" - - - end - ## - # Delete the SyncMapPermissionInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - @version.delete('DELETE', @uri, headers: headers) - end - - ## - # Fetch the SyncMapPermissionInstance - # @return [SyncMapPermissionInstance] Fetched SyncMapPermissionInstance - def fetch - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - payload = @version.fetch('GET', @uri, headers: headers) - SyncMapPermissionInstance.new( - @version, - payload, - service_sid: @solution[:service_sid], - map_sid: @solution[:map_sid], - identity: @solution[:identity], - ) - end - - ## - # Update the SyncMapPermissionInstance - # @param [Boolean] read Boolean flag specifying whether the identity can read the Sync Map. - # @param [Boolean] write Boolean flag specifying whether the identity can create, update and delete Items of the Sync Map. - # @param [Boolean] manage Boolean flag specifying whether the identity can delete the Sync Map. - # @return [SyncMapPermissionInstance] Updated SyncMapPermissionInstance - def update( - read: nil, - write: nil, - manage: nil - ) - - data = Twilio::Values.of({ - 'Read' => read, - 'Write' => write, - 'Manage' => manage, - }) - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - payload = @version.update('POST', @uri, data: data, headers: headers) - SyncMapPermissionInstance.new( - @version, - payload, - service_sid: @solution[:service_sid], - map_sid: @solution[:map_sid], - identity: @solution[:identity], - ) - end - - - ## - # Provide a user friendly representation - def to_s - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') - "#" - end - end - - class SyncMapPermissionPage < Page - ## - # Initialize the SyncMapPermissionPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [SyncMapPermissionPage] SyncMapPermissionPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of SyncMapPermissionInstance - # @param [Hash] payload Payload response from the API - # @return [SyncMapPermissionInstance] SyncMapPermissionInstance - def get_instance(payload) - SyncMapPermissionInstance.new(@version, payload, service_sid: @solution[:service_sid], map_sid: @solution[:map_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class SyncMapPermissionInstance < InstanceResource - ## - # Initialize the SyncMapPermissionInstance - # @param [Version] version Version that contains the resource - # @param [Hash] payload payload that contains response from Twilio - # @param [String] account_sid The SID of the - # {Account}[https://www.twilio.com/docs/iam/api/account] that created this SyncMapPermission - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [SyncMapPermissionInstance] SyncMapPermissionInstance - def initialize(version, payload , service_sid: nil, map_sid: nil, identity: nil) - super(version) - - # Marshaled Properties - @properties = { - 'account_sid' => payload['account_sid'], - 'service_sid' => payload['service_sid'], - 'map_sid' => payload['map_sid'], - 'identity' => payload['identity'], - 'read' => payload['read'], - 'write' => payload['write'], - 'manage' => payload['manage'], - 'url' => payload['url'], - } - - # Context - @instance_context = nil - @params = { 'service_sid' => service_sid || @properties['service_sid'] ,'map_sid' => map_sid || @properties['map_sid'] ,'identity' => identity || @properties['identity'] , } - end - - ## - # Generate an instance context for the instance, the context is capable of - # performing various actions. All instance actions are proxied to the context - # @return [SyncMapPermissionContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = SyncMapPermissionContext.new(@version , @params['service_sid'], @params['map_sid'], @params['identity']) - end - @instance_context - end - - ## - # @return [String] The unique SID identifier of the Twilio Account. - def account_sid - @properties['account_sid'] - end - - ## - # @return [String] The unique SID identifier of the Sync Service Instance. - def service_sid - @properties['service_sid'] - end - - ## - # @return [String] The unique SID identifier of the Sync Map to which the Permission applies. - def map_sid - @properties['map_sid'] - end - - ## - # @return [String] Arbitrary string identifier representing a human user associated with an FPA token, assigned by the developer. - def identity - @properties['identity'] - end - - ## - # @return [Boolean] Boolean flag specifying whether the identity can read the Sync Map and its Items. - def read - @properties['read'] - end - - ## - # @return [Boolean] Boolean flag specifying whether the identity can create, update and delete Items of the Sync Map. - def write - @properties['write'] - end - - ## - # @return [Boolean] Boolean flag specifying whether the identity can delete the Sync Map. - def manage - @properties['manage'] - end - - ## - # @return [String] Contains an absolute URL for this Sync Map Permission. - def url - @properties['url'] - end - - ## - # Delete the SyncMapPermissionInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the SyncMapPermissionInstance - # @return [SyncMapPermissionInstance] Fetched SyncMapPermissionInstance - def fetch - - context.fetch - end - - ## - # Update the SyncMapPermissionInstance - # @param [Boolean] read Boolean flag specifying whether the identity can read the Sync Map. - # @param [Boolean] write Boolean flag specifying whether the identity can create, update and delete Items of the Sync Map. - # @param [Boolean] manage Boolean flag specifying whether the identity can delete the Sync Map. - # @return [SyncMapPermissionInstance] Updated SyncMapPermissionInstance - def update( - read: nil, - write: nil, - manage: nil - ) - - context.update( - read: read, - write: write, - manage: manage, - ) - end - - ## - # Provide a user friendly representation - def to_s - values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") - "" - end - - ## - # Provide a detailed, user friendly representation - def inspect - values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") - "" - end - end - - end - end - end - end - end -end - - diff --git a/lib/twilio-ruby/rest/preview_base.rb b/lib/twilio-ruby/rest/preview_base.rb index 136c76ec1..866ab27fe 100644 --- a/lib/twilio-ruby/rest/preview_base.rb +++ b/lib/twilio-ruby/rest/preview_base.rb @@ -22,7 +22,6 @@ def initialize(twilio) @host = "preview.twilio.com" @port = 443 @hosted_numbers = nil - @sync = nil @marketplace = nil @wireless = nil end @@ -31,10 +30,6 @@ def hosted_numbers @hosted_numbers ||= Preview::HostedNumbers.new self end - def sync - @sync ||= Preview::Sync.new self - end - def marketplace @marketplace ||= Preview::Marketplace.new self end