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

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

Instance Method Summary collapse

Constructor Details

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

Initialize the EventTypeInstance



218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 218

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



241
242
243
244
245
246
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 241

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

#date_createdTime



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

def date_created
    @properties['date_created']
end

#date_updatedTime



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

def date_updated
    @properties['date_updated']
end

#descriptionString



274
275
276
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 274

def description
    @properties['description']
end

#fetchEventTypeInstance

Fetch the EventTypeInstance



293
294
295
296
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 293

def fetch

    context.fetch
end

#inspectObject

Provide a detailed, user friendly representation



307
308
309
310
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 307

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


286
287
288
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 286

def links
    @properties['links']
end

#schema_idString



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

def schema_id
    @properties['schema_id']
end

#to_sObject

Provide a user friendly representation



300
301
302
303
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 300

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

#typeString



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

def type
    @properties['type']
end

#urlString



280
281
282
# File 'lib/twilio-ruby/rest/events/v1/event_type.rb', line 280

def url
    @properties['url']
end