Class: NewStoreApi::AuditEventReadOnly

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/new_store_api/models/audit_event_read_only.rb

Overview

AuditEventReadOnly Model.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from BaseModel

#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json

Constructor Details

#initialize(happened_at = nil, key = nil, originator = nil, value = nil) ⇒ AuditEventReadOnly

Returns a new instance of AuditEventReadOnly.



51
52
53
54
55
56
# File 'lib/new_store_api/models/audit_event_read_only.rb', line 51

def initialize(happened_at = nil, key = nil, originator = nil, value = nil)
  @happened_at = happened_at
  @key = key
  @originator = originator
  @value = value
end

Instance Attribute Details

#happened_atDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


15
16
17
# File 'lib/new_store_api/models/audit_event_read_only.rb', line 15

def happened_at
  @happened_at
end

#keyString

TODO: Write general description for this method

Returns:

  • (String)


19
20
21
# File 'lib/new_store_api/models/audit_event_read_only.rb', line 19

def key
  @key
end

#originatorString

TODO: Write general description for this method

Returns:

  • (String)


23
24
25
# File 'lib/new_store_api/models/audit_event_read_only.rb', line 23

def originator
  @originator
end

#valueObject

TODO: Write general description for this method

Returns:

  • (Object)


27
28
29
# File 'lib/new_store_api/models/audit_event_read_only.rb', line 27

def value
  @value
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
# File 'lib/new_store_api/models/audit_event_read_only.rb', line 59

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  happened_at = if hash.key?('happened_at')
                  (DateTimeHelper.from_rfc3339(hash['happened_at']) if hash['happened_at'])
                end
  key = hash.key?('key') ? hash['key'] : nil
  originator = hash.key?('originator') ? hash['originator'] : nil
  value = hash.key?('value') ? hash['value'] : nil

  # Create object from extracted values.
  AuditEventReadOnly.new(happened_at,
                         key,
                         originator,
                         value)
end

.namesObject

A mapping from model property names to API property names.



30
31
32
33
34
35
36
37
# File 'lib/new_store_api/models/audit_event_read_only.rb', line 30

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['happened_at'] = 'happened_at'
  @_hash['key'] = 'key'
  @_hash['originator'] = 'originator'
  @_hash['value'] = 'value'
  @_hash
end

.nullablesObject

An array for nullable fields



45
46
47
48
49
# File 'lib/new_store_api/models/audit_event_read_only.rb', line 45

def self.nullables
  %w[
    originator
  ]
end

.optionalsObject

An array for optional fields



40
41
42
# File 'lib/new_store_api/models/audit_event_read_only.rb', line 40

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



89
90
91
92
93
# File 'lib/new_store_api/models/audit_event_read_only.rb', line 89

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} happened_at: #{@happened_at.inspect}, key: #{@key.inspect}, originator:"\
  " #{@originator.inspect}, value: #{@value.inspect}>"
end

#to_custom_happened_atObject



77
78
79
# File 'lib/new_store_api/models/audit_event_read_only.rb', line 77

def to_custom_happened_at
  DateTimeHelper.to_rfc3339(happened_at)
end

#to_sObject

Provides a human-readable string representation of the object.



82
83
84
85
86
# File 'lib/new_store_api/models/audit_event_read_only.rb', line 82

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} happened_at: #{@happened_at}, key: #{@key}, originator: #{@originator},"\
  " value: #{@value}>"
end