Class: Twilio::REST::Lookups::V2

Inherits:
Version
  • Object
show all
Defined in:
lib/twilio-ruby/rest/lookups/v2.rb,
lib/twilio-ruby/rest/lookups/v2/phone_number.rb

Defined Under Namespace

Classes: PhoneNumberContext, PhoneNumberInstance, PhoneNumberList, PhoneNumberPage

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 Lookups



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

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

Instance Method Details

#phone_numbers(phone_number = :unset) ⇒ Twilio::REST::Lookups::V2::PhoneNumberContext, Twilio::REST::Lookups::V2::PhoneNumberList

Parameters:

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

    The phone number to lookup in E.164 or national format. Default country code is +1 (North America).

Returns:



31
32
33
34
35
36
37
38
39
40
# File 'lib/twilio-ruby/rest/lookups/v2.rb', line 31

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_sObject

Provide a user friendly representation



43
44
45
# File 'lib/twilio-ruby/rest/lookups/v2.rb', line 43

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