Class: NewStoreApi::GetReturnReceiptRequest

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

Overview

request payload to get a return receipt document

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(order_id = nil, refund_id = nil, print_type = SKIP) ⇒ GetReturnReceiptRequest

Returns a new instance of GetReturnReceiptRequest.



46
47
48
49
50
# File 'lib/new_store_api/models/get_return_receipt_request.rb', line 46

def initialize(order_id = nil, refund_id = nil, print_type = SKIP)
  @order_id = order_id
  @print_type = print_type unless print_type == SKIP
  @refund_id = refund_id
end

Instance Attribute Details

#order_idString

Identifier for the corresponding sales_order

Returns:

  • (String)


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

def order_id
  @order_id
end

Type of the receipt printing operation (document_printed, document_emailed).

Returns:

  • (String)


19
20
21
# File 'lib/new_store_api/models/get_return_receipt_request.rb', line 19

def print_type
  @print_type
end

#refund_idString

The identifier of the refund related to this return receipt.

Returns:

  • (String)


23
24
25
# File 'lib/new_store_api/models/get_return_receipt_request.rb', line 23

def refund_id
  @refund_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  order_id = hash.key?('order_id') ? hash['order_id'] : nil
  refund_id = hash.key?('refund_id') ? hash['refund_id'] : nil
  print_type = hash.key?('print_type') ? hash['print_type'] : SKIP

  # Create object from extracted values.
  GetReturnReceiptRequest.new(order_id,
                              refund_id,
                              print_type)
end

.namesObject

A mapping from model property names to API property names.



26
27
28
29
30
31
32
# File 'lib/new_store_api/models/get_return_receipt_request.rb', line 26

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['order_id'] = 'order_id'
  @_hash['print_type'] = 'print_type'
  @_hash['refund_id'] = 'refund_id'
  @_hash
end

.nullablesObject

An array for nullable fields



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

def self.nullables
  []
end

.optionalsObject

An array for optional fields



35
36
37
38
39
# File 'lib/new_store_api/models/get_return_receipt_request.rb', line 35

def self.optionals
  %w[
    print_type
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



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

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

#to_sObject

Provides a human-readable string representation of the object.



68
69
70
71
72
# File 'lib/new_store_api/models/get_return_receipt_request.rb', line 68

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