Class: Twilio::REST::Messaging::V1::ServiceContext
- Inherits:
-
InstanceContext
- Object
- InstanceContext
- Twilio::REST::Messaging::V1::ServiceContext
- Defined in:
- lib/twilio-ruby/rest/messaging/v1/service.rb,
lib/twilio-ruby/rest/messaging/v1/service/short_code.rb,
lib/twilio-ruby/rest/messaging/v1/service/alpha_sender.rb,
lib/twilio-ruby/rest/messaging/v1/service/phone_number.rb,
lib/twilio-ruby/rest/messaging/v1/service/channel_sender.rb,
lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person.rb,
lib/twilio-ruby/rest/messaging/v1/service/destination_alpha_sender.rb,
lib/twilio-ruby/rest/messaging/v1/service/us_app_to_person_usecase.rb
Defined Under Namespace
Classes: AlphaSenderContext, AlphaSenderInstance, AlphaSenderInstanceMetadata, AlphaSenderList, AlphaSenderListResponse, AlphaSenderPage, AlphaSenderPageMetadata, ChannelSenderContext, ChannelSenderInstance, ChannelSenderInstanceMetadata, ChannelSenderList, ChannelSenderListResponse, ChannelSenderPage, ChannelSenderPageMetadata, DestinationAlphaSenderContext, DestinationAlphaSenderInstance, DestinationAlphaSenderInstanceMetadata, DestinationAlphaSenderList, DestinationAlphaSenderListResponse, DestinationAlphaSenderPage, DestinationAlphaSenderPageMetadata, PhoneNumberContext, PhoneNumberInstance, PhoneNumberInstanceMetadata, PhoneNumberList, PhoneNumberListResponse, PhoneNumberPage, PhoneNumberPageMetadata, ShortCodeContext, ShortCodeInstance, ShortCodeInstanceMetadata, ShortCodeList, ShortCodeListResponse, ShortCodePage, ShortCodePageMetadata, UsAppToPersonContext, UsAppToPersonInstance, UsAppToPersonInstanceMetadata, UsAppToPersonList, UsAppToPersonListResponse, UsAppToPersonPage, UsAppToPersonPageMetadata, UsAppToPersonUsecaseInstance, UsAppToPersonUsecaseList, UsAppToPersonUsecaseListResponse, UsAppToPersonUsecasePage, UsAppToPersonUsecasePageMetadata
Instance Method Summary collapse
-
#alpha_senders(sid = :unset) ⇒ AlphaSenderList, AlphaSenderContext
Access the alpha_senders.
-
#channel_senders(sid = :unset) ⇒ ChannelSenderList, ChannelSenderContext
Access the channel_senders.
-
#delete ⇒ Boolean
Delete the ServiceInstance.
-
#delete_with_metadata ⇒ Boolean
Delete the ServiceInstanceMetadata.
-
#destination_alpha_senders(sid = :unset) ⇒ DestinationAlphaSenderList, DestinationAlphaSenderContext
Access the destination_alpha_senders.
-
#fetch ⇒ ServiceInstance
Fetch the ServiceInstance.
-
#fetch_with_metadata ⇒ ServiceInstance
Fetch the ServiceInstanceMetadata.
-
#initialize(version, sid) ⇒ ServiceContext
constructor
Initialize the ServiceContext.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#phone_numbers(sid = :unset) ⇒ PhoneNumberList, PhoneNumberContext
Access the phone_numbers.
-
#short_codes(sid = :unset) ⇒ ShortCodeList, ShortCodeContext
Access the short_codes.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#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, usecase: :unset, use_inbound_webhook_on_number: :unset) ⇒ ServiceInstance
Update the ServiceInstance.
-
#update_with_metadata(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, usecase: :unset, use_inbound_webhook_on_number: :unset) ⇒ ServiceInstance
Update the ServiceInstanceMetadata.
-
#us_app_to_person(sid = :unset) ⇒ UsAppToPersonList, UsAppToPersonContext
Access the us_app_to_person.
-
#us_app_to_person_usecases ⇒ UsAppToPersonUsecaseList, UsAppToPersonUsecaseContext
Access the us_app_to_person_usecases.
Constructor Details
#initialize(version, sid) ⇒ ServiceContext
Initialize the ServiceContext
313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 |
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 313 def initialize(version, sid) super(version) # Path Solution @solution = { sid: sid, } @uri = "/Services/#{@solution[:sid]}" # Dependents @us_app_to_person_usecases = nil @short_codes = nil @us_app_to_person = nil @phone_numbers = nil @alpha_senders = nil @destination_alpha_senders = nil @channel_senders = nil end |
Instance Method Details
#alpha_senders(sid = :unset) ⇒ AlphaSenderList, AlphaSenderContext
Access the alpha_senders
626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 |
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 626 def alpha_senders(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return AlphaSenderContext.new(@version, @solution[:sid],sid ) end unless @alpha_senders @alpha_senders = AlphaSenderList.new( @version, service_sid: @solution[:sid], ) end @alpha_senders end |
#channel_senders(sid = :unset) ⇒ ChannelSenderList, ChannelSenderContext
Access the channel_senders
664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 |
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 664 def channel_senders(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return ChannelSenderContext.new(@version, @solution[:sid],sid ) end unless @channel_senders @channel_senders = ChannelSenderList.new( @version, messaging_service_sid: @solution[:sid], ) end @channel_senders end |
#delete ⇒ Boolean
Delete the ServiceInstance
333 334 335 336 337 338 339 340 341 |
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 333 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 ServiceInstanceMetadata
346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 |
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 346 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('DELETE', @uri, headers: headers) service_instance = ServiceInstance.new( @version, response.body, account_sid: @solution[:account_sid], sid: @solution[:sid], ) ServiceInstanceMetadata.new(@version, service_instance, response.headers, response.status_code) end |
#destination_alpha_senders(sid = :unset) ⇒ DestinationAlphaSenderList, DestinationAlphaSenderContext
Access the destination_alpha_senders
645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 |
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 645 def destination_alpha_senders(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return DestinationAlphaSenderContext.new(@version, @solution[:sid],sid ) end unless @destination_alpha_senders @destination_alpha_senders = DestinationAlphaSenderList.new( @version, service_sid: @solution[:sid], ) end @destination_alpha_senders end |
#fetch ⇒ ServiceInstance
Fetch the ServiceInstance
365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 |
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 365 def fetch headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.fetch('GET', @uri, headers: headers) ServiceInstance.new( @version, payload, sid: @solution[:sid], ) end |
#fetch_with_metadata ⇒ ServiceInstance
Fetch the ServiceInstanceMetadata
384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 |
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 384 def headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('GET', @uri, headers: headers) service_instance = ServiceInstance.new( @version, response.body, sid: @solution[:sid], ) ServiceInstanceMetadata.new( @version, service_instance, response.headers, response.status_code ) end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
689 690 691 692 |
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 689 def inspect context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Messaging.V1.ServiceContext #{context}>" end |
#phone_numbers(sid = :unset) ⇒ PhoneNumberList, PhoneNumberContext
Access the phone_numbers
607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 |
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 607 def phone_numbers(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return PhoneNumberContext.new(@version, @solution[:sid],sid ) end unless @phone_numbers @phone_numbers = PhoneNumberList.new( @version, service_sid: @solution[:sid], ) end @phone_numbers end |
#short_codes(sid = :unset) ⇒ ShortCodeList, ShortCodeContext
Access the short_codes
569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 |
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 569 def short_codes(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return ShortCodeContext.new(@version, @solution[:sid],sid ) end unless @short_codes @short_codes = ShortCodeList.new( @version, service_sid: @solution[:sid], ) end @short_codes end |
#to_s ⇒ Object
Provide a user friendly representation
682 683 684 685 |
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 682 def to_s context = @solution.map{|k, v| "#{k}: #{v}"}.join(',') "#<Twilio.Messaging.V1.ServiceContext #{context}>" 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, usecase: :unset, use_inbound_webhook_on_number: :unset) ⇒ ServiceInstance
Update the ServiceInstance
425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 |
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 425 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, usecase: :unset, use_inbound_webhook_on_number: :unset ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'InboundRequestUrl' => inbound_request_url, 'InboundMethod' => inbound_method, 'FallbackUrl' => fallback_url, 'FallbackMethod' => fallback_method, 'StatusCallback' => status_callback, 'StickySender' => sticky_sender, 'MmsConverter' => mms_converter, 'SmartEncoding' => smart_encoding, 'ScanMessageContent' => , 'FallbackToLongCode' => fallback_to_long_code, 'AreaCodeGeomatch' => area_code_geomatch, 'ValidityPeriod' => validity_period, 'SynchronousValidation' => synchronous_validation, 'Usecase' => usecase, 'UseInboundWebhookOnNumber' => use_inbound_webhook_on_number, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) payload = @version.update('POST', @uri, data: data, headers: headers) ServiceInstance.new( @version, payload, sid: @solution[:sid], ) end |
#update_with_metadata(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, usecase: :unset, use_inbound_webhook_on_number: :unset) ⇒ ServiceInstance
Update the ServiceInstanceMetadata
496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 |
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 496 def ( 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, usecase: :unset, use_inbound_webhook_on_number: :unset ) data = Twilio::Values.of({ 'FriendlyName' => friendly_name, 'InboundRequestUrl' => inbound_request_url, 'InboundMethod' => inbound_method, 'FallbackUrl' => fallback_url, 'FallbackMethod' => fallback_method, 'StatusCallback' => status_callback, 'StickySender' => sticky_sender, 'MmsConverter' => mms_converter, 'SmartEncoding' => smart_encoding, 'ScanMessageContent' => , 'FallbackToLongCode' => fallback_to_long_code, 'AreaCodeGeomatch' => area_code_geomatch, 'ValidityPeriod' => validity_period, 'SynchronousValidation' => synchronous_validation, 'Usecase' => usecase, 'UseInboundWebhookOnNumber' => use_inbound_webhook_on_number, }) headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', }) response = @version.('POST', @uri, data: data, headers: headers) service_instance = ServiceInstance.new( @version, response.body, sid: @solution[:sid], ) ServiceInstanceMetadata.new( @version, service_instance, response.headers, response.status_code ) end |
#us_app_to_person(sid = :unset) ⇒ UsAppToPersonList, UsAppToPersonContext
Access the us_app_to_person
588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 |
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 588 def us_app_to_person(sid=:unset) raise ArgumentError, 'sid cannot be nil' if sid.nil? if sid != :unset return UsAppToPersonContext.new(@version, @solution[:sid],sid ) end unless @us_app_to_person @us_app_to_person = UsAppToPersonList.new( @version, messaging_service_sid: @solution[:sid], ) end @us_app_to_person end |
#us_app_to_person_usecases ⇒ UsAppToPersonUsecaseList, UsAppToPersonUsecaseContext
Access the us_app_to_person_usecases
558 559 560 561 562 563 564 |
# File 'lib/twilio-ruby/rest/messaging/v1/service.rb', line 558 def us_app_to_person_usecases unless @us_app_to_person_usecases @us_app_to_person_usecases = UsAppToPersonUsecaseList.new( @version, messaging_service_sid: @solution[:sid], ) end @us_app_to_person_usecases end |