Class: Twilio::REST::Events::V1::SchemaContext::SchemaVersionInstance

Inherits:
InstanceResource
  • Object
show all
Defined in:
lib/twilio-ruby/rest/events/v1/schema/version.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, id: nil, schema_version: nil) ⇒ SchemaVersionInstance

Initialize the SchemaVersionInstance

Parameters:

  • version (Version)

    Version that contains the resource

  • payload (Hash)

    payload that contains response from Twilio

  • id (String) (defaults to: nil)

    The unique identifier of the schema. Each schema can have multiple versions, that share the same id.

  • schema_version (String) (defaults to: nil)

    The version of the schema


207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
# File 'lib/twilio-ruby/rest/events/v1/schema/version.rb', line 207

def initialize(version, payload, id: nil, schema_version: nil)
  super(version)

  # Marshaled Properties
  @properties = {
      'id' => payload['id'],
      'schema_version' => payload['schema_version'].to_i,
      'date_created' => Twilio.deserialize_iso8601_datetime(payload['date_created']),
      'url' => payload['url'],
      'raw' => payload['raw'],
  }

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

Instance Method Details

#contextSchemaVersionContext

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

Returns:


228
229
230
231
232
233
# File 'lib/twilio-ruby/rest/events/v1/schema/version.rb', line 228

def context
  unless @instance_context
    @instance_context = SchemaVersionContext.new(@version, @params['id'], @params['schema_version'], )
  end
  @instance_context
end

#date_createdTime

Returns The date the schema version was created.

Returns:

  • (Time)

    The date the schema version was created.


249
250
251
# File 'lib/twilio-ruby/rest/events/v1/schema/version.rb', line 249

def date_created
  @properties['date_created']
end

#fetchSchemaVersionInstance

Fetch the SchemaVersionInstance

Returns:


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

def fetch
  context.fetch
end

#idString

Returns The unique identifier of the schema.

Returns:

  • (String)

    The unique identifier of the schema.


237
238
239
# File 'lib/twilio-ruby/rest/events/v1/schema/version.rb', line 237

def id
  @properties['id']
end

#inspectObject

Provide a detailed, user friendly representation


281
282
283
284
# File 'lib/twilio-ruby/rest/events/v1/schema/version.rb', line 281

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

#rawString

Returns The raw.

Returns:

  • (String)

    The raw


261
262
263
# File 'lib/twilio-ruby/rest/events/v1/schema/version.rb', line 261

def raw
  @properties['raw']
end

#schema_versionString

Returns The version of this schema.

Returns:

  • (String)

    The version of this schema.


243
244
245
# File 'lib/twilio-ruby/rest/events/v1/schema/version.rb', line 243

def schema_version
  @properties['schema_version']
end

#to_sObject

Provide a user friendly representation


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

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

#urlString

Returns The URL of this resource.

Returns:

  • (String)

    The URL of this resource.


255
256
257
# File 'lib/twilio-ruby/rest/events/v1/schema/version.rb', line 255

def url
  @properties['url']
end