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

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/lookups/v1/phone_number.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, phone_number) ⇒ PhoneNumberContext

Initialize the PhoneNumberContext



49
50
51
52
53
54
55
56
57
# File 'lib/twilio-ruby/rest/lookups/v1/phone_number.rb', line 49

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 the PhoneNumberInstance



65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/twilio-ruby/rest/lookups/v1/phone_number.rb', line 65

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'))
    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    payload = @version.fetch('GET', @uri, params: params, headers: headers)
    PhoneNumberInstance.new(
        @version,
        payload,
        phone_number: @solution[:phone_number],
    )
end

#inspectObject

Provide a detailed, user friendly representation



98
99
100
101
# File 'lib/twilio-ruby/rest/lookups/v1/phone_number.rb', line 98

def inspect
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Lookups.V1.PhoneNumberContext #{context}>"
end

#to_sObject

Provide a user friendly representation



91
92
93
94
# File 'lib/twilio-ruby/rest/lookups/v1/phone_number.rb', line 91

def to_s
    context = @solution.map{|k, v| "#{k}: #{v}"}.join(',')
    "#<Twilio.Lookups.V1.PhoneNumberContext #{context}>"
end