Class: NewStoreApi::TransactionUpdateDto

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

Overview

TransactionUpdateDto 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(order_id = nil) ⇒ TransactionUpdateDto

Returns a new instance of TransactionUpdateDto.



37
38
39
# File 'lib/new_store_api/models/transaction_update_dto.rb', line 37

def initialize(order_id = nil)
  @order_id = order_id
end

Instance Attribute Details

#order_idString

The order ID that will be used as a reference to link the order to the created tax transaction in the tax provider records.

  • In case the order ID is not provided then a randomly generated identifier will be used instead.
  • The tax transaction will be stored by using the given value.

Returns:

  • (String)


18
19
20
# File 'lib/new_store_api/models/transaction_update_dto.rb', line 18

def order_id
  @order_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  order_id = hash.key?('order_id') ? hash['order_id'] : nil

  # Create object from extracted values.
  TransactionUpdateDto.new(order_id)
end

.namesObject

A mapping from model property names to API property names.



21
22
23
24
25
# File 'lib/new_store_api/models/transaction_update_dto.rb', line 21

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

.nullablesObject

An array for nullable fields



33
34
35
# File 'lib/new_store_api/models/transaction_update_dto.rb', line 33

def self.nullables
  []
end

.optionalsObject

An array for optional fields



28
29
30
# File 'lib/new_store_api/models/transaction_update_dto.rb', line 28

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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

#to_sObject

Provides a human-readable string representation of the object.



53
54
55
56
# File 'lib/new_store_api/models/transaction_update_dto.rb', line 53

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