Class: Twilio::REST::Api::V2010::AccountContext::ShortCodeInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Api::V2010::AccountContext::ShortCodeInstance
- Defined in:
- lib/twilio-ruby/rest/api/v2010/account/short_code.rb
Instance Method Summary collapse
-
#account_sid ⇒ String
The SID of the [Account](www.twilio.com/docs/iam/api/account) that created this ShortCode resource.
-
#api_version ⇒ String
The API version used to start a new TwiML session when an SMS message is sent to this short code.
-
#context ⇒ ShortCodeContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#date_created ⇒ Time
The date and time in GMT that this resource was created specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
-
#date_updated ⇒ Time
The date and time in GMT that this resource was last updated, specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
-
#fetch ⇒ ShortCodeInstance
Fetch the ShortCodeInstance.
-
#friendly_name ⇒ String
A string that you assigned to describe this resource.
-
#initialize(version, payload, account_sid: nil, sid: nil) ⇒ ShortCodeInstance
constructor
Initialize the ShortCodeInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#short_code ⇒ String
The short code.
-
#sid ⇒ String
The unique string that that we created to identify this ShortCode resource.
-
#sms_fallback_method ⇒ String
The HTTP method we use to call the
sms_fallback_url. -
#sms_fallback_url ⇒ String
The URL that we call if an error occurs while retrieving or executing the TwiML from
sms_url. -
#sms_method ⇒ String
The HTTP method we use to call the
sms_url. -
#sms_url ⇒ String
The URL we call when receiving an incoming SMS message to this short code.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#update(friendly_name: :unset, api_version: :unset, sms_url: :unset, sms_method: :unset, sms_fallback_url: :unset, sms_fallback_method: :unset) ⇒ ShortCodeInstance
Update the ShortCodeInstance.
-
#uri ⇒ String
The URI of this resource, relative to
https://api.twilio.com.
Constructor Details
#initialize(version, payload, account_sid: nil, sid: nil) ⇒ ShortCodeInstance
Initialize the ShortCodeInstance
486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 |
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 486 def initialize(version, payload , account_sid: nil, sid: nil) super(version) # Marshaled Properties @properties = { 'account_sid' => payload['account_sid'], 'api_version' => payload['api_version'], 'date_created' => Twilio.deserialize_rfc2822(payload['date_created']), 'date_updated' => Twilio.deserialize_rfc2822(payload['date_updated']), 'friendly_name' => payload['friendly_name'], 'short_code' => payload['short_code'], 'sid' => payload['sid'], 'sms_fallback_method' => payload['sms_fallback_method'], 'sms_fallback_url' => payload['sms_fallback_url'], 'sms_method' => payload['sms_method'], 'sms_url' => payload['sms_url'], 'uri' => payload['uri'], } # Context @instance_context = nil @params = { 'account_sid' => account_sid ,'sid' => sid || @properties['sid'] , } end |
Instance Method Details
#account_sid ⇒ String
Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created this ShortCode resource.
524 525 526 |
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 524 def account_sid @properties['account_sid'] end |
#api_version ⇒ String
Returns The API version used to start a new TwiML session when an SMS message is sent to this short code.
530 531 532 |
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 530 def api_version @properties['api_version'] end |
#context ⇒ ShortCodeContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
515 516 517 518 519 520 |
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 515 def context unless @instance_context @instance_context = ShortCodeContext.new(@version , @params['account_sid'], @params['sid']) end @instance_context end |
#date_created ⇒ Time
Returns The date and time in GMT that this resource was created specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
536 537 538 |
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 536 def date_created @properties['date_created'] end |
#date_updated ⇒ Time
Returns The date and time in GMT that this resource was last updated, specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.
542 543 544 |
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 542 def date_updated @properties['date_updated'] end |
#fetch ⇒ ShortCodeInstance
Fetch the ShortCodeInstance
597 598 599 600 |
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 597 def fetch context.fetch end |
#friendly_name ⇒ String
Returns A string that you assigned to describe this resource. By default, the FriendlyName is the short code.
548 549 550 |
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 548 def friendly_name @properties['friendly_name'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
639 640 641 642 |
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 639 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Api.V2010.ShortCodeInstance #{values}>" end |
#short_code ⇒ String
Returns The short code. e.g., 894546.
554 555 556 |
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 554 def short_code @properties['short_code'] end |
#sid ⇒ String
Returns The unique string that that we created to identify this ShortCode resource.
560 561 562 |
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 560 def sid @properties['sid'] end |
#sms_fallback_method ⇒ String
Returns The HTTP method we use to call the sms_fallback_url. Can be: GET or POST.
566 567 568 |
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 566 def sms_fallback_method @properties['sms_fallback_method'] end |
#sms_fallback_url ⇒ String
Returns The URL that we call if an error occurs while retrieving or executing the TwiML from sms_url.
572 573 574 |
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 572 def sms_fallback_url @properties['sms_fallback_url'] end |
#sms_method ⇒ String
Returns The HTTP method we use to call the sms_url. Can be: GET or POST.
578 579 580 |
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 578 def sms_method @properties['sms_method'] end |
#sms_url ⇒ String
Returns The URL we call when receiving an incoming SMS message to this short code.
584 585 586 |
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 584 def sms_url @properties['sms_url'] end |
#to_s ⇒ Object
Provide a user friendly representation
632 633 634 635 |
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 632 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Api.V2010.ShortCodeInstance #{values}>" end |
#update(friendly_name: :unset, api_version: :unset, sms_url: :unset, sms_method: :unset, sms_fallback_url: :unset, sms_fallback_method: :unset) ⇒ ShortCodeInstance
Update the ShortCodeInstance
611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 |
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 611 def update( friendly_name: :unset, api_version: :unset, sms_url: :unset, sms_method: :unset, sms_fallback_url: :unset, sms_fallback_method: :unset ) context.update( friendly_name: friendly_name, api_version: api_version, sms_url: sms_url, sms_method: sms_method, sms_fallback_url: sms_fallback_url, sms_fallback_method: sms_fallback_method, ) end |
#uri ⇒ String
Returns The URI of this resource, relative to https://api.twilio.com.
590 591 592 |
# File 'lib/twilio-ruby/rest/api/v2010/account/short_code.rb', line 590 def uri @properties['uri'] end |