Class: Twilio::REST::Lookups::V1

Inherits:
Version
  • Object
show all
Defined in:
lib/twilio-ruby/rest/lookups/v1.rb,
lib/twilio-ruby/rest/lookups/v1/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) ⇒ V1

Initialize the V1 version of Lookups


15
16
17
18
19
# File 'lib/twilio-ruby/rest/lookups/v1.rb', line 15

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

Instance Method Details

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

Parameters:

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

    The phone number to lookup in E.164 format, which consists of a + followed by the country code and subscriber number.

Returns:


27
28
29
30
31
32
33
34
35
36
# File 'lib/twilio-ruby/rest/lookups/v1.rb', line 27

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


40
41
42
# File 'lib/twilio-ruby/rest/lookups/v1.rb', line 40

def to_s
  '<Twilio::REST::Lookups::V1>'
end