Class: Twilio::REST::Conversations::V1::ConfigurationContext::WebhookInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload) ⇒ WebhookInstance

Initialize the WebhookInstance



133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 133

def initialize(version, payload)
  super(version)

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'method' => payload['method'],
      'filters' => payload['filters'],
      'pre_webhook_url' => payload['pre_webhook_url'],
      'post_webhook_url' => payload['post_webhook_url'],
      'target' => payload['target'],
      'url' => payload['url'],
  }

  # Context
  @instance_context = nil
  @params = {}
end

Instance Method Details

#account_sidString



165
166
167
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 165

def 
  @properties['account_sid']
end

#contextWebhookContext

Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context



156
157
158
159
160
161
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 156

def context
  unless @instance_context
    @instance_context = WebhookContext.new(@version, )
  end
  @instance_context
end

#fetchWebhookInstance

Fetch the WebhookInstance



208
209
210
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 208

def fetch
  context.fetch
end

#filtersArray[String]



177
178
179
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 177

def filters
  @properties['filters']
end

#inspectObject

Provide a detailed, user friendly representation



245
246
247
248
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 245

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

#methodwebhook.Method



171
172
173
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 171

def method
  @properties['method']
end

#post_webhook_urlString



189
190
191
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 189

def post_webhook_url
  @properties['post_webhook_url']
end

#pre_webhook_urlString



183
184
185
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 183

def pre_webhook_url
  @properties['pre_webhook_url']
end

#targetwebhook.Target



195
196
197
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 195

def target
  @properties['target']
end

#to_sObject

Provide a user friendly representation



238
239
240
241
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 238

def to_s
  values = @params.map{|k, v| "#{k}: #{v}"}.join(" ")
  "<Twilio.Conversations.V1.WebhookInstance #{values}>"
end

#update(method: :unset, filters: :unset, pre_webhook_url: :unset, post_webhook_url: :unset, target: :unset) ⇒ WebhookInstance

Update the WebhookInstance



226
227
228
229
230
231
232
233
234
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 226

def update(method: :unset, filters: :unset, pre_webhook_url: :unset, post_webhook_url: :unset, target: :unset)
  context.update(
      method: method,
      filters: filters,
      pre_webhook_url: pre_webhook_url,
      post_webhook_url: post_webhook_url,
      target: target,
  )
end

#urlString



201
202
203
# File 'lib/twilio-ruby/rest/conversations/v1/configuration/webhook.rb', line 201

def url
  @properties['url']
end