Class: NewStoreApi::ContextV1Dto
- Defined in:
- lib/new_store_api/models/context_v1_dto.rb
Overview
ContextV1Dto Model.
Instance Attribute Summary collapse
-
#associate_created_at ⇒ DateTime
Associate creation timestamp.
-
#associate_id ⇒ String
Associate ID.
-
#associate_name ⇒ String
Associate ID.
-
#cashbox_id ⇒ String
Cashbox ID for which fiscal transaction is executed.
-
#store_id ⇒ String
Store ID where fiscal transaction is executed.
Class Method Summary collapse
-
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
-
.names ⇒ Object
A mapping from model property names to API property names.
-
.nullables ⇒ Object
An array for nullable fields.
-
.optionals ⇒ Object
An array for optional fields.
Instance Method Summary collapse
-
#initialize(associate_id = nil, store_id = nil, associate_created_at = SKIP, associate_name = SKIP, cashbox_id = SKIP) ⇒ ContextV1Dto
constructor
A new instance of ContextV1Dto.
-
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
- #to_custom_associate_created_at ⇒ Object
-
#to_s ⇒ Object
Provides a human-readable string representation of the object.
Methods inherited from BaseModel
#check_for_conflict, #process_additional_properties, #process_array, #process_basic_value, #process_hash, #to_hash, #to_json
Constructor Details
#initialize(associate_id = nil, store_id = nil, associate_created_at = SKIP, associate_name = SKIP, cashbox_id = SKIP) ⇒ ContextV1Dto
Returns a new instance of ContextV1Dto.
59 60 61 62 63 64 65 66 67 |
# File 'lib/new_store_api/models/context_v1_dto.rb', line 59 def initialize(associate_id = nil, store_id = nil, associate_created_at = SKIP, associate_name = SKIP, cashbox_id = SKIP) @associate_created_at = associate_created_at unless associate_created_at == SKIP @associate_id = associate_id @associate_name = associate_name unless associate_name == SKIP @cashbox_id = cashbox_id unless cashbox_id == SKIP @store_id = store_id end |
Instance Attribute Details
#associate_created_at ⇒ DateTime
Associate creation timestamp.
15 16 17 |
# File 'lib/new_store_api/models/context_v1_dto.rb', line 15 def associate_created_at @associate_created_at end |
#associate_id ⇒ String
Associate ID.
19 20 21 |
# File 'lib/new_store_api/models/context_v1_dto.rb', line 19 def associate_id @associate_id end |
#associate_name ⇒ String
Associate ID.
23 24 25 |
# File 'lib/new_store_api/models/context_v1_dto.rb', line 23 def associate_name @associate_name end |
#cashbox_id ⇒ String
Cashbox ID for which fiscal transaction is executed.
- Used in multi-cashbox stores.
28 29 30 |
# File 'lib/new_store_api/models/context_v1_dto.rb', line 28 def cashbox_id @cashbox_id end |
#store_id ⇒ String
Store ID where fiscal transaction is executed.
32 33 34 |
# File 'lib/new_store_api/models/context_v1_dto.rb', line 32 def store_id @store_id end |
Class Method Details
.from_hash(hash) ⇒ Object
Creates an instance of the object from a hash.
70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
# File 'lib/new_store_api/models/context_v1_dto.rb', line 70 def self.from_hash(hash) return nil unless hash # Extract variables from the hash. associate_id = hash.key?('associate_id') ? hash['associate_id'] : nil store_id = hash.key?('store_id') ? hash['store_id'] : nil associate_created_at = if hash.key?('associate_created_at') (DateTimeHelper.from_rfc3339(hash['associate_created_at']) if hash['associate_created_at']) else SKIP end associate_name = hash.key?('associate_name') ? hash['associate_name'] : SKIP cashbox_id = hash.key?('cashbox_id') ? hash['cashbox_id'] : SKIP # Create object from extracted values. ContextV1Dto.new(associate_id, store_id, associate_created_at, associate_name, cashbox_id) end |
.names ⇒ Object
A mapping from model property names to API property names.
35 36 37 38 39 40 41 42 43 |
# File 'lib/new_store_api/models/context_v1_dto.rb', line 35 def self.names @_hash = {} if @_hash.nil? @_hash['associate_created_at'] = 'associate_created_at' @_hash['associate_id'] = 'associate_id' @_hash['associate_name'] = 'associate_name' @_hash['cashbox_id'] = 'cashbox_id' @_hash['store_id'] = 'store_id' @_hash end |
.nullables ⇒ Object
An array for nullable fields
55 56 57 |
# File 'lib/new_store_api/models/context_v1_dto.rb', line 55 def self.nullables [] end |
.optionals ⇒ Object
An array for optional fields
46 47 48 49 50 51 52 |
# File 'lib/new_store_api/models/context_v1_dto.rb', line 46 def self.optionals %w[ associate_created_at associate_name cashbox_id ] end |
Instance Method Details
#inspect ⇒ Object
Provides a debugging-friendly string with detailed object information.
106 107 108 109 110 111 |
# File 'lib/new_store_api/models/context_v1_dto.rb', line 106 def inspect class_name = self.class.name.split('::').last "<#{class_name} associate_created_at: #{@associate_created_at.inspect}, associate_id:"\ " #{@associate_id.inspect}, associate_name: #{@associate_name.inspect}, cashbox_id:"\ " #{@cashbox_id.inspect}, store_id: #{@store_id.inspect}>" end |
#to_custom_associate_created_at ⇒ Object
93 94 95 |
# File 'lib/new_store_api/models/context_v1_dto.rb', line 93 def to_custom_associate_created_at DateTimeHelper.to_rfc3339(associate_created_at) end |
#to_s ⇒ Object
Provides a human-readable string representation of the object.
98 99 100 101 102 103 |
# File 'lib/new_store_api/models/context_v1_dto.rb', line 98 def to_s class_name = self.class.name.split('::').last "<#{class_name} associate_created_at: #{@associate_created_at}, associate_id:"\ " #{@associate_id}, associate_name: #{@associate_name}, cashbox_id: #{@cashbox_id},"\ " store_id: #{@store_id}>" end |