Class: SplititWebApiV4::UpdateOrderResponse

Inherits:
BaseModel
  • Object
show all
Defined in:
lib/splitit_web_api_v4/models/update_order_response.rb

Overview

UpdateOrderResponse 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(status:, merchant_order_reference: SKIP, tracking_number: SKIP, shipping_status: SKIP, metadata: SKIP, installment_plan_number: SKIP, additional_properties: nil) ⇒ UpdateOrderResponse

Returns a new instance of UpdateOrderResponse.



64
65
66
67
68
69
70
71
72
73
74
75
76
77
# File 'lib/splitit_web_api_v4/models/update_order_response.rb', line 64

def initialize(status:, merchant_order_reference: SKIP,
               tracking_number: SKIP, shipping_status: SKIP, metadata: SKIP,
               installment_plan_number: SKIP, additional_properties: nil)
  # Add additional model properties to the instance
  additional_properties = {} if additional_properties.nil?

  @status = status
  @merchant_order_reference = merchant_order_reference unless merchant_order_reference == SKIP
  @tracking_number = tracking_number unless tracking_number == SKIP
  @shipping_status = shipping_status unless shipping_status == SKIP
  @metadata =  unless  == SKIP
  @installment_plan_number = installment_plan_number unless installment_plan_number == SKIP
  @additional_properties = additional_properties
end

Instance Attribute Details

#installment_plan_numberString

TODO: Write general description for this method

Returns:

  • (String)


34
35
36
# File 'lib/splitit_web_api_v4/models/update_order_response.rb', line 34

def installment_plan_number
  @installment_plan_number
end

#merchant_order_referenceString

TODO: Write general description for this method

Returns:

  • (String)


18
19
20
# File 'lib/splitit_web_api_v4/models/update_order_response.rb', line 18

def merchant_order_reference
  @merchant_order_reference
end

#metadataArray[MetadataItem]

TODO: Write general description for this method

Returns:



30
31
32
# File 'lib/splitit_web_api_v4/models/update_order_response.rb', line 30

def 
  @metadata
end

#shipping_statusShippingStatus

TODO: Write general description for this method

Returns:



26
27
28
# File 'lib/splitit_web_api_v4/models/update_order_response.rb', line 26

def shipping_status
  @shipping_status
end

#statusPlanStatus

TODO: Write general description for this method

Returns:



14
15
16
# File 'lib/splitit_web_api_v4/models/update_order_response.rb', line 14

def status
  @status
end

#tracking_numberString

TODO: Write general description for this method

Returns:

  • (String)


22
23
24
# File 'lib/splitit_web_api_v4/models/update_order_response.rb', line 22

def tracking_number
  @tracking_number
end

Class Method Details

.from_hash(hash) ⇒ Object

Creates an instance of the object from a hash.



80
81
82
83
84
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
# File 'lib/splitit_web_api_v4/models/update_order_response.rb', line 80

def self.from_hash(hash)
  return nil unless hash

  # Extract variables from the hash.
  status = hash.key?('Status') ? hash['Status'] : nil
  merchant_order_reference =
    hash.key?('MerchantOrderReference') ? hash['MerchantOrderReference'] : SKIP
  tracking_number =
    hash.key?('TrackingNumber') ? hash['TrackingNumber'] : SKIP
  shipping_status =
    hash.key?('ShippingStatus') ? hash['ShippingStatus'] : SKIP
  # Parameter is an array, so we need to iterate through it
   = nil
  unless hash['Metadata'].nil?
     = []
    hash['Metadata'].each do |structure|
       << (MetadataItem.from_hash(structure) if structure)
    end
  end

   = SKIP unless hash.key?('Metadata')
  installment_plan_number =
    hash.key?('InstallmentPlanNumber') ? hash['InstallmentPlanNumber'] : SKIP

  # 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.
  UpdateOrderResponse.new(status: status,
                          merchant_order_reference: merchant_order_reference,
                          tracking_number: tracking_number,
                          shipping_status: shipping_status,
                          metadata: ,
                          installment_plan_number: installment_plan_number,
                          additional_properties: additional_properties)
end

.namesObject

A mapping from model property names to API property names.



37
38
39
40
41
42
43
44
45
46
# File 'lib/splitit_web_api_v4/models/update_order_response.rb', line 37

def self.names
  @_hash = {} if @_hash.nil?
  @_hash['status'] = 'Status'
  @_hash['merchant_order_reference'] = 'MerchantOrderReference'
  @_hash['tracking_number'] = 'TrackingNumber'
  @_hash['shipping_status'] = 'ShippingStatus'
  @_hash['metadata'] = 'Metadata'
  @_hash['installment_plan_number'] = 'InstallmentPlanNumber'
  @_hash
end

.nullablesObject

An array for nullable fields



60
61
62
# File 'lib/splitit_web_api_v4/models/update_order_response.rb', line 60

def self.nullables
  []
end

.optionalsObject

An array for optional fields



49
50
51
52
53
54
55
56
57
# File 'lib/splitit_web_api_v4/models/update_order_response.rb', line 49

def self.optionals
  %w[
    merchant_order_reference
    tracking_number
    shipping_status
    metadata
    installment_plan_number
  ]
end

Instance Method Details

#inspectObject

Provides a debugging-friendly string with detailed object information.



131
132
133
134
135
136
137
138
# File 'lib/splitit_web_api_v4/models/update_order_response.rb', line 131

def inspect
  class_name = self.class.name.split('::').last
  "<#{class_name} status: #{@status.inspect}, merchant_order_reference:"\
  " #{@merchant_order_reference.inspect}, tracking_number: #{@tracking_number.inspect},"\
  " shipping_status: #{@shipping_status.inspect}, metadata: #{@metadata.inspect},"\
  " installment_plan_number: #{@installment_plan_number.inspect}, additional_properties:"\
  " #{@additional_properties}>"
end

#to_sObject

Provides a human-readable string representation of the object.



122
123
124
125
126
127
128
# File 'lib/splitit_web_api_v4/models/update_order_response.rb', line 122

def to_s
  class_name = self.class.name.split('::').last
  "<#{class_name} status: #{@status}, merchant_order_reference: #{@merchant_order_reference},"\
  " tracking_number: #{@tracking_number}, shipping_status: #{@shipping_status}, metadata:"\
  " #{@metadata}, installment_plan_number: #{@installment_plan_number}, additional_properties:"\
  " #{@additional_properties}>"
end