Class: Twilio::REST::Monitor::V1::EventInstance
- Inherits:
-
InstanceResource
- Object
- InstanceResource
- Twilio::REST::Monitor::V1::EventInstance
- Defined in:
- lib/twilio-ruby/rest/monitor/v1/event.rb
Instance Method Summary collapse
-
#account_sid ⇒ String
The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Event resource.
-
#actor_sid ⇒ String
The SID of the actor that caused the event, if available.
-
#actor_type ⇒ String
The type of actor that caused the event.
-
#context ⇒ EventContext
Generate an instance context for the instance, the context is capable of performing various actions.
-
#description ⇒ String
A description of the event.
-
#event_data ⇒ Hash
An object with additional data about the event.
-
#event_date ⇒ Time
The date and time in GMT when the event was recorded specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.
-
#event_type ⇒ String
The event’s type.
-
#fetch ⇒ EventInstance
Fetch the EventInstance.
-
#initialize(version, payload, sid: nil) ⇒ EventInstance
constructor
Initialize the EventInstance.
-
#inspect ⇒ Object
Provide a detailed, user friendly representation.
-
#links ⇒ Hash
The absolute URLs of related resources.
-
#resource_sid ⇒ String
The SID of the resource that was affected.
-
#resource_type ⇒ String
The type of resource that was affected.
-
#sid ⇒ String
The unique string that we created to identify the Event resource.
-
#source ⇒ String
The originating system or interface that caused the event.
-
#source_ip_address ⇒ String
The IP address of the source, if the source is outside the Twilio cloud.
-
#to_s ⇒ Object
Provide a user friendly representation.
-
#url ⇒ String
The absolute URL of the resource that was affected.
Constructor Details
#initialize(version, payload, sid: nil) ⇒ EventInstance
Initialize the EventInstance
244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 |
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 244 def initialize(version, payload , sid: nil) super(version) # Marshaled Properties @properties = { 'account_sid' => payload['account_sid'], 'actor_sid' => payload['actor_sid'], 'actor_type' => payload['actor_type'], 'description' => payload['description'], 'event_data' => payload['event_data'], 'event_date' => Twilio.deserialize_iso8601_datetime(payload['event_date']), 'event_type' => payload['event_type'], 'resource_sid' => payload['resource_sid'], 'resource_type' => payload['resource_type'], 'sid' => payload['sid'], 'source' => payload['source'], 'source_ip_address' => payload['source_ip_address'], 'url' => payload['url'], 'links' => payload['links'], } # Context @instance_context = nil @params = { 'sid' => sid || @properties['sid'] , } end |
Instance Method Details
#account_sid ⇒ String
Returns The SID of the [Account](www.twilio.com/docs/iam/api/account) that created the Event resource.
283 284 285 |
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 283 def account_sid @properties['account_sid'] end |
#actor_sid ⇒ String
Returns The SID of the actor that caused the event, if available. Can be ‘null`.
289 290 291 |
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 289 def actor_sid @properties['actor_sid'] end |
#actor_type ⇒ String
Returns The type of actor that caused the event. Can be: ‘user` for a change made by a logged-in user in the Twilio Console, `account` for an event caused by an API request by an authenticating Account, `twilio-admin` for an event caused by a Twilio employee, and so on.
295 296 297 |
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 295 def actor_type @properties['actor_type'] end |
#context ⇒ EventContext
Generate an instance context for the instance, the context is capable of performing various actions. All instance actions are proxied to the context
274 275 276 277 278 279 |
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 274 def context unless @instance_context @instance_context = EventContext.new(@version , @params['sid']) end @instance_context end |
#description ⇒ String
Returns A description of the event. Can be ‘null`.
301 302 303 |
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 301 def description @properties['description'] end |
#event_data ⇒ Hash
Returns An object with additional data about the event. The contents depend on ‘event_type`. For example, event-types of the form `RESOURCE.updated`, this value contains a `resource_properties` dictionary that describes the previous and updated properties of the resource.
307 308 309 |
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 307 def event_data @properties['event_data'] end |
#event_date ⇒ Time
Returns The date and time in GMT when the event was recorded specified in [ISO 8601](en.wikipedia.org/wiki/ISO_8601) format.
313 314 315 |
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 313 def event_date @properties['event_date'] end |
#event_type ⇒ String
Returns The event’s type. Event-types are typically in the form: ‘RESOURCE_TYPE.ACTION`, where `RESOURCE_TYPE` is the type of resource that was affected and `ACTION` is what happened to it. For example, `phone-number.created`. For a full list of all event-types, see the [Monitor Event Types](www.twilio.com/docs/usage/monitor-events#event-types).
319 320 321 |
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 319 def event_type @properties['event_type'] end |
#fetch ⇒ EventInstance
Fetch the EventInstance
368 369 370 371 |
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 368 def fetch context.fetch end |
#inspect ⇒ Object
Provide a detailed, user friendly representation
382 383 384 385 |
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 382 def inspect values = @properties.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Monitor.V1.EventInstance #{values}>" end |
#links ⇒ Hash
Returns The absolute URLs of related resources.
361 362 363 |
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 361 def links @properties['links'] end |
#resource_sid ⇒ String
Returns The SID of the resource that was affected.
325 326 327 |
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 325 def resource_sid @properties['resource_sid'] end |
#resource_type ⇒ String
Returns The type of resource that was affected. For a full list of all resource-types, see the [Monitor Event Types](www.twilio.com/docs/usage/monitor-events#event-types).
331 332 333 |
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 331 def resource_type @properties['resource_type'] end |
#sid ⇒ String
Returns The unique string that we created to identify the Event resource.
337 338 339 |
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 337 def sid @properties['sid'] end |
#source ⇒ String
Returns The originating system or interface that caused the event. Can be: ‘web` for events caused by user action in the Twilio Console, `api` for events caused by a request to our API, or `twilio` for events caused by an automated or internal Twilio system.
343 344 345 |
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 343 def source @properties['source'] end |
#source_ip_address ⇒ String
Returns The IP address of the source, if the source is outside the Twilio cloud. This value is ‘null` for events with `source` of `twilio`.
349 350 351 |
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 349 def source_ip_address @properties['source_ip_address'] end |
#to_s ⇒ Object
Provide a user friendly representation
375 376 377 378 |
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 375 def to_s values = @params.map{|k, v| "#{k}: #{v}"}.join(" ") "<Twilio.Monitor.V1.EventInstance #{values}>" end |
#url ⇒ String
Returns The absolute URL of the resource that was affected. Can be ‘null`.
355 356 357 |
# File 'lib/twilio-ruby/rest/monitor/v1/event.rb', line 355 def url @properties['url'] end |