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

  • account_sid (String)

    The SID of the Account that created this MessagingConfiguration resource.

  • sid (String)

    The SID of the Call resource to fetch.



264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
# File 'lib/twilio-ruby/rest/verify/v2/service/messaging_configuration.rb', line 264

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  || @properties['service_sid']  ,'country' => country  || @properties['country']  , }
end

Instance Method Details

#account_sidString

Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Service resource.

Returns:



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

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:



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

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](en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code of the country this configuration will be applied to. If this is a global configuration, Country will take the value ‘all`.

Returns:

  • (String)

    The [ISO-3166-1](en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code of the country this configuration will be applied to. If this is a global configuration, Country will take the value ‘all`.



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

def country
    @properties['country']
end

#date_createdTime

Returns The date and time in GMT when the resource was created specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



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

def date_created
    @properties['date_created']
end

#date_updatedTime

Returns The date and time in GMT when the resource was last updated specified in [RFC 2822](www.ietf.org/rfc/rfc2822.txt) format.

Returns:



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

def date_updated
    @properties['date_updated']
end

#deleteBoolean

Delete the MessagingConfigurationInstance

Returns:

  • (Boolean)

    True if delete succeeds, false otherwise



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

def delete

    context.delete
end

#fetchMessagingConfigurationInstance

Fetch the MessagingConfigurationInstance

Returns:



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

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



374
375
376
377
# File 'lib/twilio-ruby/rest/verify/v2/service/messaging_configuration.rb', line 374

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](www.twilio.com/docs/messaging/api/service-resource) to be used to send SMS to the country of this configuration.

Returns:



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

def messaging_service_sid
    @properties['messaging_service_sid']
end

#service_sidString

Returns The SID of the [Service](www.twilio.com/docs/verify/api/service) that the resource is associated with.

Returns:



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

def service_sid
    @properties['service_sid']
end

#to_sObject

Provide a user friendly representation



367
368
369
370
# File 'lib/twilio-ruby/rest/verify/v2/service/messaging_configuration.rb', line 367

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:

Returns:



356
357
358
359
360
361
362
363
# File 'lib/twilio-ruby/rest/verify/v2/service/messaging_configuration.rb', line 356

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.



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

def url
    @properties['url']
end