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



381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 381

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



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

def 
  @properties['account_sid']
end

#alpha_sendersalpha_senders

Access the alpha_senders



631
632
633
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 631

def alpha_senders
  context.alpha_senders
end

#area_code_geomatchBoolean



516
517
518
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 516

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



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

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

#date_createdTime



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

def date_created
  @properties['date_created']
end

#date_updatedTime



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

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Delete the ServiceInstance



610
611
612
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 610

def delete
  context.delete
end

#fallback_methodString



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

def fallback_method
  @properties['fallback_method']
end

#fallback_to_long_codeBoolean



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

def fallback_to_long_code
  @properties['fallback_to_long_code']
end

#fallback_urlString



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

def fallback_url
  @properties['fallback_url']
end

#fetchServiceInstance

Fetch the ServiceInstance



603
604
605
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 603

def fetch
  context.fetch
end

#friendly_nameString



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

def friendly_name
  @properties['friendly_name']
end

#inbound_methodString



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

def inbound_method
  @properties['inbound_method']
end

#inbound_request_urlString



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

def inbound_request_url
  @properties['inbound_request_url']
end

#inspectObject

Provide a detailed, user friendly representation



644
645
646
647
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 644

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


540
541
542
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 540

def links
  @properties['links']
end

#mms_converterBoolean



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

def mms_converter
  @properties['mms_converter']
end

#phone_numbersphone_numbers

Access the phone_numbers



617
618
619
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 617

def phone_numbers
  context.phone_numbers
end

#scan_message_contentservice.ScanMessageContent



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

def scan_message_content
  @properties['scan_message_content']
end

#short_codesshort_codes

Access the short_codes



624
625
626
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 624

def short_codes
  context.short_codes
end

#sidString



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

def sid
  @properties['sid']
end

#smart_encodingBoolean



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

def smart_encoding
  @properties['smart_encoding']
end

#status_callbackString



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

def status_callback
  @properties['status_callback']
end

#sticky_senderBoolean



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

def sticky_sender
  @properties['sticky_sender']
end

#synchronous_validationBoolean



522
523
524
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 522

def synchronous_validation
  @properties['synchronous_validation']
end

#to_sObject

Provide a user friendly representation



637
638
639
640
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 637

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



581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 581

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



534
535
536
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 534

def url
  @properties['url']
end

#validity_periodString



528
529
530
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 528

def validity_period
  @properties['validity_period']
end