Class: Twilio::REST::Routes::V3

Inherits:
Version
  • Object
show all
Defined in:
lib/twilio-ruby/rest/routes/v3.rb,
lib/twilio-ruby/rest/routes/v3/phone_number.rb,
lib/twilio-ruby/rest/routes/v3/iso_country_code.rb

Defined Under Namespace

Classes: IsoCountryCodeContext, IsoCountryCodeInstance, IsoCountryCodeInstanceMetadata, IsoCountryCodeList, IsoCountryCodeListResponse, IsoCountryCodePage, PhoneNumberContext, PhoneNumberInstance, PhoneNumberInstanceMetadata, PhoneNumberList, PhoneNumberListResponse, PhoneNumberPage

Instance Attribute Summary

Attributes inherited from Version

#domain, #version

Instance Method Summary collapse

Methods inherited from Version

#absolute_url, #create, #create_with_metadata, #delete, #delete_with_metadata, #exception, #fetch, #fetch_with_metadata, #page, #patch, #read_limits, #relative_uri, #request, #stream, #stream_with_metadata, #update, #update_with_metadata

Constructor Details

#initialize(domain) ⇒ V3

Initialize the V3 version of Routes



21
22
23
24
25
26
# File 'lib/twilio-ruby/rest/routes/v3.rb', line 21

def initialize(domain)
    super
    @version = 'v3'
    @iso_country_code = nil
    @phone_numbers = nil
end

Instance Method Details

#iso_country_code(iso_country_code = :unset, short_code = :unset) ⇒ Twilio::REST::Routes::V3::IsoCountryCodeContext, Twilio::REST::Routes::V3::IsoCountryCodeList

Parameters:

  • iso_country_code (String) (defaults to: :unset) —

    The ISO country code of the short code

  • short_code (String) (defaults to: :unset) —

    The short code

Returns:



33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
# File 'lib/twilio-ruby/rest/routes/v3.rb', line 33

def iso_country_code(iso_country_code=:unset, short_code=:unset)
    if iso_country_code.nil?
        raise ArgumentError, 'iso_country_code cannot be nil'
    end
    if short_code.nil?
        raise ArgumentError, 'short_code cannot be nil'
    end

    if iso_country_code == :unset && short_code == :unset
        @iso_country_code ||= IsoCountryCodeList.new self
    elsif iso_country_code != :unset && short_code == :unset
        IsoCountryCodeList.new(self, iso_country_code: iso_country_code)
    else
        IsoCountryCodeContext.new(self, iso_country_code, short_code)
    end
end

#phone_numbers(phone_number = :unset) ⇒ Twilio::REST::Routes::V3::PhoneNumberContext, Twilio::REST::Routes::V3::PhoneNumberList

Parameters:

  • phone_number (String) (defaults to: :unset) —

    The phone number in E.164 format

Returns:



74
75
76
77
78
79
80
81
82
83
84
# File 'lib/twilio-ruby/rest/routes/v3.rb', line 74

def phone_numbers(phone_number=:unset)
    if phone_number.nil?
        raise ArgumentError, 'phone_number cannot be nil'
    end

    if phone_number == :unset
        @phone_numbers ||= PhoneNumberList.new self
    else
        PhoneNumberContext.new(self, phone_number)
    end
end

#to_s ⇒ Object

Provide a user friendly representation



87
88
89
# File 'lib/twilio-ruby/rest/routes/v3.rb', line 87

def to_s
    '<Twilio::REST::Routes::V3>';
end