Class: NewStoreApi::SchemaForBulkCancelOrdersRequest

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

Overview

SchemaForBulkCancelOrdersRequest 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(order_ids = nil, reason = nil, note = SKIP) ⇒ SchemaForBulkCancelOrdersRequest

Returns a new instance of SchemaForBulkCancelOrdersRequest.



45
46
47
48
49
# File 'lib/new_store_api/models/schema_for_bulk_cancel_orders_request.rb', line 45

def initialize(order_ids = nil, reason = nil, note = SKIP)
  @note = note unless note == SKIP
  @order_ids = order_ids
  @reason = reason
end

Instance Attribute Details

#noteString

Optional note for cancellation

Returns:

  • (String)


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

def note
  @note
end

#order_idsArray[String]

List of order IDs to cancel

Returns:

  • (Array[String])


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

def order_ids
  @order_ids
end

#reasonString

Reason for cancellation

Returns:

  • (String)


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

def reason
  @reason
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



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

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  order_ids = hash.key?('order_ids') ? hash['order_ids'] : nil
  reason = hash.key?('reason') ? hash['reason'] : nil
  note = hash.key?('note') ? hash['note'] : SKIP

  # Create object from extracted values.
  SchemaForBulkCancelOrdersRequest.new(order_ids,
                                       reason,
                                       note)
end

.namesObject

A mapping from model property names to API property names.



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

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['note'] = 'note'
  @_hash['order_ids'] = 'order_ids'
  @_hash['reason'] = 'reason'
  @_hash
end

.nullablesObject

An array for nullable fields



41
42
43
# File 'lib/new_store_api/models/schema_for_bulk_cancel_orders_request.rb', line 41

def self.nullables
  []
end

.optionalsObject

An array for optional fields



34
35
36
37
38
# File 'lib/new_store_api/models/schema_for_bulk_cancel_orders_request.rb', line 34

def self.optionals
  %w[
    note
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



73
74
75
76
77
# File 'lib/new_store_api/models/schema_for_bulk_cancel_orders_request.rb', line 73

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

#to_sObject

Provides a human-readable string representation of the object.



67
68
69
70
# File 'lib/new_store_api/models/schema_for_bulk_cancel_orders_request.rb', line 67

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} note: #{@note}, order_ids: #{@order_ids}, reason: #{@reason}>"
end