Class: Twilio::REST::Numbers::V1::PortingPortInPhoneNumberContext

Inherits:
InstanceContext
  • Object
show all
Defined in:
lib/twilio-ruby/rest/numbers/v1/porting_port_in_phone_number.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, port_in_request_sid, phone_number_sid) ⇒ PortingPortInPhoneNumberContext

Initialize the PortingPortInPhoneNumberContext

Parameters:

  • version (Version)

    Version that contains the resource

  • port_in_request_sid (String)

    The SID of the Port In request. This is a unique identifier of the port in request.

  • phone_number_sid (String)

    The SID of the Phone number. This is a unique identifier of the phone number.



51
52
53
54
55
56
57
58
59
60
# File 'lib/twilio-ruby/rest/numbers/v1/porting_port_in_phone_number.rb', line 51

def initialize(version, port_in_request_sid, phone_number_sid)
    super(version)
    

    # Path Solution
    @solution = { port_in_request_sid: port_in_request_sid, phone_number_sid: phone_number_sid,  }
    @uri = "/Porting/PortIn/#{@solution[:port_in_request_sid]}/PhoneNumber/#{@solution[:phone_number_sid]}"

    
end

Instance Method Details

#deleteBoolean

Delete the PortingPortInPhoneNumberInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



64
65
66
67
68
69
70
71
72
# File 'lib/twilio-ruby/rest/numbers/v1/porting_port_in_phone_number.rb', line 64

def delete

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    

    @version.delete('DELETE', @uri, headers: headers)
end

#delete_with_metadataBoolean

Delete the PortingPortInPhoneNumberInstanceMetadata

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
# File 'lib/twilio-ruby/rest/numbers/v1/porting_port_in_phone_number.rb', line 77

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
      response = @version.('DELETE', @uri, headers: headers)
      portingPortInPhoneNumber_instance = PortingPortInPhoneNumberInstance.new(
          @version,
          response.body,
          account_sid: @solution[:account_sid],
          sid: @solution[:sid],
      )
      PortingPortInPhoneNumberInstanceMetadata.new(@version, portingPortInPhoneNumber_instance, response.headers, response.status_code)
end

#fetchPortingPortInPhoneNumberInstance

Fetch the PortingPortInPhoneNumberInstance

Returns:



96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/twilio-ruby/rest/numbers/v1/porting_port_in_phone_number.rb', line 96

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    PortingPortInPhoneNumberInstance.new(
        @version,
        payload,
        port_in_request_sid: @solution[:port_in_request_sid],
        phone_number_sid: @solution[:phone_number_sid],
    )
end

#fetch_with_metadataPortingPortInPhoneNumberInstance

Fetch the PortingPortInPhoneNumberInstanceMetadata

Returns:



116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/twilio-ruby/rest/numbers/v1/porting_port_in_phone_number.rb', line 116

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('GET', @uri, headers: headers)
    porting_port_in_phone_number_instance = PortingPortInPhoneNumberInstance.new(
        @version,
        response.body,
        port_in_request_sid: @solution[:port_in_request_sid],
        phone_number_sid: @solution[:phone_number_sid],
    )
    PortingPortInPhoneNumberInstanceMetadata.new(
        @version,
        porting_port_in_phone_number_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

Provide a detailed, user friendly representation



149
150
151
152
# File 'lib/twilio-ruby/rest/numbers/v1/porting_port_in_phone_number.rb', line 149

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

#to_sObject

Provide a user friendly representation



142
143
144
145
# File 'lib/twilio-ruby/rest/numbers/v1/porting_port_in_phone_number.rb', line 142

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