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



21
22
23
24
25
26
27
# File 'lib/twilio-ruby/rest/pricing/v2.rb', line 21

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:

Returns:



33
34
35
36
37
38
39
40
41
42
# File 'lib/twilio-ruby/rest/pricing/v2.rb', line 33

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](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.

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



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

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

#voiceTwilio::REST::Pricing::V2::VoiceList



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

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