## # 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 BrandRegistrationList < ListResource ## # Initialize the BrandRegistrationList # @param [Version] version Version that contains the resource # @return [BrandRegistrationList] BrandRegistrationList def initialize(version) super(version) # Path Solution @solution = {} @uri = "/a2p/BrandRegistrations" end ## # Lists BrandRegistrationInstance 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 BrandRegistrationInstance 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 BrandRegistrationInstance 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 BrandRegistrationInstance 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 BrandRegistrationInstance def page(page_token: :unset, page_number: :unset, page_size: :unset) params = Twilio::Values.of({ 'PageToken' => page_token, 'Page' => page_number, 'PageSize' => page_size, }) response = @version.page('GET', @uri, params: params) BrandRegistrationPage.new(@version, response, @solution) end ## # Retrieve a single page of BrandRegistrationInstance records from the API. # Request is executed immediately. # @param [String] target_url API-generated URL for the requested results page # @return [Page] Page of BrandRegistrationInstance def get_page(target_url) response = @version.domain.request( 'GET', target_url ) BrandRegistrationPage.new(@version, response, @solution) end ## # Create the BrandRegistrationInstance # @param [String] customer_profile_bundle_sid Customer Profile Bundle Sid. # @param [String] a2p_profile_bundle_sid A2P Messaging Profile Bundle Sid. # @param [String] brand_type Type of brand being created. One of: "STANDARD", # "STARTER". STARTER is for low volume, starter use cases. STANDARD is for all # other use cases. # @param [Boolean] mock A boolean that specifies whether brand should be a mock or # not. If true, brand will be registered as a mock brand. Defaults to false if no # value is provided. # @param [Boolean] skip_automatic_sec_vet A flag to disable automatic secondary # vetting for brands which it would otherwise be done. # @return [BrandRegistrationInstance] Created BrandRegistrationInstance def create(customer_profile_bundle_sid: nil, a2p_profile_bundle_sid: nil, brand_type: :unset, mock: :unset, skip_automatic_sec_vet: :unset) data = Twilio::Values.of({ 'CustomerProfileBundleSid' => customer_profile_bundle_sid, 'A2PProfileBundleSid' => a2p_profile_bundle_sid, 'BrandType' => brand_type, 'Mock' => mock, 'SkipAutomaticSecVet' => skip_automatic_sec_vet, }) payload = @version.create('POST', @uri, data: data) BrandRegistrationInstance.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 BrandRegistrationPage < Page ## # Initialize the BrandRegistrationPage # @param [Version] version Version that contains the resource # @param [Response] response Response from the API # @param [Hash] solution Path solution for the resource # @return [BrandRegistrationPage] BrandRegistrationPage def initialize(version, response, solution) super(version, response) # Path Solution @solution = solution end ## # Build an instance of BrandRegistrationInstance # @param [Hash] payload Payload response from the API # @return [BrandRegistrationInstance] BrandRegistrationInstance def get_instance(payload) BrandRegistrationInstance.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 BrandRegistrationContext < InstanceContext ## # Initialize the BrandRegistrationContext # @param [Version] version Version that contains the resource # @param [String] sid The SID of the Brand Registration resource to fetch. # @return [BrandRegistrationContext] BrandRegistrationContext def initialize(version, sid) super(version) # Path Solution @solution = {sid: sid, } @uri = "/a2p/BrandRegistrations/#{@solution[:sid]}" # Dependents @brand_vettings = nil end ## # Fetch the BrandRegistrationInstance # @return [BrandRegistrationInstance] Fetched BrandRegistrationInstance def fetch payload = @version.fetch('GET', @uri) BrandRegistrationInstance.new(@version, payload, sid: @solution[:sid], ) end ## # Update the BrandRegistrationInstance # @return [BrandRegistrationInstance] Updated BrandRegistrationInstance def update payload = @version.update('POST', @uri) BrandRegistrationInstance.new(@version, payload, sid: @solution[:sid], ) end ## # Access the brand_vettings # @return [BrandVettingList] # @return [BrandVettingContext] if brand_vetting_sid was passed. def brand_vettings(brand_vetting_sid=:unset) raise ArgumentError, 'brand_vetting_sid cannot be nil' if brand_vetting_sid.nil? if brand_vetting_sid != :unset return BrandVettingContext.new(@version, @solution[:sid], brand_vetting_sid, ) end unless @brand_vettings @brand_vettings = BrandVettingList.new(@version, brand_sid: @solution[:sid], ) end @brand_vettings 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 BrandRegistrationInstance < InstanceResource ## # Initialize the BrandRegistrationInstance # @param [Version] version Version that contains the resource # @param [Hash] payload payload that contains response from Twilio # @param [String] sid The SID of the Brand Registration resource to fetch. # @return [BrandRegistrationInstance] BrandRegistrationInstance def initialize(version, payload, sid: nil) super(version) # Marshaled Properties @properties = { 'sid' => payload['sid'], 'account_sid' => payload['account_sid'], 'customer_profile_bundle_sid' => payload['customer_profile_bundle_sid'], 'a2p_profile_bundle_sid' => payload['a2p_profile_bundle_sid'], 'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']), 'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']), 'brand_type' => payload['brand_type'], 'status' => payload['status'], 'tcr_id' => payload['tcr_id'], 'failure_reason' => payload['failure_reason'], 'url' => payload['url'], 'brand_score' => payload['brand_score'] == nil ? payload['brand_score'] : payload['brand_score'].to_i, 'brand_feedback' => payload['brand_feedback'], 'identity_status' => payload['identity_status'], 'russell_3000' => payload['russell_3000'], 'government_entity' => payload['government_entity'], 'tax_exempt_status' => payload['tax_exempt_status'], 'skip_automatic_sec_vet' => payload['skip_automatic_sec_vet'], 'mock' => payload['mock'], '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 [BrandRegistrationContext] BrandRegistrationContext for this BrandRegistrationInstance def context unless @instance_context @instance_context = BrandRegistrationContext.new(@version, @params['sid'], ) end @instance_context end ## # @return [String] A2P BrandRegistration Sid def sid @properties['sid'] end ## # @return [String] The SID of the Account that created the resource def account_sid @properties['account_sid'] end ## # @return [String] A2P Messaging Profile Bundle BundleSid def customer_profile_bundle_sid @properties['customer_profile_bundle_sid'] end ## # @return [String] A2P Messaging Profile Bundle BundleSid def a2p_profile_bundle_sid @properties['a2p_profile_bundle_sid'] end ## # @return [Time] The ISO 8601 date and time in GMT when the resource was created def date_created @properties['date_created'] end ## # @return [Time] The ISO 8601 date and time in GMT when the resource was last updated def date_updated @properties['date_updated'] end ## # @return [String] Type of brand. One of: "STANDARD", "STARTER". def brand_type @properties['brand_type'] end ## # @return [brand_registration.Status] Brand Registration status. def status @properties['status'] end ## # @return [String] Campaign Registry (TCR) Brand ID def tcr_id @properties['tcr_id'] end ## # @return [String] A reason why brand registration has failed def failure_reason @properties['failure_reason'] end ## # @return [String] The absolute URL of the Brand Registration def url @properties['url'] end ## # @return [String] Brand score def brand_score @properties['brand_score'] end ## # @return [Array[brand_registration.BrandFeedback]] Brand feedback def brand_feedback @properties['brand_feedback'] end ## # @return [brand_registration.IdentityStatus] Identity Status def identity_status @properties['identity_status'] end ## # @return [Boolean] Russell 3000 def russell_3000 @properties['russell_3000'] end ## # @return [Boolean] Government Entity def government_entity @properties['government_entity'] end ## # @return [String] Tax Exempt Status def tax_exempt_status @properties['tax_exempt_status'] end ## # @return [Boolean] Skip Automatic Secondary Vetting def skip_automatic_sec_vet @properties['skip_automatic_sec_vet'] end ## # @return [Boolean] A boolean that specifies whether brand should be a mock or not. If true, brand will be registered as a mock brand. Defaults to false if no value is provided. def mock @properties['mock'] end ## # @return [String] The links def links @properties['links'] end ## # Fetch the BrandRegistrationInstance # @return [BrandRegistrationInstance] Fetched BrandRegistrationInstance def fetch context.fetch end ## # Update the BrandRegistrationInstance # @return [BrandRegistrationInstance] Updated BrandRegistrationInstance def update context.update end ## # Access the brand_vettings # @return [brand_vettings] brand_vettings def brand_vettings context.brand_vettings 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