Class: Twilio::REST::Routes::V3::IsoCountryCodeContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Routes::V3::IsoCountryCodeContext
- Defined in:
- lib/twilio-ruby/rest/routes/v3/iso_country_code.rb
Instance Method Summary collapse
-
#fetch ⇒ IsoCountryCodeInstance
Fetch the IsoCountryCodeInstance.
-
#fetch_with_metadata ⇒ IsoCountryCodeInstance
Fetch the IsoCountryCodeInstanceMetadata.
-
#initialize(version, iso_country_code, short_code) ⇒ IsoCountryCodeContext
constructor
Initialize the IsoCountryCodeContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(messaging_region: :unset, friendly_name: :unset) ⇒ IsoCountryCodeInstance
Update the IsoCountryCodeInstance.
-
#update_with_metadata(messaging_region: :unset, friendly_name: :unset) ⇒ IsoCountryCodeInstance
Update the IsoCountryCodeInstanceMetadata.
Constructor Details
#initialize(version, iso_country_code, short_code) ⇒ IsoCountryCodeContext
Initialize the IsoCountryCodeContext
52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/twilio-ruby/rest/routes/v3/iso_country_code.rb', line 52 def initialize(version, iso_country_code, short_code) apiV1Version = ApiV1Version.new version.domain, version super(apiV1Version) # Path Solution @solution = { iso_country_code: iso_country_code, short_code: short_code, } @uri = "/ShortCodes/#{@solution[:iso_country_code]}/#{@solution[:short_code]}" end |
Instance Method Details
#fetch ⇒ IsoCountryCodeInstance
Fetch the IsoCountryCodeInstance
66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/twilio-ruby/rest/routes/v3/iso_country_code.rb', line 66 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) IsoCountryCodeInstance.new( @version, payload, iso_country_code: @solution[:iso_country_code], short_code: @solution[:short_code], ) end |
#fetch_with_metadata ⇒ IsoCountryCodeInstance
Fetch the IsoCountryCodeInstanceMetadata
86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 |
# File 'lib/twilio-ruby/rest/routes/v3/iso_country_code.rb', line 86 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) iso_country_code_instance = IsoCountryCodeInstance.new( @version, response.body, iso_country_code: @solution[:iso_country_code], short_code: @solution[:short_code], ) IsoCountryCodeInstanceMetadata.new( @version, iso_country_code_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
185 186 187 188 |
# File 'lib/twilio-ruby/rest/routes/v3/iso_country_code.rb', line 185 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Routes.V3.IsoCountryCodeContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
178 179 180 181 |
# File 'lib/twilio-ruby/rest/routes/v3/iso_country_code.rb', line 178 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Routes.V3.IsoCountryCodeContext #{context}>" end |
#update(messaging_region: :unset, friendly_name: :unset) ⇒ IsoCountryCodeInstance
Update the IsoCountryCodeInstance
114 115 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/routes/v3/iso_country_code.rb', line 114 def update( messaging_region: :unset, friendly_name: :unset ) data = Twilio::Values.of({ 'messagingRegion' => messaging_region, 'friendlyName' => friendly_name, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) IsoCountryCodeInstance.new( @version, payload, iso_country_code: @solution[:iso_country_code], short_code: @solution[:short_code], ) end |
#update_with_metadata(messaging_region: :unset, friendly_name: :unset) ⇒ IsoCountryCodeInstance
Update the IsoCountryCodeInstanceMetadata
144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 |
# File 'lib/twilio-ruby/rest/routes/v3/iso_country_code.rb', line 144 def ( messaging_region: :unset, friendly_name: :unset ) data = Twilio::Values.of({ 'messagingRegion' => messaging_region, 'friendlyName' => friendly_name, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) iso_country_code_instance = IsoCountryCodeInstance.new( @version, response.body, iso_country_code: @solution[:iso_country_code], short_code: @solution[:short_code], ) IsoCountryCodeInstanceMetadata.new( @version, iso_country_code_instance, response.headers, response.status_code ) end |