Class: Twilio::REST::Pricing::V2

Inherits:
Version
  • Object
show all
Defined in:
lib/twilio-ruby/rest/pricing/v2.rb,
lib/twilio-ruby/rest/pricing/v2/voice.rb,
lib/twilio-ruby/rest/pricing/v2/number.rb,
lib/twilio-ruby/rest/pricing/v2/country.rb,
lib/twilio-ruby/rest/pricing/v2/voice/number.rb,
lib/twilio-ruby/rest/pricing/v2/voice/country.rb

Defined Under Namespace

Classes: CountryContext, CountryInstance, CountryList, CountryPage, NumberContext, NumberInstance, NumberList, NumberPage, VoiceInstance, VoiceList, VoicePage

Instance Attribute Summary

Attributes inherited from Version

#domain

Instance Method Summary collapse

Methods inherited from Version

#absolute_url, #create, #delete, #exception, #fetch, #page, #read_limits, #relative_uri, #request, #stream, #update

Constructor Details

#initialize(domain) ⇒ V2

Initialize the V2 version of Pricing


15
16
17
18
19
20
21
# File 'lib/twilio-ruby/rest/pricing/v2.rb', line 15

def initialize(domain)
  super
  @version = 'v2'
  @countries = nil
  @numbers = nil
  @voice = nil
end

Instance Method Details

#countries(iso_country = :unset) ⇒ Twilio::REST::Pricing::V2::CountryContext, Twilio::REST::Pricing::V2::CountryList

Parameters:

  • iso_country (String) (defaults to: :unset)

    The ISO country code of the origin-based voice pricing information to fetch.

Returns:


29
30
31
32
33
34
35
36
37
38
# File 'lib/twilio-ruby/rest/pricing/v2.rb', line 29

def countries(iso_country=:unset)
  if iso_country.nil?
      raise ArgumentError, 'iso_country cannot be nil'
  end
  if iso_country == :unset
      @countries ||= CountryList.new self
  else
      CountryContext.new(self, iso_country)
  end
end

#numbers(destination_number = :unset) ⇒ Twilio::REST::Pricing::V2::NumberContext, Twilio::REST::Pricing::V2::NumberList

Parameters:

  • destination_number (String) (defaults to: :unset)

    The destination phone number, in E.164 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.

Returns:


47
48
49
50
51
52
53
54
55
56
# File 'lib/twilio-ruby/rest/pricing/v2.rb', line 47

def numbers(destination_number=:unset)
  if destination_number.nil?
      raise ArgumentError, 'destination_number cannot be nil'
  end
  if destination_number == :unset
      @numbers ||= NumberList.new self
  else
      NumberContext.new(self, destination_number)
  end
end

#to_sObject

Provide a user friendly representation


66
67
68
# File 'lib/twilio-ruby/rest/pricing/v2.rb', line 66

def to_s
  '<Twilio::REST::Pricing::V2>'
end

#voiceTwilio::REST::Pricing::V2::VoiceContext

Returns:

  • (Twilio::REST::Pricing::V2::VoiceContext)

60
61
62
# File 'lib/twilio-ruby/rest/pricing/v2.rb', line 60

def voice
  @voice ||= VoiceList.new self
end