Class: NewStoreApi::AuditReadOnly

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

Overview

AuditReadOnly 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(created_at = nil, events = nil, id = nil, request_id = nil, search_key = nil, tenant = nil, version = SKIP) ⇒ AuditReadOnly

Returns a new instance of AuditReadOnly.



69
70
71
72
73
74
75
76
77
78
# File 'lib/new_store_api/models/audit_read_only.rb', line 69

def initialize(created_at = nil, events = nil, id = nil, request_id = nil,
               search_key = nil, tenant = nil, version = SKIP)
  @created_at = created_at
  @events = events
  @id = id
  @request_id = request_id
  @search_key = search_key
  @tenant = tenant
  @version = version unless version == SKIP
end

Instance Attribute Details

#created_atDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


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

def created_at
  @created_at
end

#eventsArray[AuditEventReadOnly]

TODO: Write general description for this method

Returns:



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

def events
  @events
end

#idString

TODO: Write general description for this method

Returns:

  • (String)


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

def id
  @id
end

#request_idString

TODO: Write general description for this method

Returns:

  • (String)


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

def request_id
  @request_id
end

#search_keyString

TODO: Write general description for this method

Returns:

  • (String)


31
32
33
# File 'lib/new_store_api/models/audit_read_only.rb', line 31

def search_key
  @search_key
end

#tenantString

TODO: Write general description for this method

Returns:

  • (String)


35
36
37
# File 'lib/new_store_api/models/audit_read_only.rb', line 35

def tenant
  @tenant
end

#versionInteger

do NOT use this field in any way

Returns:

  • (Integer)


39
40
41
# File 'lib/new_store_api/models/audit_read_only.rb', line 39

def version
  @version
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
# File 'lib/new_store_api/models/audit_read_only.rb', line 81

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  created_at = if hash.key?('created_at')
                 (DateTimeHelper.from_rfc3339(hash['created_at']) if hash['created_at'])
               end
  # Parameter is an array, so we need to iterate through it
  events = nil
  unless hash['events'].nil?
    events = []
    hash['events'].each do |structure|
      events << (AuditEventReadOnly.from_hash(structure) if structure)
    end
  end

  events = nil unless hash.key?('events')
  id = hash.key?('id') ? hash['id'] : nil
  request_id = hash.key?('request_id') ? hash['request_id'] : nil
  search_key = hash.key?('search_key') ? hash['search_key'] : nil
  tenant = hash.key?('tenant') ? hash['tenant'] : nil
  version = hash.key?('version') ? hash['version'] : SKIP

  # Create object from extracted values.
  AuditReadOnly.new(created_at,
                    events,
                    id,
                    request_id,
                    search_key,
                    tenant,
                    version)
end

.namesObject

A mapping from model property names to API property names.



42
43
44
45
46
47
48
49
50
51
52
# File 'lib/new_store_api/models/audit_read_only.rb', line 42

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['created_at'] = 'created_at'
  @_hash['events'] = 'events'
  @_hash['id'] = 'id'
  @_hash['request_id'] = 'request_id'
  @_hash['search_key'] = 'search_key'
  @_hash['tenant'] = 'tenant'
  @_hash['version'] = 'version'
  @_hash
end

.nullablesObject

An array for nullable fields



62
63
64
65
66
67
# File 'lib/new_store_api/models/audit_read_only.rb', line 62

def self.nullables
  %w[
    search_key
    version
  ]
end

.optionalsObject

An array for optional fields



55
56
57
58
59
# File 'lib/new_store_api/models/audit_read_only.rb', line 55

def self.optionals
  %w[
    version
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



126
127
128
129
130
131
# File 'lib/new_store_api/models/audit_read_only.rb', line 126

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} created_at: #{@created_at.inspect}, events: #{@events.inspect}, id:"\
  " #{@id.inspect}, request_id: #{@request_id.inspect}, search_key: #{@search_key.inspect},"\
  " tenant: #{@tenant.inspect}, version: #{@version.inspect}>"
end

#to_custom_created_atObject



114
115
116
# File 'lib/new_store_api/models/audit_read_only.rb', line 114

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_sObject

Provides a human-readable string representation of the object.



119
120
121
122
123
# File 'lib/new_store_api/models/audit_read_only.rb', line 119

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} created_at: #{@created_at}, events: #{@events}, id: #{@id}, request_id:"\
  " #{@request_id}, search_key: #{@search_key}, tenant: #{@tenant}, version: #{@version}>"
end