Class: Twilio::REST::Messaging::V1::ServiceContext::ShortCodeContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Messaging::V1::ServiceContext::ShortCodeContext
- Defined in:
- lib/twilio-ruby/rest/messaging/v1/service/short_code.rb
Instance Method Summary collapse
-
#delete ⇒ Boolean
Delete the ShortCodeInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the ShortCodeInstanceMetadata.
-
#fetch ⇒ ShortCodeInstance
Fetch the ShortCodeInstance.
-
#fetch_with_metadata ⇒ ShortCodeInstance
Fetch the ShortCodeInstanceMetadata.
-
#initialize(version, service_sid, sid) ⇒ ShortCodeContext
constructor
Initialize the ShortCodeContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#to_s ⇒ Object
Provide a user friendly representation.
Constructor Details
#initialize(version, service_sid, sid) ⇒ ShortCodeContext
Initialize the ShortCodeContext
228 229 230 231 232 233 234 235 236 237 |
# File 'lib/twilio-ruby/rest/messaging/v1/service/short_code.rb', line 228 def initialize(version, service_sid, sid) super(version) # Path Solution @solution = { service_sid: service_sid, sid: sid, } @uri = "/Services/#{@solution[:service_sid]}/ShortCodes/#{@solution[:sid]}" end |
Instance Method Details
#delete ⇒ Boolean
Delete the ShortCodeInstance
241 242 243 244 245 246 247 248 249 |
# File 'lib/twilio-ruby/rest/messaging/v1/service/short_code.rb', line 241 def delete headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) @version.delete('DELETE', @uri, headers: headers) end |
#delete_with_metadata ⇒ Boolean
Delete the ShortCodeInstanceMetadata
254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
# File 'lib/twilio-ruby/rest/messaging/v1/service/short_code.rb', line 254 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) shortCode_instance = ShortCodeInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) ShortCodeInstanceMetadata.new(@version, shortCode_instance, response.headers, response.status_code) end |
#fetch ⇒ ShortCodeInstance
Fetch the ShortCodeInstance
273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 |
# File 'lib/twilio-ruby/rest/messaging/v1/service/short_code.rb', line 273 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) ShortCodeInstance.new( @version, payload, service_sid: @solution[:service_sid], sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ ShortCodeInstance
Fetch the ShortCodeInstanceMetadata
293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 |
# File 'lib/twilio-ruby/rest/messaging/v1/service/short_code.rb', line 293 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) short_code_instance = ShortCodeInstance.new( @version, response.body, service_sid: @solution[:service_sid], sid: @solution[:sid], ) ShortCodeInstanceMetadata.new( @version, short_code_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
326 327 328 329 |
# File 'lib/twilio-ruby/rest/messaging/v1/service/short_code.rb', line 326 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Messaging.V1.ShortCodeContext #{context}>" end |
#to_s ⇒ Object
Provide a user friendly representation
319 320 321 322 |
# File 'lib/twilio-ruby/rest/messaging/v1/service/short_code.rb', line 319 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Messaging.V1.ShortCodeContext #{context}>" end |