Class: Twilio::REST::Numbers::V1::PortingPortabilityContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Numbers::V1::PortingPortabilityContext
- Defined in:
- lib/twilio-ruby/rest/numbers/v1/porting_portability.rb
Instance Method Summary collapse
-
#fetch(target_account_sid: :unset, address_sid: :unset) ⇒ PortingPortabilityInstance
Fetch the PortingPortabilityInstance.
-
#fetch_with_metadata(target_account_sid: :unset, address_sid: :unset) ⇒ PortingPortabilityInstance
Fetch the PortingPortabilityInstanceMetadata.
-
#initialize(version, phone_number) ⇒ PortingPortabilityContext
constructor
Initialize the PortingPortabilityContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
Constructor Details
#initialize(version, phone_number) ⇒ PortingPortabilityContext
Initialize the PortingPortabilityContext
50 51 52 53 54 55 56 57 58 59 |
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 50 def initialize(version, phone_number) super(version) # Path Solution @solution = { phone_number: phone_number, } @uri = "/Porting/Portability/PhoneNumber/#{CGI.escape(@solution[:phone_number]).gsub("+", "%20")}" end |
Instance Method Details
#fetch(target_account_sid: :unset, address_sid: :unset) ⇒ PortingPortabilityInstance
Fetch the PortingPortabilityInstance
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/numbers/v1/porting_portability.rb', line 65 def fetch( target_account_sid: :unset, address_sid: :unset ) params = Twilio::Values.of({ 'TargetAccountSid' => target_account_sid, 'AddressSid' => address_sid, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, params: params, headers: headers) PortingPortabilityInstance.new( @version, payload, phone_number: @solution[:phone_number], ) end |
#fetch_with_metadata(target_account_sid: :unset, address_sid: :unset) ⇒ PortingPortabilityInstance
Fetch the PortingPortabilityInstanceMetadata
93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 |
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 93 def ( target_account_sid: :unset, address_sid: :unset ) params = Twilio::Values.of({ 'TargetAccountSid' => target_account_sid, 'AddressSid' => address_sid, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, params: params, headers: headers) porting_portability_instance = PortingPortabilityInstance.new( @version, response.body, phone_number: @solution[:phone_number], ) PortingPortabilityInstanceMetadata.new( @version, porting_portability_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
132 133 134 135 |
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 132 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Numbers.V1.PortingPortabilityContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
125 126 127 128 |
# File 'lib/twilio-ruby/rest/numbers/v1/porting_portability.rb', line 125 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Numbers.V1.PortingPortabilityContext #{context}>" end |