Class: NewStoreApi::CashboxConfigYcsPrV1Dto

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

Overview

CashboxConfigYcsPrV1Dto 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(pos_id = nil, pos_password = nil) ⇒ CashboxConfigYcsPrV1Dto

Returns a new instance of CashboxConfigYcsPrV1Dto.



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

def initialize(pos_id = nil, pos_password = nil)
  @pos_id = pos_id
  @pos_password = pos_password
end

Instance Attribute Details

#pos_idInteger

POS unique identifier.

  • The POS credentials (POS unique identifier and POS password) are provided by YCS PR.

Returns:

  • (Integer)


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

def pos_id
  @pos_id
end

#pos_passwordString

POS password.

  • The POS credentials (POS unique identifier and POS password) are provided by YCS PR.

Returns:

  • (String)


22
23
24
# File 'lib/new_store_api/models/cashbox_config_ycs_pr_v1_dto.rb', line 22

def pos_password
  @pos_password
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

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

  # Create object from extracted values.
  CashboxConfigYcsPrV1Dto.new(pos_id,
                              pos_password)
end

.namesObject

A mapping from model property names to API property names.



25
26
27
28
29
30
# File 'lib/new_store_api/models/cashbox_config_ycs_pr_v1_dto.rb', line 25

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

.nullablesObject

An array for nullable fields



38
39
40
# File 'lib/new_store_api/models/cashbox_config_ycs_pr_v1_dto.rb', line 38

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
# File 'lib/new_store_api/models/cashbox_config_ycs_pr_v1_dto.rb', line 62

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.pos_id,
                            ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.pos_password,
                              ->(val) { val.instance_of? String })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['pos_id'],
                          ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['pos_password'],
                            ->(val) { val.instance_of? String })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



89
90
91
92
# File 'lib/new_store_api/models/cashbox_config_ycs_pr_v1_dto.rb', line 89

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

#to_sObject

Provides a human-readable string representation of the object.



83
84
85
86
# File 'lib/new_store_api/models/cashbox_config_ycs_pr_v1_dto.rb', line 83

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