Class: Twilio::REST::Verify::V2::ServiceContext::MessagingConfigurationInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/verify/v2/service/messaging_configuration.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, service_sid: nil, country: nil) ⇒ MessagingConfigurationInstance

Initialize the MessagingConfigurationInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • service_sid (String) (defaults to: nil)

    The SID of the Service that the resource is associated with.

  • country (String) (defaults to: nil)

    The ISO-3166-1 country code of the country this configuration will be applied to. If this is a global configuration, Country will take the value `all`.


252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
# File 'lib/twilio-ruby/rest/verify/v2/service/messaging_configuration.rb', line 252

def initialize(version, payload, service_sid: nil, country: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'account_sid' => payload['account_sid'],
      'service_sid' => payload['service_sid'],
      'country' => payload['country'],
      'messaging_service_sid' => payload['messaging_service_sid'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'url' => payload['url'],
  }

  # Context
  @instance_context = nil
  @params = {'service_sid' => service_sid, 'country' => country || @properties['country'], }
end

Instance Method Details

#account_sidString

Returns The SID of the Account that created the resource.

Returns:

  • (String)

    The SID of the Account that created the resource


288
289
290
# File 'lib/twilio-ruby/rest/verify/v2/service/messaging_configuration.rb', line 288

def 
  @properties['account_sid']
end

#contextMessagingConfigurationContext

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

Returns:


275
276
277
278
279
280
281
282
283
284
# File 'lib/twilio-ruby/rest/verify/v2/service/messaging_configuration.rb', line 275

def context
  unless @instance_context
    @instance_context = MessagingConfigurationContext.new(
        @version,
        @params['service_sid'],
        @params['country'],
    )
  end
  @instance_context
end

#countryString

Returns The ISO-3166-1 country code of the country or `all`.

Returns:

  • (String)

    The ISO-3166-1 country code of the country or `all`.


300
301
302
# File 'lib/twilio-ruby/rest/verify/v2/service/messaging_configuration.rb', line 300

def country
  @properties['country']
end

#date_createdTime

Returns The RFC 2822 date and time in GMT when the resource was created.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT when the resource was created


312
313
314
# File 'lib/twilio-ruby/rest/verify/v2/service/messaging_configuration.rb', line 312

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The RFC 2822 date and time in GMT when the resource was last updated.

Returns:

  • (Time)

    The RFC 2822 date and time in GMT when the resource was last updated


318
319
320
# File 'lib/twilio-ruby/rest/verify/v2/service/messaging_configuration.rb', line 318

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Delete the MessagingConfigurationInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


348
349
350
# File 'lib/twilio-ruby/rest/verify/v2/service/messaging_configuration.rb', line 348

def delete
  context.delete
end

#fetchMessagingConfigurationInstance

Fetch the MessagingConfigurationInstance

Returns:


341
342
343
# File 'lib/twilio-ruby/rest/verify/v2/service/messaging_configuration.rb', line 341

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation


361
362
363
364
# File 'lib/twilio-ruby/rest/verify/v2/service/messaging_configuration.rb', line 361

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

#messaging_service_sidString

Returns The SID of the Messaging Service used for this configuration.

Returns:

  • (String)

    The SID of the Messaging Service used for this configuration.


306
307
308
# File 'lib/twilio-ruby/rest/verify/v2/service/messaging_configuration.rb', line 306

def messaging_service_sid
  @properties['messaging_service_sid']
end

#service_sidString

Returns The SID of the Service that the resource is associated with.

Returns:

  • (String)

    The SID of the Service that the resource is associated with


294
295
296
# File 'lib/twilio-ruby/rest/verify/v2/service/messaging_configuration.rb', line 294

def service_sid
  @properties['service_sid']
end

#to_sObject

Provide a user friendly representation


354
355
356
357
# File 'lib/twilio-ruby/rest/verify/v2/service/messaging_configuration.rb', line 354

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

#update(messaging_service_sid: nil) ⇒ MessagingConfigurationInstance

Update the MessagingConfigurationInstance

Parameters:

  • messaging_service_sid (String) (defaults to: nil)

    The SID of the Messaging Service to be used to send SMS to the country of this configuration.

Returns:


334
335
336
# File 'lib/twilio-ruby/rest/verify/v2/service/messaging_configuration.rb', line 334

def update(messaging_service_sid: nil)
  context.update(messaging_service_sid: messaging_service_sid, )
end

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.


324
325
326
# File 'lib/twilio-ruby/rest/verify/v2/service/messaging_configuration.rb', line 324

def url
  @properties['url']
end