Class: NewStoreApi::SignaturePrV1Dto

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

Overview

SignaturePrV1Dto 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(control_number = nil, environment = nil, pos_id = nil, processor = nil, processor_message = nil, signing_required = nil, transaction_id = nil) ⇒ SignaturePrV1Dto

Returns a new instance of SignaturePrV1Dto.



63
64
65
66
67
68
69
70
71
72
73
# File 'lib/new_store_api/models/signature_pr_v1_dto.rb', line 63

def initialize(control_number = nil, environment = nil, pos_id = nil,
               processor = nil, processor_message = nil,
               signing_required = nil, transaction_id = nil)
  @control_number = control_number
  @environment = environment
  @pos_id = pos_id
  @processor = processor
  @processor_message = processor_message
  @signing_required = signing_required
  @transaction_id = transaction_id
end

Instance Attribute Details

#control_numberString

Control number recieved from YCS.

Returns:

  • (String)


14
15
16
# File 'lib/new_store_api/models/signature_pr_v1_dto.rb', line 14

def control_number
  @control_number
end

#environmentFiscalEnvironmentEnum

Control number recieved from YCS.



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

def environment
  @environment
end

#pos_idInteger

YCS POS Identifier.

Returns:

  • (Integer)


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

def pos_id
  @pos_id
end

#processorString

The processor of the transaction.

Returns:

  • (String)


26
27
28
# File 'lib/new_store_api/models/signature_pr_v1_dto.rb', line 26

def processor
  @processor
end

#processor_messageString

Footer message of the processor.

Returns:

  • (String)


30
31
32
# File 'lib/new_store_api/models/signature_pr_v1_dto.rb', line 30

def processor_message
  @processor_message
end

#signing_requiredTrueClass | FalseClass

Flag that states whether transaction requires signing through YCS.

Returns:

  • (TrueClass | FalseClass)


34
35
36
# File 'lib/new_store_api/models/signature_pr_v1_dto.rb', line 34

def signing_required
  @signing_required
end

#transaction_idString

Identifier of the transaction.

Returns:

  • (String)


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

def transaction_id
  @transaction_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
# File 'lib/new_store_api/models/signature_pr_v1_dto.rb', line 76

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  control_number =
    hash.key?('control_number') ? hash['control_number'] : nil
  environment = hash.key?('environment') ? hash['environment'] : nil
  pos_id = hash.key?('pos_id') ? hash['pos_id'] : nil
  processor = hash.key?('processor') ? hash['processor'] : nil
  processor_message =
    hash.key?('processor_message') ? hash['processor_message'] : nil
  signing_required =
    hash.key?('signing_required') ? hash['signing_required'] : nil
  transaction_id =
    hash.key?('transaction_id') ? hash['transaction_id'] : nil

  # Create object from extracted values.
  SignaturePrV1Dto.new(control_number,
                       environment,
                       pos_id,
                       processor,
                       processor_message,
                       signing_required,
                       transaction_id)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['control_number'] = 'control_number'
  @_hash['environment'] = 'environment'
  @_hash['pos_id'] = 'pos_id'
  @_hash['processor'] = 'processor'
  @_hash['processor_message'] = 'processor_message'
  @_hash['signing_required'] = 'signing_required'
  @_hash['transaction_id'] = 'transaction_id'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



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

def self.optionals
  []
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
# File 'lib/new_store_api/models/signature_pr_v1_dto.rb', line 104

def self.validate(value)
  if value.instance_of? self
    return (
      APIHelper.valid_type?(value.control_number,
                            ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.environment,
                              ->(val) { FiscalEnvironmentEnum.validate(val) }) and
        APIHelper.valid_type?(value.pos_id,
                              ->(val) { val.instance_of? Integer }) and
        APIHelper.valid_type?(value.processor,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.processor_message,
                              ->(val) { val.instance_of? String }) and
        APIHelper.valid_type?(value.signing_required,
                              ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
        APIHelper.valid_type?(value.transaction_id,
                              ->(val) { val.instance_of? String })
    )
  end

  return false unless value.instance_of? Hash

  (
    APIHelper.valid_type?(value['control_number'],
                          ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['environment'],
                            ->(val) { FiscalEnvironmentEnum.validate(val) }) and
      APIHelper.valid_type?(value['pos_id'],
                            ->(val) { val.instance_of? Integer }) and
      APIHelper.valid_type?(value['processor'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['processor_message'],
                            ->(val) { val.instance_of? String }) and
      APIHelper.valid_type?(value['signing_required'],
                            ->(val) { val.instance_of? TrueClass or val.instance_of? FalseClass }) and
      APIHelper.valid_type?(value['transaction_id'],
                            ->(val) { val.instance_of? String })
  )
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



153
154
155
156
157
158
159
# File 'lib/new_store_api/models/signature_pr_v1_dto.rb', line 153

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} control_number: #{@control_number.inspect}, environment:"\
  " #{@environment.inspect}, pos_id: #{@pos_id.inspect}, processor: #{@processor.inspect},"\
  " processor_message: #{@processor_message.inspect}, signing_required:"\
  " #{@signing_required.inspect}, transaction_id: #{@transaction_id.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



145
146
147
148
149
150
# File 'lib/new_store_api/models/signature_pr_v1_dto.rb', line 145

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} control_number: #{@control_number}, environment: #{@environment}, pos_id:"\
  " #{@pos_id}, processor: #{@processor}, processor_message: #{@processor_message},"\
  " signing_required: #{@signing_required}, transaction_id: #{@transaction_id}>"
end