Class: WalmartApIs::RefundOrderLinesResponse

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

Overview

RefundOrderLinesResponse 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(purchase_order_id: SKIP, refund_id: SKIP, refunded_at: SKIP, additional_properties: nil) ⇒ RefundOrderLinesResponse

Returns a new instance of RefundOrderLinesResponse.



52
53
54
55
56
57
58
59
60
61
# File 'lib/walmart_ap_is/models/refund_order_lines_response.rb', line 52

def initialize(purchase_order_id: SKIP, refund_id: SKIP, refunded_at: SKIP,
               additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @purchase_order_id = purchase_order_id unless purchase_order_id == SKIP
  @refund_id = refund_id unless refund_id == SKIP
  @refunded_at = refunded_at unless refunded_at == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#purchase_order_idString

TODO: Write general description for this method

Returns:

  • (String)


15
16
17
# File 'lib/walmart_ap_is/models/refund_order_lines_response.rb', line 15

def purchase_order_id
  @purchase_order_id
end

#refund_idString

Seller-visible refund handle, generated server-side. Stable for the lifetime of the refund; future GET endpoints will accept it as a path variable.

Returns:

  • (String)


21
22
23
# File 'lib/walmart_ap_is/models/refund_order_lines_response.rb', line 21

def refund_id
  @refund_id
end

#refunded_atDateTime

Seller-visible refund handle, generated server-side. Stable for the lifetime of the refund; future GET endpoints will accept it as a path variable.

Returns:

  • (DateTime)


27
28
29
# File 'lib/walmart_ap_is/models/refund_order_lines_response.rb', line 27

def refunded_at
  @refunded_at
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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
# File 'lib/walmart_ap_is/models/refund_order_lines_response.rb', line 64

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  purchase_order_id =
    hash.key?('purchaseOrderId') ? hash['purchaseOrderId'] : SKIP
  refund_id = hash.key?('refundId') ? hash['refundId'] : SKIP
  refunded_at = if hash.key?('refundedAt')
                  (DateTimeHelper.from_rfc3339(hash['refundedAt']) if hash['refundedAt'])
                else
                  SKIP
                end

  # 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.
  RefundOrderLinesResponse.new(purchase_order_id: purchase_order_id,
                               refund_id: refund_id,
                               refunded_at: refunded_at,
                               additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['purchase_order_id'] = 'purchaseOrderId'
  @_hash['refund_id'] = 'refundId'
  @_hash['refunded_at'] = 'refundedAt'
  @_hash
end

.nullablesObject

An array for nullable fields



48
49
50
# File 'lib/walmart_ap_is/models/refund_order_lines_response.rb', line 48

def self.nullables
  []
end

.optionalsObject

An array for optional fields



39
40
41
42
43
44
45
# File 'lib/walmart_ap_is/models/refund_order_lines_response.rb', line 39

def self.optionals
  %w[
    purchase_order_id
    refund_id
    refunded_at
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} purchase_order_id: #{@purchase_order_id.inspect}, refund_id:"\
  " #{@refund_id.inspect}, refunded_at: #{@refunded_at.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_custom_refunded_atObject



91
92
93
# File 'lib/walmart_ap_is/models/refund_order_lines_response.rb', line 91

def to_custom_refunded_at
  DateTimeHelper.to_rfc3339(refunded_at)
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} purchase_order_id: #{@purchase_order_id}, refund_id: #{@refund_id},"\
  " refunded_at: #{@refunded_at}, additional_properties: #{@additional_properties}>"
end