Class: NewStoreApi::AxenaActivationDataV1Dto

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

Overview

AxenaActivationDataV1Dto 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(activation_id = SKIP, api_key = SKIP, production_number = SKIP) ⇒ AxenaActivationDataV1Dto

Returns a new instance of AxenaActivationDataV1Dto.



50
51
52
53
54
55
# File 'lib/new_store_api/models/axena_activation_data_v1_dto.rb', line 50

def initialize(activation_id = SKIP, api_key = SKIP,
               production_number = SKIP)
  @activation_id = activation_id unless activation_id == SKIP
  @api_key = api_key unless api_key == SKIP
  @production_number = production_number unless production_number == SKIP
end

Instance Attribute Details

#activation_idInteger

Activation identifier.

Returns:

  • (Integer)


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

def activation_id
  @activation_id
end

#api_keyString

API key user for accessing Axena (Srv4pos) /kd API endpoint.

Returns:

  • (String)


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

def api_key
  @api_key
end

#production_numberString

Serial number that uniquely identifies instance of every installation.

  • Will be set by Axena (Srv4pos) after the fiscal activation.
  • Represents production number of cash register according to the Swedish regulations.

Returns:

  • (String)


25
26
27
# File 'lib/new_store_api/models/axena_activation_data_v1_dto.rb', line 25

def production_number
  @production_number
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/new_store_api/models/axena_activation_data_v1_dto.rb', line 58

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  activation_id = hash.key?('activation_id') ? hash['activation_id'] : SKIP
  api_key = hash.key?('api_key') ? hash['api_key'] : SKIP
  production_number =
    hash.key?('production_number') ? hash['production_number'] : SKIP

  # Create object from extracted values.
  AxenaActivationDataV1Dto.new(activation_id,
                               api_key,
                               production_number)
end

.namesObject

A mapping from model property names to API property names.



28
29
30
31
32
33
34
# File 'lib/new_store_api/models/axena_activation_data_v1_dto.rb', line 28

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

.nullablesObject

An array for nullable fields



46
47
48
# File 'lib/new_store_api/models/axena_activation_data_v1_dto.rb', line 46

def self.nullables
  []
end

.optionalsObject

An array for optional fields



37
38
39
40
41
42
43
# File 'lib/new_store_api/models/axena_activation_data_v1_dto.rb', line 37

def self.optionals
  %w[
    activation_id
    api_key
    production_number
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



75
76
77
78
79
80
81
# File 'lib/new_store_api/models/axena_activation_data_v1_dto.rb', line 75

def self.validate(value)
  return true if value.instance_of? self

  return false unless value.instance_of? Hash

  true
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



91
92
93
94
95
# File 'lib/new_store_api/models/axena_activation_data_v1_dto.rb', line 91

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} activation_id: #{@activation_id.inspect}, api_key: #{@api_key.inspect},"\
  " production_number: #{@production_number.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



84
85
86
87
88
# File 'lib/new_store_api/models/axena_activation_data_v1_dto.rb', line 84

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} activation_id: #{@activation_id}, api_key: #{@api_key}, production_number:"\
  " #{@production_number}>"
end