Class: Twilio::REST::Pricing::V1::VoiceList::NumberInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, number: nil) ⇒ NumberInstance

Initialize the NumberInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • number (String) (defaults to: nil)

    The number



113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 113

def initialize(version, payload, number: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'number' => payload['number'],
      'country' => payload['country'],
      'iso_country' => payload['iso_country'],
      'outbound_call_price' => payload['outbound_call_price'],
      'inbound_call_price' => payload['inbound_call_price'],
      'price_unit' => payload['price_unit'],
      'url' => payload['url'],
  }

  # Context
  @instance_context = nil
  @params = {
      'number' => number || @properties['number'],
  }
end

Instance Method Details

#contextNumberContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



138
139
140
141
142
143
144
145
146
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 138

def context
  unless @instance_context
    @instance_context = NumberContext.new(
        @version,
        @params['number'],
    )
  end
  @instance_context
end

#countryString

Returns The country.

Returns:

  • (String)

    The country



156
157
158
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 156

def country
  @properties['country']
end

#fetchNumberInstance

Fetch a NumberInstance

Returns:



193
194
195
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 193

def fetch
  context.fetch
end

#inbound_call_priceString

Returns The inbound_call_price.

Returns:

  • (String)

    The inbound_call_price



174
175
176
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 174

def inbound_call_price
  @properties['inbound_call_price']
end

#inspectObject

Provide a detailed, user friendly representation



206
207
208
209
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 206

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Pricing.V1.NumberInstance #{values}>"
end

#iso_countryString

Returns The iso_country.

Returns:

  • (String)

    The iso_country



162
163
164
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 162

def iso_country
  @properties['iso_country']
end

#numberString

Returns The number.

Returns:

  • (String)

    The number



150
151
152
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 150

def number
  @properties['number']
end

#outbound_call_priceString

Returns The outbound_call_price.

Returns:

  • (String)

    The outbound_call_price



168
169
170
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 168

def outbound_call_price
  @properties['outbound_call_price']
end

#price_unitString

Returns The price_unit.

Returns:

  • (String)

    The price_unit



180
181
182
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 180

def price_unit
  @properties['price_unit']
end

#to_sObject

Provide a user friendly representation



199
200
201
202
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 199

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Pricing.V1.NumberInstance #{values}>"
end

#urlString

Returns The url.

Returns:

  • (String)

    The url



186
187
188
# File 'lib/twilio-ruby/rest/pricing/v1/voice/number.rb', line 186

def url
  @properties['url']
end