Class: NewStoreApi::ImportSchemaGet

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

Overview

ImportSchemaGet 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) ⇒ ImportSchemaGet

Returns a new instance of ImportSchemaGet.



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

def initialize(id = nil, last_updated_at = nil)
  @entity = 'PRODUCTS'
  @id = id
  @last_updated_at = last_updated_at
end

Instance Attribute Details

#entityString (readonly)

TODO: Write general description for this method

Returns:

  • (String)


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

def entity
  @entity
end

#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)


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

def id
  @id
end

#last_updated_atDateTime

Timestamp in RFC3339 format.

Returns:

  • (DateTime)


24
25
26
# File 'lib/new_store_api/models/import_schema_get.rb', line 24

def last_updated_at
  @last_updated_at
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



52
53
54
55
56
57
58
59
60
61
62
63
64
# File 'lib/new_store_api/models/import_schema_get.rb', line 52

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.
  ImportSchemaGet.new(id,
                      last_updated_at)
end

.namesObject

A mapping from model property names to API property names.



27
28
29
30
31
32
33
# File 'lib/new_store_api/models/import_schema_get.rb', line 27

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

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



77
78
79
80
81
# File 'lib/new_store_api/models/import_schema_get.rb', line 77

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

#to_custom_last_updated_atObject



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

def to_custom_last_updated_at
  DateTimeHelper.to_rfc3339(last_updated_at)
end

#to_sObject

Provides a human-readable string representation of the object.



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

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