Class: Twilio::REST::Messaging::V1::ServiceInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/messaging/v1/service.rb

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, sid: nil) ⇒ ServiceInstance

Initialize the ServiceInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • sid (String) (defaults to: nil)

    The sid



351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 351

def initialize(version, payload, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'sid' => payload['sid'],
      'account_sid' => payload['account_sid'],
      'friendly_name' => payload['friendly_name'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'inbound_request_url' => payload['inbound_request_url'],
      'inbound_method' => payload['inbound_method'],
      'fallback_url' => payload['fallback_url'],
      'fallback_method' => payload['fallback_method'],
      'status_callback' => payload['status_callback'],
      'sticky_sender' => payload['sticky_sender'],
      'mms_converter' => payload['mms_converter'],
      'smart_encoding' => payload['smart_encoding'],
      'scan_message_content' => payload['scan_message_content'],
      'fallback_to_long_code' => payload['fallback_to_long_code'],
      'area_code_geomatch' => payload['area_code_geomatch'],
      'synchronous_validation' => payload['synchronous_validation'],
      'validity_period' => payload['validity_period'].to_i,
      'url' => payload['url'],
      'links' => payload['links'],
  }

  # Context
  @instance_context = nil
  @params = {'sid' => sid || @properties['sid'], }
end

Instance Method Details

#account_sidString

Returns The account_sid.

Returns:

  • (String)

    The account_sid



402
403
404
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 402

def 
  @properties['account_sid']
end

#alpha_sendersalpha_senders

Access the alpha_senders

Returns:



582
583
584
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 582

def alpha_senders
  context.alpha_senders
end

#area_code_geomatchBoolean

Returns The area_code_geomatch.

Returns:

  • (Boolean)

    The area_code_geomatch



486
487
488
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 486

def area_code_geomatch
  @properties['area_code_geomatch']
end

#contextServiceContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context

Returns:



387
388
389
390
391
392
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 387

def context
  unless @instance_context
    @instance_context = ServiceContext.new(@version, @params['sid'], )
  end
  @instance_context
end

#date_createdTime

Returns The date_created.

Returns:

  • (Time)

    The date_created



414
415
416
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 414

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date_updated.

Returns:

  • (Time)

    The date_updated



420
421
422
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 420

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Deletes the ServiceInstance

Returns:

  • (Boolean)

    true if delete succeeds, true otherwise



561
562
563
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 561

def delete
  context.delete
end

#fallback_methodString

Returns The fallback_method.

Returns:

  • (String)

    The fallback_method



444
445
446
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 444

def fallback_method
  @properties['fallback_method']
end

#fallback_to_long_codeBoolean

Returns The fallback_to_long_code.

Returns:

  • (Boolean)

    The fallback_to_long_code



480
481
482
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 480

def fallback_to_long_code
  @properties['fallback_to_long_code']
end

#fallback_urlString

Returns The fallback_url.

Returns:

  • (String)

    The fallback_url



438
439
440
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 438

def fallback_url
  @properties['fallback_url']
end

#fetchServiceInstance

Fetch a ServiceInstance

Returns:



554
555
556
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 554

def fetch
  context.fetch
end

#friendly_nameString

Returns The friendly_name.

Returns:

  • (String)

    The friendly_name



408
409
410
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 408

def friendly_name
  @properties['friendly_name']
end

#inbound_methodString

Returns The inbound_method.

Returns:

  • (String)

    The inbound_method



432
433
434
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 432

def inbound_method
  @properties['inbound_method']
end

#inbound_request_urlString

Returns The inbound_request_url.

Returns:

  • (String)

    The inbound_request_url



426
427
428
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 426

def inbound_request_url
  @properties['inbound_request_url']
end

#inspectObject

Provide a detailed, user friendly representation



595
596
597
598
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 595

def inspect
  values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Messaging.V1.ServiceInstance #{values}>"
end

Returns The links.

Returns:

  • (String)

    The links



510
511
512
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 510

def links
  @properties['links']
end

#mms_converterBoolean

Returns The mms_converter.

Returns:

  • (Boolean)

    The mms_converter



462
463
464
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 462

def mms_converter
  @properties['mms_converter']
end

#phone_numbersphone_numbers

Access the phone_numbers

Returns:



568
569
570
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 568

def phone_numbers
  context.phone_numbers
end

#scan_message_contentservice.ScanMessageContent

Returns The scan_message_content.

Returns:

  • (service.ScanMessageContent)

    The scan_message_content



474
475
476
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 474

def scan_message_content
  @properties['scan_message_content']
end

#short_codesshort_codes

Access the short_codes

Returns:



575
576
577
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 575

def short_codes
  context.short_codes
end

#sidString

Returns The sid.

Returns:

  • (String)

    The sid



396
397
398
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 396

def sid
  @properties['sid']
end

#smart_encodingBoolean

Returns The smart_encoding.

Returns:

  • (Boolean)

    The smart_encoding



468
469
470
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 468

def smart_encoding
  @properties['smart_encoding']
end

#status_callbackString

Returns The status_callback.

Returns:

  • (String)

    The status_callback



450
451
452
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 450

def status_callback
  @properties['status_callback']
end

#sticky_senderBoolean

Returns The sticky_sender.

Returns:

  • (Boolean)

    The sticky_sender



456
457
458
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 456

def sticky_sender
  @properties['sticky_sender']
end

#synchronous_validationBoolean

Returns The synchronous_validation.

Returns:

  • (Boolean)

    The synchronous_validation



492
493
494
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 492

def synchronous_validation
  @properties['synchronous_validation']
end

#to_sObject

Provide a user friendly representation



588
589
590
591
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 588

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Messaging.V1.ServiceInstance #{values}>"
end

#update(friendly_name: :unset, inbound_request_url: :unset, inbound_method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, sticky_sender: :unset, mms_converter: :unset, smart_encoding: :unset, scan_message_content: :unset, fallback_to_long_code: :unset, area_code_geomatch: :unset, validity_period: :unset, synchronous_validation: :unset) ⇒ ServiceInstance

Update the ServiceInstance

Parameters:

  • friendly_name (String) (defaults to: :unset)

    The friendly_name

  • inbound_request_url (String) (defaults to: :unset)

    The inbound_request_url

  • inbound_method (String) (defaults to: :unset)

    The inbound_method

  • fallback_url (String) (defaults to: :unset)

    The fallback_url

  • fallback_method (String) (defaults to: :unset)

    The fallback_method

  • status_callback (String) (defaults to: :unset)

    The status_callback

  • sticky_sender (Boolean) (defaults to: :unset)

    The sticky_sender

  • mms_converter (Boolean) (defaults to: :unset)

    The mms_converter

  • smart_encoding (Boolean) (defaults to: :unset)

    The smart_encoding

  • scan_message_content (service.ScanMessageContent) (defaults to: :unset)

    The scan_message_content

  • fallback_to_long_code (Boolean) (defaults to: :unset)

    The fallback_to_long_code

  • area_code_geomatch (Boolean) (defaults to: :unset)

    The area_code_geomatch

  • validity_period (String) (defaults to: :unset)

    The validity_period

  • synchronous_validation (Boolean) (defaults to: :unset)

    The synchronous_validation

Returns:



532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 532

def update(friendly_name: :unset, inbound_request_url: :unset, inbound_method: :unset, fallback_url: :unset, fallback_method: :unset, status_callback: :unset, sticky_sender: :unset, mms_converter: :unset, smart_encoding: :unset, scan_message_content: :unset, fallback_to_long_code: :unset, area_code_geomatch: :unset, validity_period: :unset, synchronous_validation: :unset)
  context.update(
      friendly_name: friendly_name,
      inbound_request_url: inbound_request_url,
      inbound_method: inbound_method,
      fallback_url: fallback_url,
      fallback_method: fallback_method,
      status_callback: status_callback,
      sticky_sender: sticky_sender,
      mms_converter: mms_converter,
      smart_encoding: smart_encoding,
      scan_message_content: scan_message_content,
      fallback_to_long_code: fallback_to_long_code,
      area_code_geomatch: area_code_geomatch,
      validity_period: validity_period,
      synchronous_validation: synchronous_validation,
  )
end

#urlString

Returns The url.

Returns:

  • (String)

    The url



504
505
506
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 504

def url
  @properties['url']
end

#validity_periodString

Returns The validity_period.

Returns:

  • (String)

    The validity_period



498
499
500
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 498

def validity_period
  @properties['validity_period']
end