Class: Twilio::REST::Messaging::V1::DomainConfigContext

Inherits:
InstanceContext show all
Defined in:
lib/twilio-ruby/rest/messaging/v1/domain_config.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, domain_sid) ⇒ DomainConfigContext

Initialize the DomainConfigContext

Parameters:

  • version (Version)

    Version that contains the resource

  • domain_sid (String)

    Unique string used to identify the domain that this config should be associated with.



74
75
76
77
78
79
80
# File 'lib/twilio-ruby/rest/messaging/v1/domain_config.rb', line 74

def initialize(version, domain_sid)
  super(version)

  # Path Solution
  @solution = {domain_sid: domain_sid, }
  @uri = "/LinkShortening/Domains/#{@solution[:domain_sid]}/Config"
end

Instance Method Details

#fetchDomainConfigInstance

Fetch the DomainConfigInstance

Returns:



102
103
104
105
106
# File 'lib/twilio-ruby/rest/messaging/v1/domain_config.rb', line 102

def fetch
  payload = @version.fetch('GET', @uri)

  DomainConfigInstance.new(@version, payload, domain_sid: @solution[:domain_sid], )
end

#inspectObject

Provide a detailed, user friendly representation



117
118
119
120
# File 'lib/twilio-ruby/rest/messaging/v1/domain_config.rb', line 117

def inspect
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Messaging.V1.DomainConfigContext #{context}>"
end

#to_sObject

Provide a user friendly representation



110
111
112
113
# File 'lib/twilio-ruby/rest/messaging/v1/domain_config.rb', line 110

def to_s
  context = @solution.map {|k, v| "#{k}: #{v}"}.join(',')
  "#<Twilio.Messaging.V1.DomainConfigContext #{context}>"
end

#update(fallback_url: :unset, callback_url: :unset) ⇒ DomainConfigInstance

Update the DomainConfigInstance

Parameters:

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

    Any requests we receive to this domain that do not match an existing shortened message will be redirected to the fallback url. These will likely be either expired messages, random misdirected traffic, or intentional scraping.

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

    URL to receive click events to your webhook whenever the recipients click on the shortened links

Returns:



91
92
93
94
95
96
97
# File 'lib/twilio-ruby/rest/messaging/v1/domain_config.rb', line 91

def update(fallback_url: :unset, callback_url: :unset)
  data = Twilio::Values.of({'FallbackUrl' => fallback_url, 'CallbackUrl' => callback_url, })

  payload = @version.update('POST', @uri, data: data)

  DomainConfigInstance.new(@version, payload, domain_sid: @solution[:domain_sid], )
end