Class: Twilio::REST::IpMessaging::V2::ServiceContext::UserContext::UserBindingInstance

Inherits:
Twilio::REST::InstanceResource show all
Defined in:
lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, service_sid: nil, user_sid: nil, sid: nil) ⇒ UserBindingInstance

Initialize the UserBindingInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • service_sid (String) (defaults to: nil)

    The service_sid

  • user_sid (String) (defaults to: nil)

    The user_sid

  • sid (String) (defaults to: nil)

    The sid


217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb', line 217

def initialize(version, payload, service_sid: nil, user_sid: nil, sid: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'sid' => payload['sid'],
      'account_sid' => payload['account_sid'],
      'service_sid' => payload['service_sid'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'endpoint' => payload['endpoint'],
      'identity' => payload['identity'],
      'user_sid' => payload['user_sid'],
      'credential_sid' => payload['credential_sid'],
      'binding_type' => payload['binding_type'],
      'message_types' => payload['message_types'],
      'url' => payload['url'],
  }

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

Instance Method Details

#account_sidString

Returns The account_sid.

Returns:

  • (String)

    The account_sid


265
266
267
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb', line 265

def 
  @properties['account_sid']
end

#binding_typeuser_binding.BindingType

Returns The binding_type.

Returns:

  • (user_binding.BindingType)

    The binding_type


313
314
315
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb', line 313

def binding_type
  @properties['binding_type']
end

#contextUserBindingContext

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

Returns:


245
246
247
248
249
250
251
252
253
254
255
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb', line 245

def context
  unless @instance_context
    @instance_context = UserBindingContext.new(
        @version,
        @params['service_sid'],
        @params['user_sid'],
        @params['sid'],
    )
  end
  @instance_context
end

#credential_sidString

Returns The credential_sid.

Returns:

  • (String)

    The credential_sid


307
308
309
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb', line 307

def credential_sid
  @properties['credential_sid']
end

#date_createdTime

Returns The date_created.

Returns:

  • (Time)

    The date_created


277
278
279
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb', line 277

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date_updated.

Returns:

  • (Time)

    The date_updated


283
284
285
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb', line 283

def date_updated
  @properties['date_updated']
end

#deleteBoolean

Delete the UserBindingInstance

Returns:

  • (Boolean)

    true if delete succeeds, false otherwise


339
340
341
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb', line 339

def delete
  context.delete
end

#endpointString

Returns The endpoint.

Returns:

  • (String)

    The endpoint


289
290
291
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb', line 289

def endpoint
  @properties['endpoint']
end

#fetchUserBindingInstance

Fetch the UserBindingInstance

Returns:


332
333
334
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb', line 332

def fetch
  context.fetch
end

#identityString

Returns The identity.

Returns:

  • (String)

    The identity


295
296
297
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb', line 295

def identity
  @properties['identity']
end

#inspectObject

Provide a detailed, user friendly representation


352
353
354
355
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb', line 352

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

#message_typesArray[String]

Returns The message_types.

Returns:

  • (Array[String])

    The message_types


319
320
321
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb', line 319

def message_types
  @properties['message_types']
end

#service_sidString

Returns The service_sid.

Returns:

  • (String)

    The service_sid


271
272
273
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb', line 271

def service_sid
  @properties['service_sid']
end

#sidString

Returns The sid.

Returns:

  • (String)

    The sid


259
260
261
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb', line 259

def sid
  @properties['sid']
end

#to_sObject

Provide a user friendly representation


345
346
347
348
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb', line 345

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

#urlString

Returns The url.

Returns:

  • (String)

    The url


325
326
327
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb', line 325

def url
  @properties['url']
end

#user_sidString

Returns The user_sid.

Returns:

  • (String)

    The user_sid


301
302
303
# File 'lib/twilio-ruby/rest/ip_messaging/v2/service/user/user_binding.rb', line 301

def user_sid
  @properties['user_sid']
end