Class: Twilio::REST::Events::V1::EventTypeInstance

Inherits:
InstanceResource show all
Defined in:
lib/twilio-ruby/rest/events/v1/event_type.rb

Overview

PLEASE NOTE that this class contains beta products that are subject to change. Use them with caution.

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, type: nil) ⇒ EventTypeInstance

Initialize the EventTypeInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • type (String) (defaults to: nil)

    A string that uniquely identifies this Event Type.



195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 195

def initialize(version, payload, type: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'type' => payload['type'],
      'schema_id' => payload['schema_id'],
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'date_updated' => Twilio.deserialize_iso8601_datetime(payload['date_updated']),
      'description' => payload['description'],
      'url' => payload['url'],
      'links' => payload['links'],
  }

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

Instance Method Details

#contextEventTypeContext

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

Returns:



218
219
220
221
222
223
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 218

def context
  unless @instance_context
    @instance_context = EventTypeContext.new(@version, @params['type'], )
  end
  @instance_context
end

#date_createdTime

Returns The date this Event Type was created.

Returns:

  • (Time)

    The date this Event Type was created.



239
240
241
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 239

def date_created
  @properties['date_created']
end

#date_updatedTime

Returns The date this Event Type was updated.

Returns:

  • (Time)

    The date this Event Type was updated.



245
246
247
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 245

def date_updated
  @properties['date_updated']
end

#descriptionString

Returns Event Type description.

Returns:

  • (String)

    Event Type description.



251
252
253
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 251

def description
  @properties['description']
end

#fetchEventTypeInstance

Fetch the EventTypeInstance

Returns:



270
271
272
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 270

def fetch
  context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



283
284
285
286
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 283

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

Returns The links.

Returns:

  • (String)

    The links



263
264
265
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 263

def links
  @properties['links']
end

#schema_idString

Returns The Schema identifier for this Event Type.

Returns:

  • (String)

    The Schema identifier for this Event Type.



233
234
235
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 233

def schema_id
  @properties['schema_id']
end

#to_sObject

Provide a user friendly representation



276
277
278
279
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 276

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

#typeString

Returns The Event Type identifier.

Returns:

  • (String)

    The Event Type identifier.



227
228
229
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 227

def type
  @properties['type']
end

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.



257
258
259
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 257

def url
  @properties['url']
end