Class: NewStoreApi::ReturnReceiptResponse

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

Overview

ReturnReceiptResponse 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(permanent_link = nil, billing_address = SKIP, external_id = SKIP, order_id = SKIP, refund_id = SKIP, return_id = SKIP, sales_order_uuid = SKIP, store_name = SKIP, vault_data_id = SKIP) ⇒ ReturnReceiptResponse

Returns a new instance of ReturnReceiptResponse.



86
87
88
89
90
91
92
93
94
95
96
97
98
99
# File 'lib/new_store_api/models/return_receipt_response.rb', line 86

def initialize(permanent_link = nil, billing_address = SKIP,
               external_id = SKIP, order_id = SKIP, refund_id = SKIP,
               return_id = SKIP, sales_order_uuid = SKIP, store_name = SKIP,
               vault_data_id = SKIP)
  @billing_address = billing_address unless billing_address == SKIP
  @external_id = external_id unless external_id == SKIP
  @order_id = order_id unless order_id == SKIP
  @permanent_link = permanent_link
  @refund_id = refund_id unless refund_id == SKIP
  @return_id = return_id unless return_id == SKIP
  @sales_order_uuid = sales_order_uuid unless sales_order_uuid == SKIP
  @store_name = store_name unless store_name == SKIP
  @vault_data_id = vault_data_id unless vault_data_id == SKIP
end

Instance Attribute Details

#billing_addressBillingAddress

The consumer's billing address for the returned order. As billing address is optional for an order, this field is set to null when the order doesn't have an explicit billing address set.

Returns:



16
17
18
# File 'lib/new_store_api/models/return_receipt_response.rb', line 16

def billing_address
  @billing_address
end

#external_idString

Human readable return receipt identifier (ex. TSE00000001).

Returns:

  • (String)


20
21
22
# File 'lib/new_store_api/models/return_receipt_response.rb', line 20

def external_id
  @external_id
end

#order_idString

Human readable external order identificator.

Returns:

  • (String)


24
25
26
# File 'lib/new_store_api/models/return_receipt_response.rb', line 24

def order_id
  @order_id
end

The URL of the document.

Returns:

  • (String)


28
29
30
# File 'lib/new_store_api/models/return_receipt_response.rb', line 28

def permanent_link
  @permanent_link
end

#refund_idString

The identifier of the refund related to this return receipt.

Returns:

  • (String)


32
33
34
# File 'lib/new_store_api/models/return_receipt_response.rb', line 32

def refund_id
  @refund_id
end

#return_idString

Unique identifier of the return.

Returns:

  • (String)


36
37
38
# File 'lib/new_store_api/models/return_receipt_response.rb', line 36

def return_id
  @return_id
end

#sales_order_uuidString

Unique identifier of the sales order.

Returns:

  • (String)


40
41
42
# File 'lib/new_store_api/models/return_receipt_response.rb', line 40

def sales_order_uuid
  @sales_order_uuid
end

#store_nameString

Name of the store (ex. New York 5th Ave)

Returns:

  • (String)


44
45
46
# File 'lib/new_store_api/models/return_receipt_response.rb', line 44

def store_name
  @store_name
end

#vault_data_idString

ID of the document in the PII vault

Returns:

  • (String)


48
49
50
# File 'lib/new_store_api/models/return_receipt_response.rb', line 48

def vault_data_id
  @vault_data_id
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
# File 'lib/new_store_api/models/return_receipt_response.rb', line 102

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  permanent_link =
    hash.key?('permanent_link') ? hash['permanent_link'] : nil
  billing_address = BillingAddress.from_hash(hash['billing_address']) if
    hash['billing_address']
  external_id = hash.key?('external_id') ? hash['external_id'] : SKIP
  order_id = hash.key?('order_id') ? hash['order_id'] : SKIP
  refund_id = hash.key?('refund_id') ? hash['refund_id'] : SKIP
  return_id = hash.key?('return_id') ? hash['return_id'] : SKIP
  sales_order_uuid =
    hash.key?('sales_order_uuid') ? hash['sales_order_uuid'] : SKIP
  store_name = hash.key?('store_name') ? hash['store_name'] : SKIP
  vault_data_id = hash.key?('vault_data_id') ? hash['vault_data_id'] : SKIP

  # Create object from extracted values.
  ReturnReceiptResponse.new(permanent_link,
                            billing_address,
                            external_id,
                            order_id,
                            refund_id,
                            return_id,
                            sales_order_uuid,
                            store_name,
                            vault_data_id)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['billing_address'] = 'billing_address'
  @_hash['external_id'] = 'external_id'
  @_hash['order_id'] = 'order_id'
  @_hash['permanent_link'] = 'permanent_link'
  @_hash['refund_id'] = 'refund_id'
  @_hash['return_id'] = 'return_id'
  @_hash['sales_order_uuid'] = 'sales_order_uuid'
  @_hash['store_name'] = 'store_name'
  @_hash['vault_data_id'] = 'vault_data_id'
  @_hash
end

.nullablesObject

An array for nullable fields



80
81
82
83
84
# File 'lib/new_store_api/models/return_receipt_response.rb', line 80

def self.nullables
  %w[
    billing_address
  ]
end

.optionalsObject

An array for optional fields



66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/new_store_api/models/return_receipt_response.rb', line 66

def self.optionals
  %w[
    billing_address
    external_id
    order_id
    refund_id
    return_id
    sales_order_uuid
    store_name
    vault_data_id
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



141
142
143
144
145
146
147
148
# File 'lib/new_store_api/models/return_receipt_response.rb', line 141

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} billing_address: #{@billing_address.inspect}, external_id:"\
  " #{@external_id.inspect}, order_id: #{@order_id.inspect}, permanent_link:"\
  " #{@permanent_link.inspect}, refund_id: #{@refund_id.inspect}, return_id:"\
  " #{@return_id.inspect}, sales_order_uuid: #{@sales_order_uuid.inspect}, store_name:"\
  " #{@store_name.inspect}, vault_data_id: #{@vault_data_id.inspect}>"
end

#to_sObject

Provides a human-readable string representation of the object.



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

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} billing_address: #{@billing_address}, external_id: #{@external_id},"\
  " order_id: #{@order_id}, permanent_link: #{@permanent_link}, refund_id: #{@refund_id},"\
  " return_id: #{@return_id}, sales_order_uuid: #{@sales_order_uuid}, store_name:"\
  " #{@store_name}, vault_data_id: #{@vault_data_id}>"
end