## # This code was generated by # \ / _ _ _| _ _ # | (_)\/(_)(_|\/| |(/_ v1.0.0 # / / # # frozen_string_literal: true module Twilio module REST class Verify < Domain class V2 < Version ## # PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution. class SafelistList < ListResource ## # Initialize the SafelistList # @param [Version] version Version that contains the resource # @return [SafelistList] SafelistList def initialize(version) super(version) # Path Solution @solution = {} @uri = "/SafeList/Numbers" end ## # Create the SafelistInstance # @param [String] phone_number The phone number to be added in SafeList. Phone # numbers must be in {E.164 # format}[https://www.twilio.com/docs/glossary/what-e164]. # @return [SafelistInstance] Created SafelistInstance def create(phone_number: nil) data = Twilio::Values.of({'PhoneNumber' => phone_number, }) payload = @version.create('POST', @uri, data: data) SafelistInstance.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 SafelistPage < Page ## # Initialize the SafelistPage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @return [SafelistPage] SafelistPage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of SafelistInstance # @param [Hash] payload Payload response from the API # @return [SafelistInstance] SafelistInstance def get_instance(payload) SafelistInstance.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 SafelistContext < InstanceContext ## # Initialize the SafelistContext # @param [Version] version Version that contains the resource # @param [String] phone_number The phone number to be fetched from SafeList. Phone # numbers must be in {E.164 # format}[https://www.twilio.com/docs/glossary/what-e164]. # @return [SafelistContext] SafelistContext def initialize(version, phone_number) super(version) # Path Solution @solution = {phone_number: phone_number, } @uri = "/SafeList/Numbers/#{@solution[:phone_number]}" end ## # Fetch the SafelistInstance # @return [SafelistInstance] Fetched SafelistInstance def fetch payload = @version.fetch('GET', @uri) SafelistInstance.new(@version, payload, phone_number: @solution[:phone_number], ) end ## # Delete the SafelistInstance # @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 SafelistInstance < InstanceResource ## # Initialize the SafelistInstance # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio # @param [String] phone_number The phone number to be fetched from SafeList. Phone # numbers must be in {E.164 # format}[https://www.twilio.com/docs/glossary/what-e164]. # @return [SafelistInstance] SafelistInstance def initialize(version, payload, phone_number: nil) super(version) # Marshaled Properties @properties = { 'sid' => payload['sid'], 'phone_number' => payload['phone_number'], 'url' => payload['url'], } # Context @instance_context = nil @params = {'phone_number' => phone_number || @properties['phone_number'], } 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 [SafelistContext] SafelistContext for this SafelistInstance def context unless @instance_context @instance_context = SafelistContext.new(@version, @params['phone_number'], ) end @instance_context end ## # @return [String] The unique string that identifies the resource. def sid @properties['sid'] end ## # @return [String] The phone number in SafeList. def phone_number @properties['phone_number'] end ## # @return [String] The absolute URL of the SafeList resource. def url @properties['url'] end ## # Fetch the SafelistInstance # @return [SafelistInstance] Fetched SafelistInstance def fetch context.fetch end ## # Delete the SafelistInstance # @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