Class: NewStoreApi::ImportSchemaCreated

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

Overview

ImportSchemaCreated 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(id = nil, last_updated_at = nil) ⇒ ImportSchemaCreated

Returns a new instance of ImportSchemaCreated.



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

def initialize(id = nil, last_updated_at = nil)
  @id = id
  @last_updated_at = last_updated_at
end

Instance Attribute Details

#idString

ID of the import schema. It must be unique per tenant and contain only ASCII characters. F.e UUID4, human readable name without spaces

Returns:

  • (String)


16
17
18
# File 'lib/new_store_api/models/import_schema_created.rb', line 16

def id
  @id
end

#last_updated_atDateTime

Timestamp in RFC3339 format.

Returns:

  • (DateTime)


20
21
22
# File 'lib/new_store_api/models/import_schema_created.rb', line 20

def last_updated_at
  @last_updated_at
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



46
47
48
49
50
51
52
53
54
55
56
57
58
# File 'lib/new_store_api/models/import_schema_created.rb', line 46

def self.from_hash(hash)
  return nil unless hash

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

  # Create object from extracted values.
  ImportSchemaCreated.new(id,
                          last_updated_at)
end

.namesObject

A mapping from model property names to API property names.



23
24
25
26
27
28
# File 'lib/new_store_api/models/import_schema_created.rb', line 23

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['id'] = 'id'
  @_hash['last_updated_at'] = 'last_updated_at'
  @_hash
end

.nullablesObject

An array for nullable fields



36
37
38
# File 'lib/new_store_api/models/import_schema_created.rb', line 36

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



71
72
73
74
# File 'lib/new_store_api/models/import_schema_created.rb', line 71

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id.inspect}, last_updated_at: #{@last_updated_at.inspect}>"
end

#to_custom_last_updated_atObject



60
61
62
# File 'lib/new_store_api/models/import_schema_created.rb', line 60

def to_custom_last_updated_at
  DateTimeHelper.to_rfc3339(last_updated_at)
end

#to_sObject

Provides a human-readable string representation of the object.



65
66
67
68
# File 'lib/new_store_api/models/import_schema_created.rb', line 65

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} id: #{@id}, last_updated_at: #{@last_updated_at}>"
end