Class: NewStoreApi::PosnetOnlineCommandLogV1Dto

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

Overview

PosnetOnlineCommandLogV1Dto 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(command_id = nil, error = SKIP, error_code = SKIP, error_state = SKIP, request = SKIP, response = SKIP, success = SKIP) ⇒ PosnetOnlineCommandLogV1Dto

Returns a new instance of PosnetOnlineCommandLogV1Dto.



70
71
72
73
74
75
76
77
78
79
80
# File 'lib/new_store_api/models/posnet_online_command_log_v1_dto.rb', line 70

def initialize(command_id = nil, error = SKIP, error_code = SKIP,
               error_state = SKIP, request = SKIP, response = SKIP,
               success = SKIP)
  @command_id = command_id
  @error = error unless error == SKIP
  @error_code = error_code unless error_code == SKIP
  @error_state = error_state unless error_state == SKIP
  @request = request unless request == SKIP
  @response = response unless response == SKIP
  @success = success unless success == SKIP
end

Instance Attribute Details

#command_idString

Id of the command.

Returns:

  • (String)


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

def command_id
  @command_id
end

#errorString

Error (if any).

Returns:

  • (String)


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

def error
  @error
end

#error_codeString

Error code for a failed command execution result.

Returns:

  • (String)


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

def error_code
  @error_code
end

#error_stateString

Error state (if any).

Returns:

  • (String)


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

def error_state
  @error_state
end

#requestString

Request frame to the command.

Returns:

  • (String)


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

def request
  @request
end

#responseString

Response frame to the command.

Returns:

  • (String)


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

def response
  @response
end

#successTrueClass | FalseClass

Success state of the command.

Returns:

  • (TrueClass | FalseClass)


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

def success
  @success
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
# File 'lib/new_store_api/models/posnet_online_command_log_v1_dto.rb', line 83

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  command_id = hash.key?('command_id') ? hash['command_id'] : nil
  error = hash.key?('error') ? hash['error'] : SKIP
  error_code = hash.key?('error_code') ? hash['error_code'] : SKIP
  error_state = hash.key?('error_state') ? hash['error_state'] : SKIP
  request = hash.key?('request') ? hash['request'] : SKIP
  response = hash.key?('response') ? hash['response'] : SKIP
  success = hash.key?('success') ? hash['success'] : SKIP

  # Create object from extracted values.
  PosnetOnlineCommandLogV1Dto.new(command_id,
                                  error,
                                  error_code,
                                  error_state,
                                  request,
                                  response,
                                  success)
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/posnet_online_command_log_v1_dto.rb', line 41

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['command_id'] = 'command_id'
  @_hash['error'] = 'error'
  @_hash['error_code'] = 'error_code'
  @_hash['error_state'] = 'error_state'
  @_hash['request'] = 'request'
  @_hash['response'] = 'response'
  @_hash['success'] = 'success'
  @_hash
end

.nullablesObject

An array for nullable fields



66
67
68
# File 'lib/new_store_api/models/posnet_online_command_log_v1_dto.rb', line 66

def self.nullables
  []
end

.optionalsObject

An array for optional fields



54
55
56
57
58
59
60
61
62
63
# File 'lib/new_store_api/models/posnet_online_command_log_v1_dto.rb', line 54

def self.optionals
  %w[
    error
    error_code
    error_state
    request
    response
    success
  ]
end

.validate(value) ⇒ Object

Validates an instance of the object from a given value.

Parameters:



107
108
109
110
111
112
113
114
115
116
117
# File 'lib/new_store_api/models/posnet_online_command_log_v1_dto.rb', line 107

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

  return false unless value.instance_of? Hash

  APIHelper.valid_type?(value['command_id'],
                        ->(val) { val.instance_of? String })
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



128
129
130
131
132
133
# File 'lib/new_store_api/models/posnet_online_command_log_v1_dto.rb', line 128

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} command_id: #{@command_id.inspect}, error: #{@error.inspect}, error_code:"\
  " #{@error_code.inspect}, error_state: #{@error_state.inspect}, request:"\
  " #{@request.inspect}, response: #{@response.inspect}, success: #{@success.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



120
121
122
123
124
125
# File 'lib/new_store_api/models/posnet_online_command_log_v1_dto.rb', line 120

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} command_id: #{@command_id}, error: #{@error}, error_code: #{@error_code},"\
  " error_state: #{@error_state}, request: #{@request}, response: #{@response}, success:"\
  " #{@success}>"
end