lib/twilio-ruby/rest/pricing/v2/number.rb in twilio-ruby-5.77.0 vs lib/twilio-ruby/rest/pricing/v2/number.rb in twilio-ruby-6.0.0.pre.rc.1

- old
+ new

@@ -1,225 +1,240 @@ ## -# This code was generated by -# \ / _ _ _| _ _ -# | (_)\/(_)(_|\/| |(/_ v1.0.0 -# / / +# This code was generated by +# ___ _ _ _ _ _ _ ____ ____ ____ _ ____ ____ _ _ ____ ____ ____ ___ __ __ +# | | | | | | | | | __ | | |__| | __ | __ |___ |\ | |___ |__/ |__| | | | |__/ +# | |_|_| | |___ | |__| |__| | | | |__] |___ | \| |___ | \ | | | |__| | \ # -# frozen_string_literal: true +# Twilio - Pricing +# 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 Pricing < Domain - class V2 < Version - class NumberList < ListResource - ## - # Initialize the NumberList - # @param [Version] version Version that contains the resource - # @return [NumberList] NumberList - def initialize(version) - super(version) + module REST + class Pricing < PricingBase + class V2 < Version + class NumberList < ListResource + ## + # Initialize the NumberList + # @param [Version] version Version that contains the resource + # @return [NumberList] NumberList + def initialize(version) + super(version) + # Path Solution + @solution = { } + + + end + - # Path Solution - @solution = {} - end - ## - # Provide a user friendly representation - def to_s - '#<Twilio.Pricing.V2.NumberList>' - end - end + # Provide a user friendly representation + def to_s + '#<Twilio.Pricing.V2.NumberList>' + end + end - class NumberPage < Page - ## - # Initialize the NumberPage - # @param [Version] version Version that contains the resource - # @param [Response] response Response from the API - # @param [Hash] solution Path solution for the resource - # @return [NumberPage] NumberPage - def initialize(version, response, solution) - super(version, response) - # Path Solution - @solution = solution - end + class NumberContext < InstanceContext + ## + # Initialize the NumberContext + # @param [Version] version Version that contains the resource + # @param [String] destination_number The destination phone number, in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, for which to fetch the origin-based voice pricing information. E.164 format consists of a + followed by the country code and subscriber number. + # @return [NumberContext] NumberContext + def initialize(version, destination_number) + super(version) - ## - # Build an instance of NumberInstance - # @param [Hash] payload Payload response from the API - # @return [NumberInstance] NumberInstance - def get_instance(payload) - NumberInstance.new(@version, payload, ) - end + # Path Solution + @solution = { destination_number: destination_number, } + @uri = "/Trunking/Numbers/#{CGI.escape(@solution[:destination_number]).gsub("+", "%20")}" - ## - # Provide a user friendly representation - def to_s - '<Twilio.Pricing.V2.NumberPage>' - end - end + + end + ## + # Fetch the NumberInstance + # @param [String] origination_number The origination phone number, in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, for which to fetch the origin-based voice pricing information. E.164 format consists of a + followed by the country code and subscriber number. + # @return [NumberInstance] Fetched NumberInstance + def fetch( + origination_number: :unset + ) - class NumberContext < InstanceContext - ## - # Initialize the NumberContext - # @param [Version] version Version that contains the resource - # @param [String] destination_number The destination phone number, in - # {E.164}[https://www.twilio.com/docs/glossary/what-e164] format, for which to - # fetch the origin-based voice pricing information. E.164 format consists of a + - # followed by the country code and subscriber number. - # @return [NumberContext] NumberContext - def initialize(version, destination_number) - super(version) + params = Twilio::Values.of({ + 'OriginationNumber' => origination_number, + }) + payload = @version.fetch('GET', @uri, params: params) + NumberInstance.new( + @version, + payload, + destination_number: @solution[:destination_number], + ) + end - # Path Solution - @solution = {destination_number: destination_number, } - @uri = "/Trunking/Numbers/#{CGI.escape(@solution[:destination_number]).gsub("+", "%20")}" - end - ## - # Fetch the NumberInstance - # @param [String] origination_number The origination phone number, in - # {E.164}[https://www.twilio.com/docs/glossary/what-e164] format, for which to - # fetch the origin-based voice pricing information. E.164 format consists of a + - # followed by the country code and subscriber number. - # @return [NumberInstance] Fetched NumberInstance - def fetch(origination_number: :unset) - params = Twilio::Values.of({'OriginationNumber' => origination_number, }) + ## + # Provide a user friendly representation + def to_s + context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') + "#<Twilio.Pricing.V2.NumberContext #{context}>" + end - payload = @version.fetch('GET', @uri, params: params) + ## + # Provide a detailed, user friendly representation + def inspect + context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') + "#<Twilio.Pricing.V2.NumberContext #{context}>" + end + end - NumberInstance.new(@version, payload, destination_number: @solution[:destination_number], ) - end + class NumberPage < Page + ## + # Initialize the NumberPage + # @param [Version] version Version that contains the resource + # @param [Response] response Response from the API + # @param [Hash] solution Path solution for the resource + # @return [NumberPage] NumberPage + def initialize(version, response, solution) + super(version, response) - ## - # Provide a user friendly representation - def to_s - context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') - "#<Twilio.Pricing.V2.NumberContext #{context}>" - end + # Path Solution + @solution = solution + end - ## - # Provide a detailed, user friendly representation - def inspect - context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') - "#<Twilio.Pricing.V2.NumberContext #{context}>" - end - end + ## + # Build an instance of NumberInstance + # @param [Hash] payload Payload response from the API + # @return [NumberInstance] NumberInstance + def get_instance(payload) + NumberInstance.new(@version, payload) + end - class NumberInstance < InstanceResource - ## - # Initialize the NumberInstance - # @param [Version] version Version that contains the resource - # @param [Hash] payload payload that contains response from Twilio - # @param [String] destination_number The destination phone number, in - # {E.164}[https://www.twilio.com/docs/glossary/what-e164] format, for which to - # fetch the origin-based voice pricing information. E.164 format consists of a + - # followed by the country code and subscriber number. - # @return [NumberInstance] NumberInstance - def initialize(version, payload, destination_number: nil) - super(version) + ## + # Provide a user friendly representation + def to_s + '<Twilio.Pricing.V2.NumberPage>' + end + end + class NumberInstance < InstanceResource + ## + # Initialize the NumberInstance + # @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 Number + # resource. + # @param [String] sid The SID of the Call resource to fetch. + # @return [NumberInstance] NumberInstance + def initialize(version, payload , destination_number: nil) + super(version) + + # Marshaled Properties + @properties = { + 'destination_number' => payload['destination_number'], + 'origination_number' => payload['origination_number'], + 'country' => payload['country'], + 'iso_country' => payload['iso_country'], + 'terminating_prefix_prices' => payload['terminating_prefix_prices'], + 'originating_call_price' => payload['originating_call_price'], + 'price_unit' => payload['price_unit'], + 'url' => payload['url'], + } - # Marshaled Properties - @properties = { - 'destination_number' => payload['destination_number'], - 'origination_number' => payload['origination_number'], - 'country' => payload['country'], - 'iso_country' => payload['iso_country'], - 'terminating_prefix_prices' => payload['terminating_prefix_prices'], - 'originating_call_price' => payload['originating_call_price'], - 'price_unit' => payload['price_unit'], - 'url' => payload['url'], - } + # Context + @instance_context = nil + @params = { 'destination_number' => destination_number || @properties['destination_number'] , } + end - # Context - @instance_context = nil - @params = {'destination_number' => destination_number || @properties['destination_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 [NumberContext] CallContext for this CallInstance + def context + unless @instance_context + @instance_context = NumberContext.new(@version , @params['destination_number']) + end + @instance_context + end + + ## + # @return [String] The destination phone number in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + def destination_number + @properties['destination_number'] + end + + ## + # @return [String] The origination phone number in [[E.164](https://www.twilio.com/docs/glossary/what-e164) format, which consists of a + followed by the country code and subscriber number. + def origination_number + @properties['origination_number'] + end + + ## + # @return [String] The name of the country. + def country + @properties['country'] + end + + ## + # @return [String] The [ISO country code](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) + def iso_country + @properties['iso_country'] + end + + ## + # @return [Array<PricingV2TrunkingCountryInstanceTerminatingPrefixPrices>] + def terminating_prefix_prices + @properties['terminating_prefix_prices'] + end + + ## + # @return [PricingV2TrunkingNumberOriginatingCallPrice] + def originating_call_price + @properties['originating_call_price'] + end + + ## + # @return [String] The currency in which prices are measured, specified in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`). + def price_unit + @properties['price_unit'] + end + + ## + # @return [String] The absolute URL of the resource. + def url + @properties['url'] + end + + ## + # Fetch the NumberInstance + # @param [String] origination_number The origination phone number, in [E.164](https://www.twilio.com/docs/glossary/what-e164) format, for which to fetch the origin-based voice pricing information. E.164 format consists of a + followed by the country code and subscriber number. + # @return [NumberInstance] Fetched NumberInstance + def fetch( + origination_number: :unset + ) - ## - # Generate an instance context for the instance, the context is capable of - # performing various actions. All instance actions are proxied to the context - # @return [NumberContext] NumberContext for this NumberInstance - def context - unless @instance_context - @instance_context = NumberContext.new(@version, @params['destination_number'], ) - end - @instance_context - end + context.fetch( + origination_number: origination_number, + ) + end - ## - # @return [String] The destination phone number, in E.164 format - def destination_number - @properties['destination_number'] - end + ## + # Provide a user friendly representation + def to_s + values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") + "<Twilio.Pricing.V2.NumberInstance #{values}>" + end - ## - # @return [String] The origination phone number, in E.164 format - def origination_number - @properties['origination_number'] - end + ## + # Provide a detailed, user friendly representation + def inspect + values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") + "<Twilio.Pricing.V2.NumberInstance #{values}>" + end + end - ## - # @return [String] The name of the country - def country - @properties['country'] - end - - ## - # @return [String] The ISO country code - def iso_country - @properties['iso_country'] - end - - ## - # @return [Array[String]] The terminating_prefix_prices - def terminating_prefix_prices - @properties['terminating_prefix_prices'] - end - - ## - # @return [String] The OriginatingCallPrice record - def originating_call_price - @properties['originating_call_price'] - end - - ## - # @return [String] The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy) - def price_unit - @properties['price_unit'] - end - - ## - # @return [String] The absolute URL of the resource - def url - @properties['url'] - end - - ## - # Fetch the NumberInstance - # @param [String] origination_number The origination phone number, in - # {E.164}[https://www.twilio.com/docs/glossary/what-e164] format, for which to - # fetch the origin-based voice pricing information. E.164 format consists of a + - # followed by the country code and subscriber number. - # @return [NumberInstance] Fetched NumberInstance - def fetch(origination_number: :unset) - context.fetch(origination_number: origination_number, ) - end - - ## - # Provide a user friendly representation - def to_s - values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") - "<Twilio.Pricing.V2.NumberInstance #{values}>" - end - - ## - # Provide a detailed, user friendly representation - def inspect - values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") - "<Twilio.Pricing.V2.NumberInstance #{values}>" - end + end end - end end - end -end \ No newline at end of file +end