diff --git a/lib/twilio-ruby/rest/client.rb b/lib/twilio-ruby/rest/client.rb index a3e97c5a0..b0a12eea6 100644 --- a/lib/twilio-ruby/rest/client.rb +++ b/lib/twilio-ruby/rest/client.rb @@ -112,11 +112,6 @@ def messaging @messaging ||= Messaging.new self end ## - # Access the Microvisor Twilio Domain - def microvisor - @microvisor ||= Microvisor.new self - end - ## # Access the Monitor Twilio Domain def monitor @monitor ||= Monitor.new self diff --git a/lib/twilio-ruby/rest/microvisor.rb b/lib/twilio-ruby/rest/microvisor.rb deleted file mode 100644 index 005fcb143..000000000 --- a/lib/twilio-ruby/rest/microvisor.rb +++ /dev/null @@ -1,24 +0,0 @@ -module Twilio - module REST - class Microvisor < MicrovisorBase - - ## - # @param [String] sid A 34-character string that uniquely identifies this App. - # @return [Twilio::REST::Microvisor::V1::AppInstance] if sid was passed. - # @return [Twilio::REST::Microvisor::V1::AppList] - def apps(sid=:unset) - warn "apps is deprecated. Use v1.apps instead." - self.v1.apps(sid) - end - - ## - # @param [String] sid A 34-character string that uniquely identifies this Device. - # @return [Twilio::REST::Microvisor::V1::DeviceInstance] if sid was passed. - # @return [Twilio::REST::Microvisor::V1::DeviceList] - def devices(sid=:unset) - warn "devices is deprecated. Use v1.devices instead." - self.v1.devices(sid) - end - end - end -end diff --git a/lib/twilio-ruby/rest/microvisor/v1.rb b/lib/twilio-ruby/rest/microvisor/v1.rb deleted file mode 100644 index edfd907c7..000000000 --- a/lib/twilio-ruby/rest/microvisor/v1.rb +++ /dev/null @@ -1,94 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Microvisor -# 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 Microvisor - class V1 < Version - ## - # Initialize the V1 version of Microvisor - def initialize(domain) - super - @version = 'v1' - @account_configs = nil - @account_secrets = nil - @apps = nil - @devices = nil - end - - ## - # @param [String] key The config key; up to 100 characters. - # @return [Twilio::REST::Microvisor::V1::AccountConfigContext] if key was passed. - # @return [Twilio::REST::Microvisor::V1::AccountConfigList] - def account_configs(key=:unset) - if key.nil? - raise ArgumentError, 'key cannot be nil' - end - if key == :unset - @account_configs ||= AccountConfigList.new self - else - AccountConfigContext.new(self, key) - end - end - ## - # @param [String] key The secret key; up to 100 characters. - # @return [Twilio::REST::Microvisor::V1::AccountSecretContext] if key was passed. - # @return [Twilio::REST::Microvisor::V1::AccountSecretList] - def account_secrets(key=:unset) - if key.nil? - raise ArgumentError, 'key cannot be nil' - end - if key == :unset - @account_secrets ||= AccountSecretList.new self - else - AccountSecretContext.new(self, key) - end - end - ## - # @param [String] sid A 34-character string that uniquely identifies this App. - # @return [Twilio::REST::Microvisor::V1::AppContext] if sid was passed. - # @return [Twilio::REST::Microvisor::V1::AppList] - def apps(sid=:unset) - if sid.nil? - raise ArgumentError, 'sid cannot be nil' - end - if sid == :unset - @apps ||= AppList.new self - else - AppContext.new(self, sid) - end - end - ## - # @param [String] sid A 34-character string that uniquely identifies this Device. - # @return [Twilio::REST::Microvisor::V1::DeviceContext] if sid was passed. - # @return [Twilio::REST::Microvisor::V1::DeviceList] - def devices(sid=:unset) - if sid.nil? - raise ArgumentError, 'sid cannot be nil' - end - if sid == :unset - @devices ||= DeviceList.new self - else - DeviceContext.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/microvisor/v1/account_config.rb b/lib/twilio-ruby/rest/microvisor/v1/account_config.rb deleted file mode 100644 index 97c1cec7d..000000000 --- a/lib/twilio-ruby/rest/microvisor/v1/account_config.rb +++ /dev/null @@ -1,382 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Microvisor -# 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 Microvisor < MicrovisorBase - class V1 < Version - class AccountConfigList < ListResource - - ## - # Initialize the AccountConfigList - # @param [Version] version Version that contains the resource - # @return [AccountConfigList] AccountConfigList - def initialize(version) - super(version) - # Path Solution - @solution = { } - @uri = "/Configs" - - end - ## - # Create the AccountConfigInstance - # @param [String] key The config key; up to 100 characters. - # @param [String] value The config value; up to 4096 characters. - # @return [AccountConfigInstance] Created AccountConfigInstance - def create( - key: nil, - value: nil - ) - - data = Twilio::Values.of({ - 'Key' => key, - 'Value' => value, - }) - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - - - - - payload = @version.create('POST', @uri, data: data, headers: headers) - AccountConfigInstance.new( - @version, - payload, - ) - end - - - ## - # Lists AccountConfigInstance 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 AccountConfigInstance 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 AccountConfigInstance 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 AccountConfigInstance - def page(page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - headers = Twilio::Values.of({}) - - - - response = @version.page('GET', @uri, params: params, headers: headers) - - AccountConfigPage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of AccountConfigInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of AccountConfigInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - AccountConfigPage.new(@version, response, @solution) - end - - - - # Provide a user friendly representation - def to_s - '#' - end - end - - - class AccountConfigContext < InstanceContext - ## - # Initialize the AccountConfigContext - # @param [Version] version Version that contains the resource - # @param [String] key The config key; up to 100 characters. - # @return [AccountConfigContext] AccountConfigContext - def initialize(version, key) - super(version) - - # Path Solution - @solution = { key: key, } - @uri = "/Configs/#{@solution[:key]}" - - - end - ## - # Delete the AccountConfigInstance - # @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 AccountConfigInstance - # @return [AccountConfigInstance] Fetched AccountConfigInstance - def fetch - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - - - - - payload = @version.fetch('GET', @uri, headers: headers) - AccountConfigInstance.new( - @version, - payload, - key: @solution[:key], - ) - end - - ## - # Update the AccountConfigInstance - # @param [String] value The config value; up to 4096 characters. - # @return [AccountConfigInstance] Updated AccountConfigInstance - def update( - value: nil - ) - - data = Twilio::Values.of({ - 'Value' => value, - }) - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - - - - - payload = @version.update('POST', @uri, data: data, headers: headers) - AccountConfigInstance.new( - @version, - payload, - 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 AccountConfigPage < Page - ## - # Initialize the AccountConfigPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [AccountConfigPage] AccountConfigPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of AccountConfigInstance - # @param [Hash] payload Payload response from the API - # @return [AccountConfigInstance] AccountConfigInstance - def get_instance(payload) - AccountConfigInstance.new(@version, payload) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class AccountConfigInstance < InstanceResource - ## - # Initialize the AccountConfigInstance - # @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 AccountConfig - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [AccountConfigInstance] AccountConfigInstance - def initialize(version, payload , key: nil) - super(version) - - # Marshaled Properties - @properties = { - 'key' => payload['key'], - 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), - 'value' => payload['value'], - 'url' => payload['url'], - } - - # Context - @instance_context = nil - @params = { '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 [AccountConfigContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = AccountConfigContext.new(@version , @params['key']) - end - @instance_context - end - - ## - # @return [String] The config key; up to 100 characters. - def key - @properties['key'] - end - - ## - # @return [Time] - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] The config value; up to 4096 characters. - def value - @properties['value'] - end - - ## - # @return [String] The absolute URL of the Config. - def url - @properties['url'] - end - - ## - # Delete the AccountConfigInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the AccountConfigInstance - # @return [AccountConfigInstance] Fetched AccountConfigInstance - def fetch - - context.fetch - end - - ## - # Update the AccountConfigInstance - # @param [String] value The config value; up to 4096 characters. - # @return [AccountConfigInstance] Updated AccountConfigInstance - def update( - value: nil - ) - - context.update( - value: value, - ) - 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/microvisor/v1/account_secret.rb b/lib/twilio-ruby/rest/microvisor/v1/account_secret.rb deleted file mode 100644 index 90472c4ec..000000000 --- a/lib/twilio-ruby/rest/microvisor/v1/account_secret.rb +++ /dev/null @@ -1,375 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Microvisor -# 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 Microvisor < MicrovisorBase - class V1 < Version - class AccountSecretList < ListResource - - ## - # Initialize the AccountSecretList - # @param [Version] version Version that contains the resource - # @return [AccountSecretList] AccountSecretList - def initialize(version) - super(version) - # Path Solution - @solution = { } - @uri = "/Secrets" - - end - ## - # Create the AccountSecretInstance - # @param [String] key The secret key; up to 100 characters. - # @param [String] value The secret value; up to 4096 characters. - # @return [AccountSecretInstance] Created AccountSecretInstance - def create( - key: nil, - value: nil - ) - - data = Twilio::Values.of({ - 'Key' => key, - 'Value' => value, - }) - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - - - - - payload = @version.create('POST', @uri, data: data, headers: headers) - AccountSecretInstance.new( - @version, - payload, - ) - end - - - ## - # Lists AccountSecretInstance 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 AccountSecretInstance 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 AccountSecretInstance 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 AccountSecretInstance - def page(page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - headers = Twilio::Values.of({}) - - - - response = @version.page('GET', @uri, params: params, headers: headers) - - AccountSecretPage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of AccountSecretInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of AccountSecretInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - AccountSecretPage.new(@version, response, @solution) - end - - - - # Provide a user friendly representation - def to_s - '#' - end - end - - - class AccountSecretContext < InstanceContext - ## - # Initialize the AccountSecretContext - # @param [Version] version Version that contains the resource - # @param [String] key The secret key; up to 100 characters. - # @return [AccountSecretContext] AccountSecretContext - def initialize(version, key) - super(version) - - # Path Solution - @solution = { key: key, } - @uri = "/Secrets/#{@solution[:key]}" - - - end - ## - # Delete the AccountSecretInstance - # @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 AccountSecretInstance - # @return [AccountSecretInstance] Fetched AccountSecretInstance - def fetch - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - - - - - payload = @version.fetch('GET', @uri, headers: headers) - AccountSecretInstance.new( - @version, - payload, - key: @solution[:key], - ) - end - - ## - # Update the AccountSecretInstance - # @param [String] value The secret value; up to 4096 characters. - # @return [AccountSecretInstance] Updated AccountSecretInstance - def update( - value: nil - ) - - data = Twilio::Values.of({ - 'Value' => value, - }) - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - - - - - payload = @version.update('POST', @uri, data: data, headers: headers) - AccountSecretInstance.new( - @version, - payload, - 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 AccountSecretPage < Page - ## - # Initialize the AccountSecretPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [AccountSecretPage] AccountSecretPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of AccountSecretInstance - # @param [Hash] payload Payload response from the API - # @return [AccountSecretInstance] AccountSecretInstance - def get_instance(payload) - AccountSecretInstance.new(@version, payload) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class AccountSecretInstance < InstanceResource - ## - # Initialize the AccountSecretInstance - # @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 AccountSecret - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [AccountSecretInstance] AccountSecretInstance - def initialize(version, payload , key: nil) - super(version) - - # Marshaled Properties - @properties = { - 'key' => payload['key'], - 'date_rotated' => Twilio.deserialize_iso8601_datetime(payload['date_rotated']), - 'url' => payload['url'], - } - - # Context - @instance_context = nil - @params = { '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 [AccountSecretContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = AccountSecretContext.new(@version , @params['key']) - end - @instance_context - end - - ## - # @return [String] The secret key; up to 100 characters. - def key - @properties['key'] - end - - ## - # @return [Time] - def date_rotated - @properties['date_rotated'] - end - - ## - # @return [String] The absolute URL of the Secret. - def url - @properties['url'] - end - - ## - # Delete the AccountSecretInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the AccountSecretInstance - # @return [AccountSecretInstance] Fetched AccountSecretInstance - def fetch - - context.fetch - end - - ## - # Update the AccountSecretInstance - # @param [String] value The secret value; up to 4096 characters. - # @return [AccountSecretInstance] Updated AccountSecretInstance - def update( - value: nil - ) - - context.update( - value: value, - ) - 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/microvisor/v1/app.rb b/lib/twilio-ruby/rest/microvisor/v1/app.rb deleted file mode 100644 index 6c212493b..000000000 --- a/lib/twilio-ruby/rest/microvisor/v1/app.rb +++ /dev/null @@ -1,361 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Microvisor -# 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 Microvisor < MicrovisorBase - class V1 < Version - class AppList < ListResource - - ## - # Initialize the AppList - # @param [Version] version Version that contains the resource - # @return [AppList] AppList - def initialize(version) - super(version) - # Path Solution - @solution = { } - @uri = "/Apps" - - end - - ## - # Lists AppInstance 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 AppInstance 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 AppInstance 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 AppInstance - def page(page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - headers = Twilio::Values.of({}) - - - - response = @version.page('GET', @uri, params: params, headers: headers) - - AppPage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of AppInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of AppInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - AppPage.new(@version, response, @solution) - end - - - - # Provide a user friendly representation - def to_s - '#' - end - end - - - class AppContext < InstanceContext - ## - # Initialize the AppContext - # @param [Version] version Version that contains the resource - # @param [String] sid A 34-character string that uniquely identifies this App. - # @return [AppContext] AppContext - def initialize(version, sid) - super(version) - - # Path Solution - @solution = { sid: sid, } - @uri = "/Apps/#{@solution[:sid]}" - - # Dependents - @app_manifests = nil - end - ## - # Delete the AppInstance - # @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 AppInstance - # @return [AppInstance] Fetched AppInstance - def fetch - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - - - - - payload = @version.fetch('GET', @uri, headers: headers) - AppInstance.new( - @version, - payload, - sid: @solution[:sid], - ) - end - - ## - # Access the app_manifests - # @return [AppManifestList] - # @return [AppManifestContext] - def app_manifests - AppManifestContext.new( - @version, - @solution[:sid] - ) - 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 AppPage < Page - ## - # Initialize the AppPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [AppPage] AppPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of AppInstance - # @param [Hash] payload Payload response from the API - # @return [AppInstance] AppInstance - def get_instance(payload) - AppInstance.new(@version, payload) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class AppInstance < InstanceResource - ## - # Initialize the AppInstance - # @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 App - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [AppInstance] AppInstance - def initialize(version, payload , sid: nil) - super(version) - - # Marshaled Properties - @properties = { - 'sid' => payload['sid'], - 'account_sid' => payload['account_sid'], - 'hash' => payload['hash'], - 'unique_name' => payload['unique_name'], - 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), - 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), - 'url' => payload['url'], - '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 [AppContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = AppContext.new(@version , @params['sid']) - end - @instance_context - end - - ## - # @return [String] A 34-character string that uniquely identifies this App. - def sid - @properties['sid'] - end - - ## - # @return [String] The unique SID identifier of the Account. - def account_sid - @properties['account_sid'] - end - - ## - # @return [String] App manifest hash represented as `hash_algorithm:hash_value`. - def hash - @properties['hash'] - end - - ## - # @return [String] A developer-defined string that uniquely identifies the App. This value must be unique for all Apps on this Account. The `unique_name` value may be used as an alternative to the `sid` in the URL path to address the resource. - def unique_name - @properties['unique_name'] - end - - ## - # @return [Time] The date that this App was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - def date_created - @properties['date_created'] - end - - ## - # @return [Time] The date that this App was last updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] The URL of this resource. - def url - @properties['url'] - end - - ## - # @return [Hash] - def links - @properties['links'] - end - - ## - # Delete the AppInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the AppInstance - # @return [AppInstance] Fetched AppInstance - def fetch - - context.fetch - end - - ## - # Access the app_manifests - # @return [app_manifests] app_manifests - def app_manifests - context.app_manifests - 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/microvisor/v1/app/app_manifest.rb b/lib/twilio-ruby/rest/microvisor/v1/app/app_manifest.rb deleted file mode 100644 index 81a6418d9..000000000 --- a/lib/twilio-ruby/rest/microvisor/v1/app/app_manifest.rb +++ /dev/null @@ -1,213 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Microvisor -# 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 Microvisor < MicrovisorBase - class V1 < Version - class AppContext < InstanceContext - - class AppManifestList < ListResource - - ## - # Initialize the AppManifestList - # @param [Version] version Version that contains the resource - # @return [AppManifestList] AppManifestList - def initialize(version, app_sid: nil) - super(version) - # Path Solution - @solution = { app_sid: app_sid } - - - end - - - - # Provide a user friendly representation - def to_s - '#' - end - end - - - class AppManifestContext < InstanceContext - ## - # Initialize the AppManifestContext - # @param [Version] version Version that contains the resource - # @param [String] app_sid A 34-character string that uniquely identifies this App. - # @return [AppManifestContext] AppManifestContext - def initialize(version, app_sid) - super(version) - - # Path Solution - @solution = { app_sid: app_sid, } - @uri = "/Apps/#{@solution[:app_sid]}/Manifest" - - - end - ## - # Fetch the AppManifestInstance - # @return [AppManifestInstance] Fetched AppManifestInstance - def fetch - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - - - - - payload = @version.fetch('GET', @uri, headers: headers) - AppManifestInstance.new( - @version, - payload, - app_sid: @solution[:app_sid], - ) - 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 AppManifestPage < Page - ## - # Initialize the AppManifestPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [AppManifestPage] AppManifestPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of AppManifestInstance - # @param [Hash] payload Payload response from the API - # @return [AppManifestInstance] AppManifestInstance - def get_instance(payload) - AppManifestInstance.new(@version, payload, app_sid: @solution[:app_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class AppManifestInstance < InstanceResource - ## - # Initialize the AppManifestInstance - # @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 AppManifest - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [AppManifestInstance] AppManifestInstance - def initialize(version, payload , app_sid: nil) - super(version) - - # Marshaled Properties - @properties = { - 'app_sid' => payload['app_sid'], - 'hash' => payload['hash'], - 'encoded_bytes' => payload['encoded_bytes'], - 'url' => payload['url'], - } - - # Context - @instance_context = nil - @params = { 'app_sid' => app_sid || @properties['app_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 [AppManifestContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = AppManifestContext.new(@version , @params['app_sid']) - end - @instance_context - end - - ## - # @return [String] A 34-character string that uniquely identifies this App. - def app_sid - @properties['app_sid'] - end - - ## - # @return [String] App manifest hash represented as `hash_algorithm:hash_value`. - def hash - @properties['hash'] - end - - ## - # @return [String] The base-64 encoded manifest - def encoded_bytes - @properties['encoded_bytes'] - end - - ## - # @return [String] The absolute URL of this Manifest. - def url - @properties['url'] - end - - ## - # Fetch the AppManifestInstance - # @return [AppManifestInstance] Fetched AppManifestInstance - def fetch - - context.fetch - 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/microvisor/v1/device.rb b/lib/twilio-ruby/rest/microvisor/v1/device.rb deleted file mode 100644 index e616ad19b..000000000 --- a/lib/twilio-ruby/rest/microvisor/v1/device.rb +++ /dev/null @@ -1,441 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Microvisor -# 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 Microvisor < MicrovisorBase - class V1 < Version - class DeviceList < ListResource - - ## - # Initialize the DeviceList - # @param [Version] version Version that contains the resource - # @return [DeviceList] DeviceList - def initialize(version) - super(version) - # Path Solution - @solution = { } - @uri = "/Devices" - - end - - ## - # Lists DeviceInstance 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 DeviceInstance 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 DeviceInstance 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 DeviceInstance - def page(page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - headers = Twilio::Values.of({}) - - - - response = @version.page('GET', @uri, params: params, headers: headers) - - DevicePage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of DeviceInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of DeviceInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - DevicePage.new(@version, response, @solution) - end - - - - # Provide a user friendly representation - def to_s - '#' - end - end - - - class DeviceContext < InstanceContext - ## - # Initialize the DeviceContext - # @param [Version] version Version that contains the resource - # @param [String] sid A 34-character string that uniquely identifies this Device. - # @return [DeviceContext] DeviceContext - def initialize(version, sid) - super(version) - - # Path Solution - @solution = { sid: sid, } - @uri = "/Devices/#{@solution[:sid]}" - - # Dependents - @device_secrets = nil - @device_configs = nil - end - ## - # Fetch the DeviceInstance - # @return [DeviceInstance] Fetched DeviceInstance - def fetch - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - - - - - payload = @version.fetch('GET', @uri, headers: headers) - DeviceInstance.new( - @version, - payload, - sid: @solution[:sid], - ) - end - - ## - # Update the DeviceInstance - # @param [String] unique_name A unique and addressable name to be assigned to this Device by the developer. It may be used in place of the Device SID. - # @param [String] target_app The SID or unique name of the App to be targeted to the Device. - # @param [Boolean] logging_enabled A Boolean flag specifying whether to enable application logging. Logs will be enabled or extended for 24 hours. - # @param [Boolean] restart_app Set to true to restart the App running on the Device. - # @return [DeviceInstance] Updated DeviceInstance - def update( - unique_name: :unset, - target_app: :unset, - logging_enabled: :unset, - restart_app: :unset - ) - - data = Twilio::Values.of({ - 'UniqueName' => unique_name, - 'TargetApp' => target_app, - 'LoggingEnabled' => logging_enabled, - 'RestartApp' => restart_app, - }) - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - - - - - payload = @version.update('POST', @uri, data: data, headers: headers) - DeviceInstance.new( - @version, - payload, - sid: @solution[:sid], - ) - end - - ## - # Access the device_secrets - # @return [DeviceSecretList] - # @return [DeviceSecretContext] if sid was passed. - def device_secrets(key=:unset) - - raise ArgumentError, 'key cannot be nil' if key.nil? - - if key != :unset - return DeviceSecretContext.new(@version, @solution[:sid],key ) - end - - unless @device_secrets - @device_secrets = DeviceSecretList.new( - @version, device_sid: @solution[:sid], ) - end - - @device_secrets - end - ## - # Access the device_configs - # @return [DeviceConfigList] - # @return [DeviceConfigContext] if sid was passed. - def device_configs(key=:unset) - - raise ArgumentError, 'key cannot be nil' if key.nil? - - if key != :unset - return DeviceConfigContext.new(@version, @solution[:sid],key ) - end - - unless @device_configs - @device_configs = DeviceConfigList.new( - @version, device_sid: @solution[:sid], ) - end - - @device_configs - 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 DevicePage < Page - ## - # Initialize the DevicePage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [DevicePage] DevicePage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of DeviceInstance - # @param [Hash] payload Payload response from the API - # @return [DeviceInstance] DeviceInstance - def get_instance(payload) - DeviceInstance.new(@version, payload) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class DeviceInstance < InstanceResource - ## - # Initialize the DeviceInstance - # @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 Device - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [DeviceInstance] DeviceInstance - def initialize(version, payload , sid: nil) - super(version) - - # Marshaled Properties - @properties = { - 'sid' => payload['sid'], - 'unique_name' => payload['unique_name'], - 'account_sid' => payload['account_sid'], - 'app' => payload['app'], - 'logging' => payload['logging'], - 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), - 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), - 'url' => payload['url'], - '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 [DeviceContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = DeviceContext.new(@version , @params['sid']) - end - @instance_context - end - - ## - # @return [String] A 34-character string that uniquely identifies this Device. - def sid - @properties['sid'] - end - - ## - # @return [String] A developer-defined string that uniquely identifies the Device. This value must be unique for all Devices on this Account. The `unique_name` value may be used as an alternative to the `sid` in the URL path to address the resource. - def unique_name - @properties['unique_name'] - end - - ## - # @return [String] The unique SID identifier of the Account. - def account_sid - @properties['account_sid'] - end - - ## - # @return [Hash] Information about the target App and the App reported by this Device. Contains the properties `target_sid`, `date_targeted`, `update_status` (one of `up-to-date`, `pending` and `error`), `update_error_code`, `reported_sid` and `date_reported`. - def app - @properties['app'] - end - - ## - # @return [Hash] Object specifying whether application logging is enabled for this Device. Contains the properties `enabled` and `date_expires`. - def logging - @properties['logging'] - end - - ## - # @return [Time] The date that this Device was created, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - def date_created - @properties['date_created'] - end - - ## - # @return [Time] The date that this Device was last updated, given in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format. - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] The URL of this resource. - def url - @properties['url'] - end - - ## - # @return [Hash] The absolute URLs of related resources. - def links - @properties['links'] - end - - ## - # Fetch the DeviceInstance - # @return [DeviceInstance] Fetched DeviceInstance - def fetch - - context.fetch - end - - ## - # Update the DeviceInstance - # @param [String] unique_name A unique and addressable name to be assigned to this Device by the developer. It may be used in place of the Device SID. - # @param [String] target_app The SID or unique name of the App to be targeted to the Device. - # @param [Boolean] logging_enabled A Boolean flag specifying whether to enable application logging. Logs will be enabled or extended for 24 hours. - # @param [Boolean] restart_app Set to true to restart the App running on the Device. - # @return [DeviceInstance] Updated DeviceInstance - def update( - unique_name: :unset, - target_app: :unset, - logging_enabled: :unset, - restart_app: :unset - ) - - context.update( - unique_name: unique_name, - target_app: target_app, - logging_enabled: logging_enabled, - restart_app: restart_app, - ) - end - - ## - # Access the device_secrets - # @return [device_secrets] device_secrets - def device_secrets - context.device_secrets - end - - ## - # Access the device_configs - # @return [device_configs] device_configs - def device_configs - context.device_configs - 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/microvisor/v1/device/device_config.rb b/lib/twilio-ruby/rest/microvisor/v1/device/device_config.rb deleted file mode 100644 index 4241620a9..000000000 --- a/lib/twilio-ruby/rest/microvisor/v1/device/device_config.rb +++ /dev/null @@ -1,398 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Microvisor -# 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 Microvisor < MicrovisorBase - class V1 < Version - class DeviceContext < InstanceContext - - class DeviceConfigList < ListResource - - ## - # Initialize the DeviceConfigList - # @param [Version] version Version that contains the resource - # @return [DeviceConfigList] DeviceConfigList - def initialize(version, device_sid: nil) - super(version) - # Path Solution - @solution = { device_sid: device_sid } - @uri = "/Devices/#{@solution[:device_sid]}/Configs" - - end - ## - # Create the DeviceConfigInstance - # @param [String] key The config key; up to 100 characters. - # @param [String] value The config value; up to 4096 characters. - # @return [DeviceConfigInstance] Created DeviceConfigInstance - def create( - key: nil, - value: nil - ) - - data = Twilio::Values.of({ - 'Key' => key, - 'Value' => value, - }) - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - - - - - payload = @version.create('POST', @uri, data: data, headers: headers) - DeviceConfigInstance.new( - @version, - payload, - device_sid: @solution[:device_sid], - ) - end - - - ## - # Lists DeviceConfigInstance 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 DeviceConfigInstance 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 DeviceConfigInstance 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 DeviceConfigInstance - def page(page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - headers = Twilio::Values.of({}) - - - - response = @version.page('GET', @uri, params: params, headers: headers) - - DeviceConfigPage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of DeviceConfigInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of DeviceConfigInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - DeviceConfigPage.new(@version, response, @solution) - end - - - - # Provide a user friendly representation - def to_s - '#' - end - end - - - class DeviceConfigContext < InstanceContext - ## - # Initialize the DeviceConfigContext - # @param [Version] version Version that contains the resource - # @param [String] device_sid A 34-character string that uniquely identifies the Device. - # @param [String] key The config key; up to 100 characters. - # @return [DeviceConfigContext] DeviceConfigContext - def initialize(version, device_sid, key) - super(version) - - # Path Solution - @solution = { device_sid: device_sid, key: key, } - @uri = "/Devices/#{@solution[:device_sid]}/Configs/#{@solution[:key]}" - - - end - ## - # Delete the DeviceConfigInstance - # @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 DeviceConfigInstance - # @return [DeviceConfigInstance] Fetched DeviceConfigInstance - def fetch - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - - - - - payload = @version.fetch('GET', @uri, headers: headers) - DeviceConfigInstance.new( - @version, - payload, - device_sid: @solution[:device_sid], - key: @solution[:key], - ) - end - - ## - # Update the DeviceConfigInstance - # @param [String] value The config value; up to 4096 characters. - # @return [DeviceConfigInstance] Updated DeviceConfigInstance - def update( - value: nil - ) - - data = Twilio::Values.of({ - 'Value' => value, - }) - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - - - - - payload = @version.update('POST', @uri, data: data, headers: headers) - DeviceConfigInstance.new( - @version, - payload, - device_sid: @solution[:device_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 DeviceConfigPage < Page - ## - # Initialize the DeviceConfigPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [DeviceConfigPage] DeviceConfigPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of DeviceConfigInstance - # @param [Hash] payload Payload response from the API - # @return [DeviceConfigInstance] DeviceConfigInstance - def get_instance(payload) - DeviceConfigInstance.new(@version, payload, device_sid: @solution[:device_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class DeviceConfigInstance < InstanceResource - ## - # Initialize the DeviceConfigInstance - # @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 DeviceConfig - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [DeviceConfigInstance] DeviceConfigInstance - def initialize(version, payload , device_sid: nil, key: nil) - super(version) - - # Marshaled Properties - @properties = { - 'device_sid' => payload['device_sid'], - 'key' => payload['key'], - 'value' => payload['value'], - 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), - 'url' => payload['url'], - } - - # Context - @instance_context = nil - @params = { 'device_sid' => device_sid || @properties['device_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 [DeviceConfigContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = DeviceConfigContext.new(@version , @params['device_sid'], @params['key']) - end - @instance_context - end - - ## - # @return [String] A 34-character string that uniquely identifies the parent Device. - def device_sid - @properties['device_sid'] - end - - ## - # @return [String] The config key; up to 100 characters. - def key - @properties['key'] - end - - ## - # @return [String] The config value; up to 4096 characters. - def value - @properties['value'] - end - - ## - # @return [Time] - def date_updated - @properties['date_updated'] - end - - ## - # @return [String] The absolute URL of the Config. - def url - @properties['url'] - end - - ## - # Delete the DeviceConfigInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the DeviceConfigInstance - # @return [DeviceConfigInstance] Fetched DeviceConfigInstance - def fetch - - context.fetch - end - - ## - # Update the DeviceConfigInstance - # @param [String] value The config value; up to 4096 characters. - # @return [DeviceConfigInstance] Updated DeviceConfigInstance - def update( - value: nil - ) - - context.update( - value: value, - ) - 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/microvisor/v1/device/device_secret.rb b/lib/twilio-ruby/rest/microvisor/v1/device/device_secret.rb deleted file mode 100644 index 1efbf0fec..000000000 --- a/lib/twilio-ruby/rest/microvisor/v1/device/device_secret.rb +++ /dev/null @@ -1,391 +0,0 @@ -## -# This code was generated by -# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ -# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ -# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ -# -# Twilio - Microvisor -# 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 Microvisor < MicrovisorBase - class V1 < Version - class DeviceContext < InstanceContext - - class DeviceSecretList < ListResource - - ## - # Initialize the DeviceSecretList - # @param [Version] version Version that contains the resource - # @return [DeviceSecretList] DeviceSecretList - def initialize(version, device_sid: nil) - super(version) - # Path Solution - @solution = { device_sid: device_sid } - @uri = "/Devices/#{@solution[:device_sid]}/Secrets" - - end - ## - # Create the DeviceSecretInstance - # @param [String] key The secret key; up to 100 characters. - # @param [String] value The secret value; up to 4096 characters. - # @return [DeviceSecretInstance] Created DeviceSecretInstance - def create( - key: nil, - value: nil - ) - - data = Twilio::Values.of({ - 'Key' => key, - 'Value' => value, - }) - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - - - - - payload = @version.create('POST', @uri, data: data, headers: headers) - DeviceSecretInstance.new( - @version, - payload, - device_sid: @solution[:device_sid], - ) - end - - - ## - # Lists DeviceSecretInstance 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 DeviceSecretInstance 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 DeviceSecretInstance 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 DeviceSecretInstance - def page(page_token: :unset, page_number: :unset, page_size: :unset) - params = Twilio::Values.of({ - 'PageToken' => page_token, - 'Page' => page_number, - 'PageSize' => page_size, - }) - headers = Twilio::Values.of({}) - - - - response = @version.page('GET', @uri, params: params, headers: headers) - - DeviceSecretPage.new(@version, response, @solution) - end - - ## - # Retrieve a single page of DeviceSecretInstance records from the API. - # Request is executed immediately. - # @param [String] target_url API-generated URL for the requested results page - # @return [Page] Page of DeviceSecretInstance - def get_page(target_url) - response = @version.domain.request( - 'GET', - target_url - ) - DeviceSecretPage.new(@version, response, @solution) - end - - - - # Provide a user friendly representation - def to_s - '#' - end - end - - - class DeviceSecretContext < InstanceContext - ## - # Initialize the DeviceSecretContext - # @param [Version] version Version that contains the resource - # @param [String] device_sid A 34-character string that uniquely identifies the Device. - # @param [String] key The secret key; up to 100 characters. - # @return [DeviceSecretContext] DeviceSecretContext - def initialize(version, device_sid, key) - super(version) - - # Path Solution - @solution = { device_sid: device_sid, key: key, } - @uri = "/Devices/#{@solution[:device_sid]}/Secrets/#{@solution[:key]}" - - - end - ## - # Delete the DeviceSecretInstance - # @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 DeviceSecretInstance - # @return [DeviceSecretInstance] Fetched DeviceSecretInstance - def fetch - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - - - - - payload = @version.fetch('GET', @uri, headers: headers) - DeviceSecretInstance.new( - @version, - payload, - device_sid: @solution[:device_sid], - key: @solution[:key], - ) - end - - ## - # Update the DeviceSecretInstance - # @param [String] value The secret value; up to 4096 characters. - # @return [DeviceSecretInstance] Updated DeviceSecretInstance - def update( - value: nil - ) - - data = Twilio::Values.of({ - 'Value' => value, - }) - - headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) - - - - - - payload = @version.update('POST', @uri, data: data, headers: headers) - DeviceSecretInstance.new( - @version, - payload, - device_sid: @solution[:device_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 DeviceSecretPage < Page - ## - # Initialize the DeviceSecretPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [DeviceSecretPage] DeviceSecretPage - def initialize(version, response, solution) - super(version, response) - - # Path Solution - @solution = solution - end - - ## - # Build an instance of DeviceSecretInstance - # @param [Hash] payload Payload response from the API - # @return [DeviceSecretInstance] DeviceSecretInstance - def get_instance(payload) - DeviceSecretInstance.new(@version, payload, device_sid: @solution[:device_sid]) - end - - ## - # Provide a user friendly representation - def to_s - '' - end - end - class DeviceSecretInstance < InstanceResource - ## - # Initialize the DeviceSecretInstance - # @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 DeviceSecret - # resource. - # @param [String] sid The SID of the Call resource to fetch. - # @return [DeviceSecretInstance] DeviceSecretInstance - def initialize(version, payload , device_sid: nil, key: nil) - super(version) - - # Marshaled Properties - @properties = { - 'device_sid' => payload['device_sid'], - 'key' => payload['key'], - 'date_rotated' => Twilio.deserialize_iso8601_datetime(payload['date_rotated']), - 'url' => payload['url'], - } - - # Context - @instance_context = nil - @params = { 'device_sid' => device_sid || @properties['device_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 [DeviceSecretContext] CallContext for this CallInstance - def context - unless @instance_context - @instance_context = DeviceSecretContext.new(@version , @params['device_sid'], @params['key']) - end - @instance_context - end - - ## - # @return [String] A 34-character string that uniquely identifies the parent Device. - def device_sid - @properties['device_sid'] - end - - ## - # @return [String] The secret key; up to 100 characters. - def key - @properties['key'] - end - - ## - # @return [Time] - def date_rotated - @properties['date_rotated'] - end - - ## - # @return [String] The absolute URL of the Secret. - def url - @properties['url'] - end - - ## - # Delete the DeviceSecretInstance - # @return [Boolean] True if delete succeeds, false otherwise - def delete - - context.delete - end - - ## - # Fetch the DeviceSecretInstance - # @return [DeviceSecretInstance] Fetched DeviceSecretInstance - def fetch - - context.fetch - end - - ## - # Update the DeviceSecretInstance - # @param [String] value The secret value; up to 4096 characters. - # @return [DeviceSecretInstance] Updated DeviceSecretInstance - def update( - value: nil - ) - - context.update( - value: value, - ) - 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/microvisor_base.rb b/lib/twilio-ruby/rest/microvisor_base.rb deleted file mode 100644 index 573599a1f..000000000 --- a/lib/twilio-ruby/rest/microvisor_base.rb +++ /dev/null @@ -1,38 +0,0 @@ -## - # This code was generated by - # ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ - # | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ - # | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ - # - # NOTE: This class is auto generated by OpenAPI Generator. - # https://openapi-generator.tech - # Do not edit the class manually. -# frozen_string_literal: true -module Twilio - module REST - class MicrovisorBase < Domain - ## - # Initialize microvisor domain - # - # @param twilio - The twilio client - # - def initialize(twilio) - super(twilio) - @base_url = "https://microvisor.twilio.com" - @host = "microvisor.twilio.com" - @port = 443 - @v1 = nil - end - - def v1 - @v1 ||= Microvisor::V1.new self - end - - ## - # Provide a user friendly representation - def to_s - ''; - end - end - end -end