Class: Twilio::REST::Events::V1::SchemaInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Events::V1::SchemaInstance
- Defined in:
- lib/twilio-ruby/rest/events/v1/schema.rb
Instance Method Summary collapse
-
#context ⇒ SchemaContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#fetch ⇒ SchemaInstance
Fetch the SchemaInstance.
-
#id ⇒ String
The unique identifier of the schema.
-
#initialize(version, payload, id: nil) ⇒ SchemaInstance
constructor
Initialize the SchemaInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#latest_version ⇒ String
The latest version published of this schema.
-
#latest_version_date_created ⇒ Time
The date that the latest schema version was created, given in ISO 8601 format.
-
#links ⇒ Hash
Contains a dictionary of URL links to nested resources of this schema.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#url ⇒ String
The URL of this resource.
-
#versions ⇒ versions
Access the versions.
Constructor Details
#initialize(version, payload, id: nil) ⇒ SchemaInstance
Initialize the SchemaInstance
147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 |
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 147 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
#context ⇒ SchemaContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
168 169 170 171 172 173 |
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 168 def context unless @instance_context @instance_context = SchemaContext.new(@version , @params['id']) end @instance_context end |
#fetch ⇒ SchemaInstance
Fetch the SchemaInstance
208 209 210 211 |
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 208 def fetch context.fetch end |
#id ⇒ String
Returns The unique identifier of the schema. Each schema can have multiple versions, that share the same id.
177 178 179 |
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 177 def id @properties['id'] end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
229 230 231 232 |
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 229 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Events.V1.SchemaInstance #{values}>" end |
#latest_version ⇒ String
Returns The latest version published of this schema.
201 202 203 |
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 201 def latest_version @properties['latest_version'] end |
#latest_version_date_created ⇒ Time
Returns The date that the latest schema version was created, given in ISO 8601 format.
195 196 197 |
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 195 def latest_version_date_created @properties['latest_version_date_created'] end |
#links ⇒ Hash
Returns Contains a dictionary of URL links to nested resources of this schema.
189 190 191 |
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 189 def links @properties['links'] end |
#to_s ⇒ Object
Provide a user friendly representation
222 223 224 225 |
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 222 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Events.V1.SchemaInstance #{values}>" end |
#url ⇒ String
Returns The URL of this resource.
183 184 185 |
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 183 def url @properties['url'] end |
#versions ⇒ versions
Access the versions
216 217 218 |
# File 'lib/twilio-ruby/rest/events/v1/schema.rb', line 216 def versions context.versions end |