Class: Twilio::REST::Api::V2010::AccountContext::AvailablePhoneNumberCountryContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb,
lib/twilio-ruby/rest/api/v2010/account/available_phone_number/voip.rb,
lib/twilio-ruby/rest/api/v2010/account/available_phone_number/local.rb,
lib/twilio-ruby/rest/api/v2010/account/available_phone_number/mobile.rb,
lib/twilio-ruby/rest/api/v2010/account/available_phone_number/national.rb,
lib/twilio-ruby/rest/api/v2010/account/available_phone_number/toll_free.rb,
lib/twilio-ruby/rest/api/v2010/account/available_phone_number/shared_cost.rb,
lib/twilio-ruby/rest/api/v2010/account/available_phone_number/machine_to_machine.rb

Defined Under Namespace

Classes: LocalInstance, LocalList, LocalPage, MachineToMachineInstance, MachineToMachineList, MachineToMachinePage, MobileInstance, MobileList, MobilePage, NationalInstance, NationalList, NationalPage, SharedCostInstance, SharedCostList, SharedCostPage, TollFreeInstance, TollFreeList, TollFreePage, VoipInstance, VoipList, VoipPage

Instance Method Summary collapse

Constructor Details

#initialize(version, account_sid, country_code) ⇒ AvailablePhoneNumberCountryContext

Initialize the AvailablePhoneNumberCountryContext

Parameters:

  • version (Version)

    Version that contains the resource

  • account_sid (String)

    The SID of the Account requesting the available phone number Country resource.

  • country_code (String)

    The ISO-3166-1 country code of the country to fetch available phone number information about.


156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 156

def initialize(version, , country_code)
  super(version)

  # Path Solution
  @solution = {account_sid: , country_code: country_code, }
  @uri = "/Accounts/#{@solution[:account_sid]}/AvailablePhoneNumbers/#{@solution[:country_code]}.json"

  # Dependents
  @local = nil
  @toll_free = nil
  @mobile = nil
  @national = nil
  @voip = nil
  @shared_cost = nil
  @machine_to_machine = nil
end

Instance Method Details

#fetchAvailablePhoneNumberCountryInstance

Fetch the AvailablePhoneNumberCountryInstance

Returns:


176
177
178
179
180
181
182
183
184
185
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 176

def fetch
  payload = @version.fetch('GET', @uri)

  AvailablePhoneNumberCountryInstance.new(
      @version,
      payload,
      account_sid: @solution[:account_sid],
      country_code: @solution[:country_code],
  )
end

#inspectObject

Provide a detailed, user friendly representation


308
309
310
311
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 308

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

#localLocalList, LocalContext

Access the local

Returns:


191
192
193
194
195
196
197
198
199
200
201
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 191

def local
  unless @local
    @local = LocalList.new(
        @version,
        account_sid: @solution[:account_sid],
        country_code: @solution[:country_code],
    )
  end

  @local
end

#machine_to_machineMachineToMachineList, MachineToMachineContext

Access the machine_to_machine

Returns:


287
288
289
290
291
292
293
294
295
296
297
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 287

def machine_to_machine
  unless @machine_to_machine
    @machine_to_machine = MachineToMachineList.new(
        @version,
        account_sid: @solution[:account_sid],
        country_code: @solution[:country_code],
    )
  end

  @machine_to_machine
end

#mobileMobileList, MobileContext

Access the mobile

Returns:


223
224
225
226
227
228
229
230
231
232
233
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 223

def mobile
  unless @mobile
    @mobile = MobileList.new(
        @version,
        account_sid: @solution[:account_sid],
        country_code: @solution[:country_code],
    )
  end

  @mobile
end

#nationalNationalList, NationalContext

Access the national

Returns:


239
240
241
242
243
244
245
246
247
248
249
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 239

def national
  unless @national
    @national = NationalList.new(
        @version,
        account_sid: @solution[:account_sid],
        country_code: @solution[:country_code],
    )
  end

  @national
end

#shared_costSharedCostList, SharedCostContext

Access the shared_cost

Returns:


271
272
273
274
275
276
277
278
279
280
281
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 271

def shared_cost
  unless @shared_cost
    @shared_cost = SharedCostList.new(
        @version,
        account_sid: @solution[:account_sid],
        country_code: @solution[:country_code],
    )
  end

  @shared_cost
end

#to_sObject

Provide a user friendly representation


301
302
303
304
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 301

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

#toll_freeTollFreeList, TollFreeContext

Access the toll_free

Returns:


207
208
209
210
211
212
213
214
215
216
217
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 207

def toll_free
  unless @toll_free
    @toll_free = TollFreeList.new(
        @version,
        account_sid: @solution[:account_sid],
        country_code: @solution[:country_code],
    )
  end

  @toll_free
end

#voipVoipList, VoipContext

Access the voip

Returns:


255
256
257
258
259
260
261
262
263
264
265
# File 'lib/twilio-ruby/rest/api/v2010/account/available_phone_number.rb', line 255

def voip
  unless @voip
    @voip = VoipList.new(
        @version,
        account_sid: @solution[:account_sid],
        country_code: @solution[:country_code],
    )
  end

  @voip
end