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

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

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.



50
51
52
53
54
55
56
57
58
59
# File 'lib/twilio-ruby/rest/messaging/v1/domain_config.rb', line 50

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:



63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/twilio-ruby/rest/messaging/v1/domain_config.rb', line 63

def fetch

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.fetch('GET', @uri, headers: headers)
    DomainConfigInstance.new(
        @version,
        payload,
        domain_sid: @solution[:domain_sid],
    )
end

#fetch_with_metadataDomainConfigInstance

Fetch the DomainConfigInstanceMetadata

Returns:



82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
# File 'lib/twilio-ruby/rest/messaging/v1/domain_config.rb', line 82

def 

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('GET', @uri, headers: headers)
    domain_config_instance = DomainConfigInstance.new(
        @version,
        response.body,
        domain_sid: @solution[:domain_sid],
    )
    .new(
        @version,
        domain_config_instance,
        response.headers,
        response.status_code
    )
end

#inspectObject

Provide a detailed, user friendly representation



190
191
192
193
# File 'lib/twilio-ruby/rest/messaging/v1/domain_config.rb', line 190

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

#to_sObject

Provide a user friendly representation



183
184
185
186
# File 'lib/twilio-ruby/rest/messaging/v1/domain_config.rb', line 183

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

#update(fallback_url: :unset, callback_url: :unset, continue_on_failure: :unset, disable_https: :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

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

    Boolean field to set customer delivery preference when there is a failure in linkShortening service

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

    Customer’s choice to send links with/without \"https://\" attached to shortened url. If true, messages will not be sent with https:// at the beginning of the url. If false, messages will be sent with https:// at the beginning of the url. False is the default behavior if it is not specified.

Returns:



111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/twilio-ruby/rest/messaging/v1/domain_config.rb', line 111

def update(
    fallback_url: :unset, 
    callback_url: :unset, 
    continue_on_failure: :unset, 
    disable_https: :unset
)

    data = Twilio::Values.of({
        'FallbackUrl' => fallback_url,
        'CallbackUrl' => callback_url,
        'ContinueOnFailure' => continue_on_failure,
        'DisableHttps' => disable_https,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    payload = @version.update('POST', @uri, data: data, headers: headers)
    DomainConfigInstance.new(
        @version,
        payload,
        domain_sid: @solution[:domain_sid],
    )
end

#update_with_metadata(fallback_url: :unset, callback_url: :unset, continue_on_failure: :unset, disable_https: :unset) ⇒ DomainConfigInstance

Update the DomainConfigInstanceMetadata

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

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

    Boolean field to set customer delivery preference when there is a failure in linkShortening service

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

    Customer’s choice to send links with/without \"https://\" attached to shortened url. If true, messages will not be sent with https:// at the beginning of the url. If false, messages will be sent with https:// at the beginning of the url. False is the default behavior if it is not specified.

Returns:



146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
# File 'lib/twilio-ruby/rest/messaging/v1/domain_config.rb', line 146

def (
  fallback_url: :unset, 
  callback_url: :unset, 
  continue_on_failure: :unset, 
  disable_https: :unset
)

    data = Twilio::Values.of({
        'FallbackUrl' => fallback_url,
        'CallbackUrl' => callback_url,
        'ContinueOnFailure' => continue_on_failure,
        'DisableHttps' => disable_https,
    })

    headers = Twilio::Values.of({'Content-Type' => 'application/x-www-form-urlencoded', })
    
    
    
    
    
    response = @version.('POST', @uri, data: data, headers: headers)
    domain_config_instance = DomainConfigInstance.new(
        @version,
        response.body,
        domain_sid: @solution[:domain_sid],
    )
    .new(
        @version,
        domain_config_instance,
        response.headers,
        response.status_code
    )
end