## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / # # frozen_string_literal: true module Twilio module REST class Bulkexports < Domain class V1 < Version ## # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution. class ExportConfigurationList < ListResource ## # Initialize the ExportConfigurationList # @param [Version] version Version that contains the resource # @return [ExportConfigurationList] ExportConfigurationList def initialize(version) super(version) # Path Solution @solution = {} end ## # Provide a user friendly representation def to_s '#' end end ## # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution. class ExportConfigurationPage < Page ## # Initialize the ExportConfigurationPage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @return [ExportConfigurationPage] ExportConfigurationPage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of ExportConfigurationInstance # @param [Hash] payload Payload response from the API # @return [ExportConfigurationInstance] ExportConfigurationInstance def get_instance(payload) ExportConfigurationInstance.new(@version, payload, ) end ## # Provide a user friendly representation def to_s '' end end ## # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution. class ExportConfigurationContext < InstanceContext ## # Initialize the ExportConfigurationContext # @param [Version] version Version that contains the resource # @param [String] resource_type The type of communication – Messages, Calls # @return [ExportConfigurationContext] ExportConfigurationContext def initialize(version, resource_type) super(version) # Path Solution @solution = {resource_type: resource_type, } @uri = "/Exports/#{@solution[:resource_type]}/Configuration" end ## # Fetch a ExportConfigurationInstance # @return [ExportConfigurationInstance] Fetched ExportConfigurationInstance def fetch params = Twilio::Values.of({}) payload = @version.fetch( 'GET', @uri, params, ) ExportConfigurationInstance.new(@version, payload, resource_type: @solution[:resource_type], ) end ## # Update the ExportConfigurationInstance # @param [Boolean] enabled If true, Twilio will automatically generate every day's # file when the day is over. # @param [String] webhook_url Stores the URL destination for the method specified # in webhook_method. # @param [String] webhook_method Sets whether Twilio should call a webhook URL # when the automatic generation is complete, using GET or POST. The actual # destination is set in the webhook_url # @return [ExportConfigurationInstance] Updated ExportConfigurationInstance def update(enabled: :unset, webhook_url: :unset, webhook_method: :unset) data = Twilio::Values.of({ 'Enabled' => enabled, 'WebhookUrl' => webhook_url, 'WebhookMethod' => webhook_method, }) payload = @version.update( 'POST', @uri, data: data, ) ExportConfigurationInstance.new(@version, payload, resource_type: @solution[:resource_type], ) 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 ## # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution. class ExportConfigurationInstance < InstanceResource ## # Initialize the ExportConfigurationInstance # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio # @param [String] resource_type The type of communication – Messages, Calls # @return [ExportConfigurationInstance] ExportConfigurationInstance def initialize(version, payload, resource_type: nil) super(version) # Marshaled Properties @properties = { 'enabled' => payload['enabled'], 'webhook_url' => payload['webhook_url'], 'webhook_method' => payload['webhook_method'], 'resource_type' => payload['resource_type'], 'url' => payload['url'], } # Context @instance_context = nil @params = {'resource_type' => resource_type || @properties['resource_type'], } 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 [ExportConfigurationContext] ExportConfigurationContext for this ExportConfigurationInstance def context unless @instance_context @instance_context = ExportConfigurationContext.new(@version, @params['resource_type'], ) end @instance_context end ## # @return [Boolean] Whether files are automatically generated def enabled @properties['enabled'] end ## # @return [String] URL targeted at export def webhook_url @properties['webhook_url'] end ## # @return [String] Whether to GET or POST to the webhook url def webhook_method @properties['webhook_method'] end ## # @return [String] The type of communication – Messages, Calls def resource_type @properties['resource_type'] end ## # @return [String] The URL of this resource. def url @properties['url'] end ## # Fetch a ExportConfigurationInstance # @return [ExportConfigurationInstance] Fetched ExportConfigurationInstance def fetch context.fetch end ## # Update the ExportConfigurationInstance # @param [Boolean] enabled If true, Twilio will automatically generate every day's # file when the day is over. # @param [String] webhook_url Stores the URL destination for the method specified # in webhook_method. # @param [String] webhook_method Sets whether Twilio should call a webhook URL # when the automatic generation is complete, using GET or POST. The actual # destination is set in the webhook_url # @return [ExportConfigurationInstance] Updated ExportConfigurationInstance def update(enabled: :unset, webhook_url: :unset, webhook_method: :unset) context.update(enabled: enabled, webhook_url: webhook_url, webhook_method: webhook_method, ) 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