Class: SmplkitGeneratedClient::Audit::Event
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- SmplkitGeneratedClient::Audit::Event
- Defined in:
- lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb
Overview
Public-facing event resource. Attribute set on POST /api/v1/events: - action (required) - resource_type (required) - resource_id (required) - occurred_at (optional; defaults to “created_at“) - snapshot (optional) - data (optional; defaults to “{}“) Attribute set on GET responses includes everything above plus the server-populated fields: “created_at“, “actor_type“, “actor_id“, “actor_label“, “idempotency_key“.
Instance Attribute Summary collapse
-
#action ⇒ Object
Returns the value of attribute action.
-
#actor_id ⇒ Object
Returns the value of attribute actor_id.
-
#actor_label ⇒ Object
Returns the value of attribute actor_label.
-
#actor_type ⇒ Object
Returns the value of attribute actor_type.
-
#created_at ⇒ Object
Returns the value of attribute created_at.
-
#data ⇒ Object
Returns the value of attribute data.
-
#idempotency_key ⇒ Object
Returns the value of attribute idempotency_key.
-
#occurred_at ⇒ Object
Returns the value of attribute occurred_at.
-
#resource_id ⇒ Object
Returns the value of attribute resource_id.
-
#resource_type ⇒ Object
Returns the value of attribute resource_type.
-
#snapshot ⇒ Object
Returns the value of attribute snapshot.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Event
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ Event
Initializes the object
100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 100 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `SmplkitGeneratedClient::Audit::Event` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `SmplkitGeneratedClient::Audit::Event`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'action') self.action = attributes[:'action'] else self.action = nil end if attributes.key?(:'resource_type') self.resource_type = attributes[:'resource_type'] else self.resource_type = nil end if attributes.key?(:'resource_id') self.resource_id = attributes[:'resource_id'] else self.resource_id = nil end if attributes.key?(:'occurred_at') self.occurred_at = attributes[:'occurred_at'] end if attributes.key?(:'snapshot') if (value = attributes[:'snapshot']).is_a?(Hash) self.snapshot = value end end if attributes.key?(:'data') if (value = attributes[:'data']).is_a?(Hash) self.data = value end end if attributes.key?(:'created_at') self.created_at = attributes[:'created_at'] end if attributes.key?(:'actor_type') self.actor_type = attributes[:'actor_type'] end if attributes.key?(:'actor_id') self.actor_id = attributes[:'actor_id'] end if attributes.key?(:'actor_label') self.actor_label = attributes[:'actor_label'] end if attributes.key?(:'idempotency_key') self.idempotency_key = attributes[:'idempotency_key'] end end |
Instance Attribute Details
#action ⇒ Object
Returns the value of attribute action.
19 20 21 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 19 def action @action end |
#actor_id ⇒ Object
Returns the value of attribute actor_id.
35 36 37 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 35 def actor_id @actor_id end |
#actor_label ⇒ Object
Returns the value of attribute actor_label.
37 38 39 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 37 def actor_label @actor_label end |
#actor_type ⇒ Object
Returns the value of attribute actor_type.
33 34 35 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 33 def actor_type @actor_type end |
#created_at ⇒ Object
Returns the value of attribute created_at.
31 32 33 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 31 def created_at @created_at end |
#data ⇒ Object
Returns the value of attribute data.
29 30 31 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 29 def data @data end |
#idempotency_key ⇒ Object
Returns the value of attribute idempotency_key.
39 40 41 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 39 def idempotency_key @idempotency_key end |
#occurred_at ⇒ Object
Returns the value of attribute occurred_at.
25 26 27 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 25 def occurred_at @occurred_at end |
#resource_id ⇒ Object
Returns the value of attribute resource_id.
23 24 25 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 23 def resource_id @resource_id end |
#resource_type ⇒ Object
Returns the value of attribute resource_type.
21 22 23 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 21 def resource_type @resource_type end |
#snapshot ⇒ Object
Returns the value of attribute snapshot.
27 28 29 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 27 def snapshot @snapshot end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
59 60 61 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 59 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
64 65 66 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 64 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 42 def self.attribute_map { :'action' => :'action', :'resource_type' => :'resource_type', :'resource_id' => :'resource_id', :'occurred_at' => :'occurred_at', :'snapshot' => :'snapshot', :'data' => :'data', :'created_at' => :'created_at', :'actor_type' => :'actor_type', :'actor_id' => :'actor_id', :'actor_label' => :'actor_label', :'idempotency_key' => :'idempotency_key' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 289 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
86 87 88 89 90 91 92 93 94 95 96 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 86 def self.openapi_nullable Set.new([ :'occurred_at', :'snapshot', :'created_at', :'actor_type', :'actor_id', :'actor_label', :'idempotency_key' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 69 def self.openapi_types { :'action' => :'String', :'resource_type' => :'String', :'resource_id' => :'String', :'occurred_at' => :'Time', :'snapshot' => :'Hash<String, Object>', :'data' => :'Hash<String, Object>', :'created_at' => :'Time', :'actor_type' => :'String', :'actor_id' => :'String', :'actor_label' => :'String', :'idempotency_key' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 258 def ==(o) return true if self.equal?(o) self.class == o.class && action == o.action && resource_type == o.resource_type && resource_id == o.resource_id && occurred_at == o.occurred_at && snapshot == o.snapshot && data == o.data && created_at == o.created_at && actor_type == o.actor_type && actor_id == o.actor_id && actor_label == o.actor_label && idempotency_key == o.idempotency_key end |
#eql?(o) ⇒ Boolean
276 277 278 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 276 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
282 283 284 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 282 def hash [action, resource_type, resource_id, occurred_at, snapshot, data, created_at, actor_type, actor_id, actor_label, idempotency_key].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 171 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new if @action.nil? invalid_properties.push('invalid value for "action", action cannot be nil.') end if @action.to_s.length < 1 invalid_properties.push('invalid value for "action", the character length must be greater than or equal to 1.') end if @resource_type.nil? invalid_properties.push('invalid value for "resource_type", resource_type cannot be nil.') end if @resource_type.to_s.length < 1 invalid_properties.push('invalid value for "resource_type", the character length must be greater than or equal to 1.') end if @resource_id.nil? invalid_properties.push('invalid value for "resource_id", resource_id cannot be nil.') end if @resource_id.to_s.length < 1 invalid_properties.push('invalid value for "resource_id", the character length must be greater than or equal to 1.') end invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
311 312 313 314 315 316 317 318 319 320 321 322 323 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 311 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
203 204 205 206 207 208 209 210 211 212 |
# File 'lib/smplkit/_generated/audit/lib/smplkit_audit_client/models/event.rb', line 203 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' return false if @action.nil? return false if @action.to_s.length < 1 return false if @resource_type.nil? return false if @resource_type.to_s.length < 1 return false if @resource_id.nil? return false if @resource_id.to_s.length < 1 true end |