Class: NewStoreApi::GetTransferTransactionResponse

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

Overview

GetTransferTransactionResponse 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(external_ref = nil, id = nil, line_items = nil, packing_list = nil, shipment_requested = nil, shipping_label = nil, status = nil, transfer_order_id = nil) ⇒ GetTransferTransactionResponse

Returns a new instance of GetTransferTransactionResponse.



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

def initialize(external_ref = nil, id = nil, line_items = nil,
               packing_list = nil, shipment_requested = nil,
               shipping_label = nil, status = nil, transfer_order_id = nil)
  @external_ref = external_ref
  @id = id
  @line_items = line_items
  @packing_list = packing_list
  @shipment_requested = shipment_requested
  @shipping_label = shipping_label
  @status = status
  @transfer_order_id = transfer_order_id
end

Instance Attribute Details

#external_refString

TODO: Write general description for this method

Returns:

  • (String)


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

def external_ref
  @external_ref
end

#idString

TODO: Write general description for this method

Returns:

  • (String)


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

def id
  @id
end

#line_itemsArray[TransferTransactionLineItemResponse]

TODO: Write general description for this method



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

def line_items
  @line_items
end

#packing_listTransferDocumentResponse

TODO: Write general description for this method



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

def packing_list
  @packing_list
end

#shipment_requestedTrueClass | FalseClass

TODO: Write general description for this method

Returns:

  • (TrueClass | FalseClass)


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

def shipment_requested
  @shipment_requested
end

#shipping_labelTransferDocumentResponse

TODO: Write general description for this method



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

def shipping_label
  @shipping_label
end

#statusString

TODO: Write general description for this method

Returns:

  • (String)


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

def status
  @status
end

#transfer_order_idString

TODO: Write general description for this method

Returns:

  • (String)


42
43
44
# File 'lib/new_store_api/models/get_transfer_transaction_response.rb', line 42

def transfer_order_id
  @transfer_order_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# File 'lib/new_store_api/models/get_transfer_transaction_response.rb', line 85

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  external_ref = hash.key?('external_ref') ? hash['external_ref'] : nil
  id = hash.key?('id') ? hash['id'] : nil
  # Parameter is an array, so we need to iterate through it
  line_items = nil
  unless hash['line_items'].nil?
    line_items = []
    hash['line_items'].each do |structure|
      line_items << (TransferTransactionLineItemResponse.from_hash(structure) if structure)
    end
  end

  line_items = nil unless hash.key?('line_items')
  packing_list = TransferDocumentResponse.from_hash(hash['packing_list']) if
    hash['packing_list']
  shipment_requested =
    hash.key?('shipment_requested') ? hash['shipment_requested'] : nil
  shipping_label = TransferDocumentResponse.from_hash(hash['shipping_label']) if
    hash['shipping_label']
  status = hash.key?('status') ? hash['status'] : nil
  transfer_order_id =
    hash.key?('transfer_order_id') ? hash['transfer_order_id'] : nil

  # Create object from extracted values.
  GetTransferTransactionResponse.new(external_ref,
                                     id,
                                     line_items,
                                     packing_list,
                                     shipment_requested,
                                     shipping_label,
                                     status,
                                     transfer_order_id)
end

.namesObject

A mapping from model property names to API property names.



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/new_store_api/models/get_transfer_transaction_response.rb', line 45

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['external_ref'] = 'external_ref'
  @_hash['id'] = 'id'
  @_hash['line_items'] = 'line_items'
  @_hash['packing_list'] = 'packing_list'
  @_hash['shipment_requested'] = 'shipment_requested'
  @_hash['shipping_label'] = 'shipping_label'
  @_hash['status'] = 'status'
  @_hash['transfer_order_id'] = 'transfer_order_id'
  @_hash
end

.nullablesObject

An array for nullable fields



64
65
66
67
68
69
# File 'lib/new_store_api/models/get_transfer_transaction_response.rb', line 64

def self.nullables
  %w[
    packing_list
    shipping_label
  ]
end

.optionalsObject

An array for optional fields



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

def self.optionals
  []
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



132
133
134
135
136
137
138
# File 'lib/new_store_api/models/get_transfer_transaction_response.rb', line 132

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} external_ref: #{@external_ref.inspect}, id: #{@id.inspect}, line_items:"\
  " #{@line_items.inspect}, packing_list: #{@packing_list.inspect}, shipment_requested:"\
  " #{@shipment_requested.inspect}, shipping_label: #{@shipping_label.inspect}, status:"\
  " #{@status.inspect}, transfer_order_id: #{@transfer_order_id.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



123
124
125
126
127
128
129
# File 'lib/new_store_api/models/get_transfer_transaction_response.rb', line 123

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} external_ref: #{@external_ref}, id: #{@id}, line_items: #{@line_items},"\
  " packing_list: #{@packing_list}, shipment_requested: #{@shipment_requested},"\
  " shipping_label: #{@shipping_label}, status: #{@status}, transfer_order_id:"\
  " #{@transfer_order_id}>"
end