Class: Twilio::REST::Pricing::V1::VoiceList::NumberContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/pricing/v1/voice/number.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, number) ⇒ NumberContext

Initialize the NumberContext

Parameters:

  • version (Version)

    Version that contains the resource

  • number (String)

    The phone number to fetch.



50
51
52
53
54
55
56
57
58
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 50

def initialize(version, number)
    super(version)

    # Path Solution
    @solution = { number: number,  }
    @uri = "/Voice/Numbers/#{CGI.escape(@solution[:number]).gsub("+", "%20")}"

    
end

Instance Method Details

#fetchNumberInstance

Fetch the NumberInstance

Returns:



62
63
64
65
66
67
68
69
70
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 62

def fetch

    payload = @version.fetch('GET', @uri)
    NumberInstance.new(
        @version,
        payload,
        number: @solution[:number],
    )
end

#inspectObject

Provide a detailed, user friendly representation



82
83
84
85
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 82

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Pricing.V1.NumberContext #{context}>"
end

#to_sObject

Provide a user friendly representation



75
76
77
78
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 75

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Pricing.V1.NumberContext #{context}>"
end