## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / # # frozen_string_literal: true module Twilio module REST class Messaging < Domain class V1 < Version ## # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution. class LinkshorteningMessagingServiceList < ListResource ## # Initialize the LinkshorteningMessagingServiceList # @param [Version] version Version that contains the resource # @return [LinkshorteningMessagingServiceList] LinkshorteningMessagingServiceList 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 LinkshorteningMessagingServicePage < Page ## # Initialize the LinkshorteningMessagingServicePage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @return [LinkshorteningMessagingServicePage] LinkshorteningMessagingServicePage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of LinkshorteningMessagingServiceInstance # @param [Hash] payload Payload response from the API # @return [LinkshorteningMessagingServiceInstance] LinkshorteningMessagingServiceInstance def get_instance(payload) LinkshorteningMessagingServiceInstance.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 LinkshorteningMessagingServiceContext < InstanceContext ## # Initialize the LinkshorteningMessagingServiceContext # @param [Version] version Version that contains the resource # @param [String] domain_sid The domain SID to dissociate from a messaging # service. With URL shortening enabled, links in messages sent with the associated # messaging service will be shortened to the provided domain # @param [String] messaging_service_sid A messaging service SID to dissociate from # a domain. With URL shortening enabled, links in messages sent with the provided # messaging service will be shortened to the associated domain # @return [LinkshorteningMessagingServiceContext] LinkshorteningMessagingServiceContext def initialize(version, domain_sid, messaging_service_sid) super(version) # Path Solution @solution = {domain_sid: domain_sid, messaging_service_sid: messaging_service_sid, } @uri = "/LinkShortening/Domains/#{@solution[:domain_sid]}/MessagingServices/#{@solution[:messaging_service_sid]}" end ## # Create the LinkshorteningMessagingServiceInstance # @return [LinkshorteningMessagingServiceInstance] Created LinkshorteningMessagingServiceInstance def create payload = @version.create('POST', @uri) LinkshorteningMessagingServiceInstance.new( @version, payload, domain_sid: @solution[:domain_sid], messaging_service_sid: @solution[:messaging_service_sid], ) end ## # Delete the LinkshorteningMessagingServiceInstance # @return [Boolean] true if delete succeeds, false otherwise def delete @version.delete('DELETE', @uri) 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 LinkshorteningMessagingServiceInstance < InstanceResource ## # Initialize the LinkshorteningMessagingServiceInstance # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio # @param [String] domain_sid The domain SID to dissociate from a messaging # service. With URL shortening enabled, links in messages sent with the associated # messaging service will be shortened to the provided domain # @param [String] messaging_service_sid A messaging service SID to dissociate from # a domain. With URL shortening enabled, links in messages sent with the provided # messaging service will be shortened to the associated domain # @return [LinkshorteningMessagingServiceInstance] LinkshorteningMessagingServiceInstance def initialize(version, payload, domain_sid: nil, messaging_service_sid: nil) super(version) # Marshaled Properties @properties = { 'domain_sid' => payload['domain_sid'], 'messaging_service_sid' => payload['messaging_service_sid'], 'url' => payload['url'], } # Context @instance_context = nil @params = { 'domain_sid' => domain_sid || @properties['domain_sid'], 'messaging_service_sid' => messaging_service_sid || @properties['messaging_service_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 [LinkshorteningMessagingServiceContext] LinkshorteningMessagingServiceContext for this LinkshorteningMessagingServiceInstance def context unless @instance_context @instance_context = LinkshorteningMessagingServiceContext.new( @version, @params['domain_sid'], @params['messaging_service_sid'], ) end @instance_context end ## # @return [String] The unique string that identifies the domain resource def domain_sid @properties['domain_sid'] end ## # @return [String] The unique string that identifies the messaging service def messaging_service_sid @properties['messaging_service_sid'] end ## # @return [String] The url def url @properties['url'] end ## # Create the LinkshorteningMessagingServiceInstance # @return [LinkshorteningMessagingServiceInstance] Created LinkshorteningMessagingServiceInstance def create context.create end ## # Delete the LinkshorteningMessagingServiceInstance # @return [Boolean] true if delete succeeds, false otherwise def delete context.delete 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