Class: WalmartApIs::InboundOperationStatus

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/walmart_ap_is/models/inbound_operation_status.rb

Overview

GetInboundOperationStatus response.

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(operation:, operation_id:, operation_problems:, operation_status:, additional_properties: nil) ⇒ InboundOperationStatus

Returns a new instance of InboundOperationStatus.



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

def initialize(operation:, operation_id:, operation_problems:,
               operation_status:, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @operation = operation
  @operation_id = operation_id
  @operation_problems = operation_problems
  @operation_status = operation_status
  @additional_properties = additional_properties
end

Instance Attribute Details

#operationString

The name of the operation in the asynchronous API call.

Returns:

  • (String)


14
15
16
# File 'lib/walmart_ap_is/models/inbound_operation_status.rb', line 14

def operation
  @operation
end

#operation_idString

The operation ID returned by the asynchronous API call.

Returns:

  • (String)


18
19
20
# File 'lib/walmart_ap_is/models/inbound_operation_status.rb', line 18

def operation_id
  @operation_id
end

#operation_problemsArray[OperationProblem]

The problems in the processing of the asynchronous operation.

Returns:



22
23
24
# File 'lib/walmart_ap_is/models/inbound_operation_status.rb', line 22

def operation_problems
  @operation_problems
end

#operation_statusOperationStatus

The status of an operation.

Returns:



26
27
28
# File 'lib/walmart_ap_is/models/inbound_operation_status.rb', line 26

def operation_status
  @operation_status
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
# File 'lib/walmart_ap_is/models/inbound_operation_status.rb', line 61

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  operation = hash.key?('operation') ? hash['operation'] : nil
  operation_id = hash.key?('operationId') ? hash['operationId'] : nil
  # Parameter is an array, so we need to iterate through it
  operation_problems = nil
  unless hash['operationProblems'].nil?
    operation_problems = []
    hash['operationProblems'].each do |structure|
      operation_problems << (OperationProblem.from_hash(structure) if structure)
    end
  end

  operation_problems = nil unless hash.key?('operationProblems')
  operation_status =
    hash.key?('operationStatus') ? hash['operationStatus'] : nil

  # Create a new hash for additional properties, removing known properties.
  new_hash = hash.reject { |k, _| names.value?(k) }

  additional_properties = APIHelper.get_additional_properties(
    new_hash, proc { |value| value }
  )

  # Create object from extracted values.
  InboundOperationStatus.new(operation: operation,
                             operation_id: operation_id,
                             operation_problems: operation_problems,
                             operation_status: operation_status,
                             additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



29
30
31
32
33
34
35
36
# File 'lib/walmart_ap_is/models/inbound_operation_status.rb', line 29

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['operation'] = 'operation'
  @_hash['operation_id'] = 'operationId'
  @_hash['operation_problems'] = 'operationProblems'
  @_hash['operation_status'] = 'operationStatus'
  @_hash
end

.nullablesObject

An array for nullable fields



44
45
46
# File 'lib/walmart_ap_is/models/inbound_operation_status.rb', line 44

def self.nullables
  []
end

.optionalsObject

An array for optional fields



39
40
41
# File 'lib/walmart_ap_is/models/inbound_operation_status.rb', line 39

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



104
105
106
107
108
109
# File 'lib/walmart_ap_is/models/inbound_operation_status.rb', line 104

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} operation: #{@operation.inspect}, operation_id: #{@operation_id.inspect},"\
  " operation_problems: #{@operation_problems.inspect}, operation_status:"\
  " #{@operation_status.inspect}, additional_properties: #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



96
97
98
99
100
101
# File 'lib/walmart_ap_is/models/inbound_operation_status.rb', line 96

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} operation: #{@operation}, operation_id: #{@operation_id},"\
  " operation_problems: #{@operation_problems}, operation_status: #{@operation_status},"\
  " additional_properties: #{@additional_properties}>"
end