Class: Twilio::REST::Events::V1::SchemaInstance

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

Instance Method Summary collapse

Constructor Details

#initialize(version, payload, id: nil) ⇒ SchemaInstance

Initialize the SchemaInstance



146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 146

def initialize(version, payload , id: nil)
    super(version)
    
    # Marshaled Properties
    @properties = { 
        'id' => payload['id'],
        'url' => payload['url'],
        'links' => payload['links'],
        'latest_version_date_created' => Twilio.deserialize_iso8601_datetime(payload['latest_version_date_created']),
        'latest_version' => payload['latest_version'] == nil ? payload['latest_version'] : payload['latest_version'].to_i,
    }

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

Instance Method Details

#contextSchemaContext

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



167
168
169
170
171
172
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 167

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

#fetchSchemaInstance

Fetch the SchemaInstance



207
208
209
210
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 207

def fetch

    context.fetch
end

#idString



176
177
178
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 176

def id
    @properties['id']
end

#inspectObject

Provide a detailed, user friendly representation



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

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

#latest_versionString



200
201
202
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 200

def latest_version
    @properties['latest_version']
end

#latest_version_date_createdTime



194
195
196
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 194

def latest_version_date_created
    @properties['latest_version_date_created']
end


188
189
190
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 188

def links
    @properties['links']
end

#to_sObject

Provide a user friendly representation



221
222
223
224
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 221

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

#urlString



182
183
184
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 182

def url
    @properties['url']
end

#versionsversions

Access the versions



215
216
217
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 215

def versions
    context.versions
end