Class: NewStoreApi::ShortingModel

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

Overview

ShortingModel 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, created_by = nil, created_by_name = nil, product_id = nil, reason = nil, store_id = nil, tenant = nil, type = nil, wave_id = nil) ⇒ ShortingModel

Returns a new instance of ShortingModel.



74
75
76
77
78
79
80
81
82
83
84
85
86
# File 'lib/new_store_api/models/shorting_model.rb', line 74

def initialize(created_at = nil, created_by = nil, created_by_name = nil,
               product_id = nil, reason = nil, store_id = nil, tenant = nil,
               type = nil, wave_id = nil)
  @created_at = created_at
  @created_by = created_by
  @created_by_name = created_by_name
  @product_id = product_id
  @reason = reason
  @store_id = store_id
  @tenant = tenant
  @type = type
  @wave_id = wave_id
end

Instance Attribute Details

#created_atDateTime

TODO: Write general description for this method

Returns:

  • (DateTime)


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

def created_at
  @created_at
end

#created_byString

TODO: Write general description for this method

Returns:

  • (String)


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

def created_by
  @created_by
end

#created_by_nameString

TODO: Write general description for this method

Returns:

  • (String)


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

def created_by_name
  @created_by_name
end

#product_idString

TODO: Write general description for this method

Returns:

  • (String)


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

def product_id
  @product_id
end

#reasonString

TODO: Write general description for this method

Returns:

  • (String)


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

def reason
  @reason
end

#store_idString

TODO: Write general description for this method

Returns:

  • (String)


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

def store_id
  @store_id
end

#tenantString

TODO: Write general description for this method

Returns:

  • (String)


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

def tenant
  @tenant
end

#typeShortingTypeEnum

TODO: Write general description for this method

Returns:



43
44
45
# File 'lib/new_store_api/models/shorting_model.rb', line 43

def type
  @type
end

#wave_idString

TODO: Write general description for this method

Returns:

  • (String)


47
48
49
# File 'lib/new_store_api/models/shorting_model.rb', line 47

def wave_id
  @wave_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# File 'lib/new_store_api/models/shorting_model.rb', line 89

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
  created_by = hash.key?('created_by') ? hash['created_by'] : nil
  created_by_name =
    hash.key?('created_by_name') ? hash['created_by_name'] : nil
  product_id = hash.key?('product_id') ? hash['product_id'] : nil
  reason = hash.key?('reason') ? hash['reason'] : nil
  store_id = hash.key?('store_id') ? hash['store_id'] : nil
  tenant = hash.key?('tenant') ? hash['tenant'] : nil
  type = hash.key?('type') ? hash['type'] : nil
  wave_id = hash.key?('wave_id') ? hash['wave_id'] : nil

  # Create object from extracted values.
  ShortingModel.new(created_at,
                    created_by,
                    created_by_name,
                    product_id,
                    reason,
                    store_id,
                    tenant,
                    type,
                    wave_id)
end

.namesObject

A mapping from model property names to API property names.



50
51
52
53
54
55
56
57
58
59
60
61
62
# File 'lib/new_store_api/models/shorting_model.rb', line 50

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['created_at'] = 'created_at'
  @_hash['created_by'] = 'created_by'
  @_hash['created_by_name'] = 'created_by_name'
  @_hash['product_id'] = 'product_id'
  @_hash['reason'] = 'reason'
  @_hash['store_id'] = 'store_id'
  @_hash['tenant'] = 'tenant'
  @_hash['type'] = 'type'
  @_hash['wave_id'] = 'wave_id'
  @_hash
end

.nullablesObject

An array for nullable fields



70
71
72
# File 'lib/new_store_api/models/shorting_model.rb', line 70

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



131
132
133
134
135
136
137
# File 'lib/new_store_api/models/shorting_model.rb', line 131

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} created_at: #{@created_at.inspect}, created_by: #{@created_by.inspect},"\
  " created_by_name: #{@created_by_name.inspect}, product_id: #{@product_id.inspect}, reason:"\
  " #{@reason.inspect}, store_id: #{@store_id.inspect}, tenant: #{@tenant.inspect}, type:"\
  " #{@type.inspect}, wave_id: #{@wave_id.inspect}>"
end

#to_custom_created_atObject



118
119
120
# File 'lib/new_store_api/models/shorting_model.rb', line 118

def to_custom_created_at
  DateTimeHelper.to_rfc3339(created_at)
end

#to_sObject

Provides a human-readable string representation of the object.



123
124
125
126
127
128
# File 'lib/new_store_api/models/shorting_model.rb', line 123

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} created_at: #{@created_at}, created_by: #{@created_by}, created_by_name:"\
  " #{@created_by_name}, product_id: #{@product_id}, reason: #{@reason}, store_id:"\
  " #{@store_id}, tenant: #{@tenant}, type: #{@type}, wave_id: #{@wave_id}>"
end