Class: Twilio::REST::Lookups::V1::PhoneNumberContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Lookups::V1::PhoneNumberContext
- Defined in:
- lib/twilio-ruby/rest/lookups/v1/phone_number.rb
Instance Method Summary collapse
-
#fetch(country_code: :unset, type: :unset, add_ons: :unset, add_ons_data: :unset) ⇒ PhoneNumberInstance
Fetch a PhoneNumberInstance.
-
#initialize(version, phone_number) ⇒ PhoneNumberContext
constructor
Initialize the PhoneNumberContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
Constructor Details
#initialize(version, phone_number) ⇒ PhoneNumberContext
Initialize the PhoneNumberContext
69 70 71 72 73 74 75 |
# File 'lib/twilio-ruby/rest/lookups/v1/phone_number.rb', line 69 def initialize(version, phone_number) super(version) # Path Solution @solution = {phone_number: phone_number, } @uri = "/PhoneNumbers/#{@solution[:phone_number]}" end |
Instance Method Details
#fetch(country_code: :unset, type: :unset, add_ons: :unset, add_ons_data: :unset) ⇒ PhoneNumberInstance
Fetch a PhoneNumberInstance
97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 |
# File 'lib/twilio-ruby/rest/lookups/v1/phone_number.rb', line 97 def fetch(country_code: :unset, type: :unset, add_ons: :unset, add_ons_data: :unset) params = Twilio::Values.of({ 'CountryCode' => country_code, 'Type' => Twilio.serialize_list(type) { |e| e }, 'AddOns' => Twilio.serialize_list(add_ons) { |e| e }, }) params.merge!(Twilio.prefixed_collapsible_map(add_ons_data, 'AddOns')) payload = @version.fetch( 'GET', @uri, params, ) PhoneNumberInstance.new(@version, payload, phone_number: @solution[:phone_number], ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
123 124 125 126 |
# File 'lib/twilio-ruby/rest/lookups/v1/phone_number.rb', line 123 def inspect context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Lookups.V1.PhoneNumberContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
116 117 118 119 |
# File 'lib/twilio-ruby/rest/lookups/v1/phone_number.rb', line 116 def to_s context = @solution.map {|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Lookups.V1.PhoneNumberContext #{context}>" end |