wine_shipping 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (124) hide show
  1. checksums.yaml +7 -0
  2. data/Gemfile +7 -0
  3. data/README.md +128 -0
  4. data/Rakefile +8 -0
  5. data/docs/Authentication.md +10 -0
  6. data/docs/BillingContactInfo.md +18 -0
  7. data/docs/DeliveryContactInfo.md +17 -0
  8. data/docs/Inventory.md +20 -0
  9. data/docs/InventoryApi.md +102 -0
  10. data/docs/InventoryMovementApi.md +100 -0
  11. data/docs/InventoryStatusRequest.md +13 -0
  12. data/docs/InventoryStatusResult.md +12 -0
  13. data/docs/ItemInfo.md +10 -0
  14. data/docs/OrderOnHold.md +19 -0
  15. data/docs/OrderOnHoldItem.md +11 -0
  16. data/docs/PackageItem.md +10 -0
  17. data/docs/PurchaseOrderDetails.md +10 -0
  18. data/docs/PurchaseOrderInfo.md +24 -0
  19. data/docs/PurchaseOrderItemInfo.md +10 -0
  20. data/docs/RecipientContactInfo.md +18 -0
  21. data/docs/RequestorInfo.md +11 -0
  22. data/docs/ReturnResult.md +12 -0
  23. data/docs/ReturnSalesOrderHeader.md +31 -0
  24. data/docs/ReturnSalesOrderLine.md +13 -0
  25. data/docs/ReturnsRequest.md +16 -0
  26. data/docs/SKUApi.md +54 -0
  27. data/docs/SKUDetails.md +10 -0
  28. data/docs/SKUInfo.md +20 -0
  29. data/docs/SalesOrderApi.md +240 -0
  30. data/docs/SalesOrderCancelRequest.md +9 -0
  31. data/docs/SalesOrderDetails.md +14 -0
  32. data/docs/SalesOrderInfo.md +20 -0
  33. data/docs/ShipmentInfo.md +13 -0
  34. data/docs/TrackingApi.md +55 -0
  35. data/docs/TrackingRequest.md +9 -0
  36. data/docs/TrackingResult.md +28 -0
  37. data/docs/TransferOrderDetails.md +10 -0
  38. data/docs/TransferOrderInfo.md +17 -0
  39. data/docs/TransferOrderItemInfo.md +10 -0
  40. data/docs/WarehouseInventoryStatus.md +19 -0
  41. data/git_push.sh +55 -0
  42. data/lib/.DS_Store +0 -0
  43. data/lib/wine_shipping.rb +75 -0
  44. data/lib/wine_shipping/api/inventory_api.rb +127 -0
  45. data/lib/wine_shipping/api/inventory_movement_api.rb +125 -0
  46. data/lib/wine_shipping/api/sales_order_api.rb +280 -0
  47. data/lib/wine_shipping/api/sku_api.rb +74 -0
  48. data/lib/wine_shipping/api/tracking_api.rb +75 -0
  49. data/lib/wine_shipping/api_client.rb +388 -0
  50. data/lib/wine_shipping/api_error.rb +38 -0
  51. data/lib/wine_shipping/configuration.rb +202 -0
  52. data/lib/wine_shipping/models/authentication.rb +201 -0
  53. data/lib/wine_shipping/models/billing_contact_info.rb +273 -0
  54. data/lib/wine_shipping/models/delivery_contact_info.rb +298 -0
  55. data/lib/wine_shipping/models/inventory.rb +291 -0
  56. data/lib/wine_shipping/models/inventory_status_request.rb +230 -0
  57. data/lib/wine_shipping/models/inventory_status_result.rb +221 -0
  58. data/lib/wine_shipping/models/item_info.rb +201 -0
  59. data/lib/wine_shipping/models/order_on_hold.rb +284 -0
  60. data/lib/wine_shipping/models/order_on_hold_item.rb +210 -0
  61. data/lib/wine_shipping/models/package_item.rb +201 -0
  62. data/lib/wine_shipping/models/purchase_order_details.rb +203 -0
  63. data/lib/wine_shipping/models/purchase_order_info.rb +361 -0
  64. data/lib/wine_shipping/models/purchase_order_item_info.rb +201 -0
  65. data/lib/wine_shipping/models/recipient_contact_info.rb +273 -0
  66. data/lib/wine_shipping/models/requestor_info.rb +210 -0
  67. data/lib/wine_shipping/models/return_result.rb +221 -0
  68. data/lib/wine_shipping/models/return_sales_order_header.rb +392 -0
  69. data/lib/wine_shipping/models/return_sales_order_line.rb +228 -0
  70. data/lib/wine_shipping/models/returns_request.rb +257 -0
  71. data/lib/wine_shipping/models/sales_order_cancel_request.rb +192 -0
  72. data/lib/wine_shipping/models/sales_order_details.rb +239 -0
  73. data/lib/wine_shipping/models/sales_order_info.rb +325 -0
  74. data/lib/wine_shipping/models/shipment_info.rb +274 -0
  75. data/lib/wine_shipping/models/sku_details.rb +201 -0
  76. data/lib/wine_shipping/models/sku_info.rb +325 -0
  77. data/lib/wine_shipping/models/tracking_request.rb +192 -0
  78. data/lib/wine_shipping/models/tracking_result.rb +365 -0
  79. data/lib/wine_shipping/models/transfer_order_details.rb +203 -0
  80. data/lib/wine_shipping/models/transfer_order_info.rb +264 -0
  81. data/lib/wine_shipping/models/transfer_order_item_info.rb +201 -0
  82. data/lib/wine_shipping/models/warehouse_inventory_status.rb +282 -0
  83. data/lib/wine_shipping/version.rb +15 -0
  84. data/spec/api/inventory_api_spec.rb +57 -0
  85. data/spec/api/inventory_movement_api_spec.rb +57 -0
  86. data/spec/api/sales_order_api_spec.rb +90 -0
  87. data/spec/api/sku_api_spec.rb +46 -0
  88. data/spec/api/tracking_api_spec.rb +46 -0
  89. data/spec/api_client_spec.rb +226 -0
  90. data/spec/configuration_spec.rb +42 -0
  91. data/spec/models/authentication_spec.rb +53 -0
  92. data/spec/models/billing_contact_info_spec.rb +101 -0
  93. data/spec/models/delivery_contact_info_spec.rb +99 -0
  94. data/spec/models/inventory_spec.rb +113 -0
  95. data/spec/models/inventory_status_request_spec.rb +71 -0
  96. data/spec/models/inventory_status_result_spec.rb +65 -0
  97. data/spec/models/item_info_spec.rb +53 -0
  98. data/spec/models/order_on_hold_item_spec.rb +59 -0
  99. data/spec/models/order_on_hold_spec.rb +107 -0
  100. data/spec/models/package_item_spec.rb +53 -0
  101. data/spec/models/purchase_order_details_spec.rb +53 -0
  102. data/spec/models/purchase_order_info_spec.rb +141 -0
  103. data/spec/models/purchase_order_item_info_spec.rb +53 -0
  104. data/spec/models/recipient_contact_info_spec.rb +101 -0
  105. data/spec/models/requestor_info_spec.rb +59 -0
  106. data/spec/models/return_result_spec.rb +65 -0
  107. data/spec/models/return_sales_order_header_spec.rb +179 -0
  108. data/spec/models/return_sales_order_line_spec.rb +71 -0
  109. data/spec/models/returns_request_spec.rb +89 -0
  110. data/spec/models/sales_order_cancel_request_spec.rb +47 -0
  111. data/spec/models/sales_order_details_spec.rb +77 -0
  112. data/spec/models/sales_order_info_spec.rb +117 -0
  113. data/spec/models/shipment_info_spec.rb +79 -0
  114. data/spec/models/sku_details_spec.rb +53 -0
  115. data/spec/models/sku_info_spec.rb +117 -0
  116. data/spec/models/tracking_request_spec.rb +47 -0
  117. data/spec/models/tracking_result_spec.rb +161 -0
  118. data/spec/models/transfer_order_details_spec.rb +53 -0
  119. data/spec/models/transfer_order_info_spec.rb +95 -0
  120. data/spec/models/transfer_order_item_info_spec.rb +53 -0
  121. data/spec/models/warehouse_inventory_status_spec.rb +107 -0
  122. data/spec/spec_helper.rb +111 -0
  123. data/wine_shipping.gemspec +45 -0
  124. metadata +390 -0
@@ -0,0 +1,228 @@
1
+ =begin
2
+ #API from Wineshipping
3
+
4
+ #Wineshipping API is a programmatically consumable service or an Application Programming Interface (API) platform designed to enable Wineshipping LLC's client applications to natively transmit and manage their order, view inventory, track shipments etc.<br /><br />In order to access API operations request a UserKey and Password from Wineshipping. For any questions please contact Wineshipping Helpdesk at <a href='mailto:IT-Help@wineshipping.com?Subject=API from Wineshipping'>IT-Help@wineshipping.com</a>.
5
+
6
+ OpenAPI spec version: V3
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.7
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module WineShipping
16
+ class ReturnSalesOrderLine
17
+ attr_accessor :item_no
18
+
19
+ attr_accessor :item_description
20
+
21
+ attr_accessor :quantity
22
+
23
+ attr_accessor :uom
24
+
25
+ attr_accessor :disposition_code
26
+
27
+ attr_accessor :inventory_status_code
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'item_no' => :'ItemNo',
33
+ :'item_description' => :'ItemDescription',
34
+ :'quantity' => :'Quantity',
35
+ :'uom' => :'UOM',
36
+ :'disposition_code' => :'DispositionCode',
37
+ :'inventory_status_code' => :'InventoryStatusCode'
38
+ }
39
+ end
40
+
41
+ # Attribute type mapping.
42
+ def self.swagger_types
43
+ {
44
+ :'item_no' => :'String',
45
+ :'item_description' => :'String',
46
+ :'quantity' => :'String',
47
+ :'uom' => :'String',
48
+ :'disposition_code' => :'String',
49
+ :'inventory_status_code' => :'String'
50
+ }
51
+ end
52
+
53
+ # Initializes the object
54
+ # @param [Hash] attributes Model attributes in the form of hash
55
+ def initialize(attributes = {})
56
+ return unless attributes.is_a?(Hash)
57
+
58
+ # convert string to symbol for hash key
59
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
60
+
61
+ if attributes.has_key?(:'ItemNo')
62
+ self.item_no = attributes[:'ItemNo']
63
+ end
64
+
65
+ if attributes.has_key?(:'ItemDescription')
66
+ self.item_description = attributes[:'ItemDescription']
67
+ end
68
+
69
+ if attributes.has_key?(:'Quantity')
70
+ self.quantity = attributes[:'Quantity']
71
+ end
72
+
73
+ if attributes.has_key?(:'UOM')
74
+ self.uom = attributes[:'UOM']
75
+ end
76
+
77
+ if attributes.has_key?(:'DispositionCode')
78
+ self.disposition_code = attributes[:'DispositionCode']
79
+ end
80
+
81
+ if attributes.has_key?(:'InventoryStatusCode')
82
+ self.inventory_status_code = attributes[:'InventoryStatusCode']
83
+ end
84
+ end
85
+
86
+ # Show invalid properties with the reasons. Usually used together with valid?
87
+ # @return Array for valid properties with the reasons
88
+ def list_invalid_properties
89
+ invalid_properties = Array.new
90
+ invalid_properties
91
+ end
92
+
93
+ # Check to see if the all the properties in the model are valid
94
+ # @return true if the model is valid
95
+ def valid?
96
+ true
97
+ end
98
+
99
+ # Checks equality by comparing each attribute.
100
+ # @param [Object] Object to be compared
101
+ def ==(o)
102
+ return true if self.equal?(o)
103
+ self.class == o.class &&
104
+ item_no == o.item_no &&
105
+ item_description == o.item_description &&
106
+ quantity == o.quantity &&
107
+ uom == o.uom &&
108
+ disposition_code == o.disposition_code &&
109
+ inventory_status_code == o.inventory_status_code
110
+ end
111
+
112
+ # @see the `==` method
113
+ # @param [Object] Object to be compared
114
+ def eql?(o)
115
+ self == o
116
+ end
117
+
118
+ # Calculates hash code according to all attributes.
119
+ # @return [Fixnum] Hash code
120
+ def hash
121
+ [item_no, item_description, quantity, uom, disposition_code, inventory_status_code].hash
122
+ end
123
+
124
+ # Builds the object from hash
125
+ # @param [Hash] attributes Model attributes in the form of hash
126
+ # @return [Object] Returns the model itself
127
+ def build_from_hash(attributes)
128
+ return nil unless attributes.is_a?(Hash)
129
+ self.class.swagger_types.each_pair do |key, type|
130
+ if type =~ /\AArray<(.*)>/i
131
+ # check to ensure the input is an array given that the the attribute
132
+ # is documented as an array but the input is not
133
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
134
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
135
+ end
136
+ elsif !attributes[self.class.attribute_map[key]].nil?
137
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
138
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
139
+ end
140
+
141
+ self
142
+ end
143
+
144
+ # Deserializes the data based on type
145
+ # @param string type Data type
146
+ # @param string value Value to be deserialized
147
+ # @return [Object] Deserialized data
148
+ def _deserialize(type, value)
149
+ case type.to_sym
150
+ when :DateTime
151
+ DateTime.parse(value)
152
+ when :Date
153
+ Date.parse(value)
154
+ when :String
155
+ value.to_s
156
+ when :Integer
157
+ value.to_i
158
+ when :Float
159
+ value.to_f
160
+ when :BOOLEAN
161
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
162
+ true
163
+ else
164
+ false
165
+ end
166
+ when :Object
167
+ # generic object (usually a Hash), return directly
168
+ value
169
+ when /\AArray<(?<inner_type>.+)>\z/
170
+ inner_type = Regexp.last_match[:inner_type]
171
+ value.map { |v| _deserialize(inner_type, v) }
172
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
173
+ k_type = Regexp.last_match[:k_type]
174
+ v_type = Regexp.last_match[:v_type]
175
+ {}.tap do |hash|
176
+ value.each do |k, v|
177
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
178
+ end
179
+ end
180
+ else # model
181
+ temp_model = WineShipping.const_get(type).new
182
+ temp_model.build_from_hash(value)
183
+ end
184
+ end
185
+
186
+ # Returns the string representation of the object
187
+ # @return [String] String presentation of the object
188
+ def to_s
189
+ to_hash.to_s
190
+ end
191
+
192
+ # to_body is an alias to to_hash (backward compatibility)
193
+ # @return [Hash] Returns the object in the form of hash
194
+ def to_body
195
+ to_hash
196
+ end
197
+
198
+ # Returns the object in the form of hash
199
+ # @return [Hash] Returns the object in the form of hash
200
+ def to_hash
201
+ hash = {}
202
+ self.class.attribute_map.each_pair do |attr, param|
203
+ value = self.send(attr)
204
+ next if value.nil?
205
+ hash[param] = _to_hash(value)
206
+ end
207
+ hash
208
+ end
209
+
210
+ # Outputs non-array value in the form of hash
211
+ # For object, use to_hash. Otherwise, just return the value
212
+ # @param [Object] value Any valid value
213
+ # @return [Hash] Returns the value in the form of hash
214
+ def _to_hash(value)
215
+ if value.is_a?(Array)
216
+ value.compact.map { |v| _to_hash(v) }
217
+ elsif value.is_a?(Hash)
218
+ {}.tap do |hash|
219
+ value.each { |k, v| hash[k] = _to_hash(v) }
220
+ end
221
+ elsif value.respond_to? :to_hash
222
+ value.to_hash
223
+ else
224
+ value
225
+ end
226
+ end
227
+ end
228
+ end
@@ -0,0 +1,257 @@
1
+ =begin
2
+ #API from Wineshipping
3
+
4
+ #Wineshipping API is a programmatically consumable service or an Application Programming Interface (API) platform designed to enable Wineshipping LLC's client applications to natively transmit and manage their order, view inventory, track shipments etc.<br /><br />In order to access API operations request a UserKey and Password from Wineshipping. For any questions please contact Wineshipping Helpdesk at <a href='mailto:IT-Help@wineshipping.com?Subject=API from Wineshipping'>IT-Help@wineshipping.com</a>.
5
+
6
+ OpenAPI spec version: V3
7
+
8
+ Generated by: https://github.com/swagger-api/swagger-codegen.git
9
+ Swagger Codegen version: 2.4.7
10
+
11
+ =end
12
+
13
+ require 'date'
14
+
15
+ module WineShipping
16
+ class ReturnsRequest
17
+ attr_accessor :authentication
18
+
19
+ attr_accessor :order_numbers
20
+
21
+ attr_accessor :start_time
22
+
23
+ attr_accessor :end_time
24
+
25
+ attr_accessor :disposition_code
26
+
27
+ attr_accessor :warehouse
28
+
29
+ attr_accessor :include_total_record_count
30
+
31
+ attr_accessor :skip
32
+
33
+ attr_accessor :top
34
+
35
+ # Attribute mapping from ruby-style variable name to JSON key.
36
+ def self.attribute_map
37
+ {
38
+ :'authentication' => :'Authentication',
39
+ :'order_numbers' => :'OrderNumbers',
40
+ :'start_time' => :'StartTime',
41
+ :'end_time' => :'EndTime',
42
+ :'disposition_code' => :'DispositionCode',
43
+ :'warehouse' => :'Warehouse',
44
+ :'include_total_record_count' => :'IncludeTotalRecordCount',
45
+ :'skip' => :'Skip',
46
+ :'top' => :'Top'
47
+ }
48
+ end
49
+
50
+ # Attribute type mapping.
51
+ def self.swagger_types
52
+ {
53
+ :'authentication' => :'Authentication',
54
+ :'order_numbers' => :'Array<String>',
55
+ :'start_time' => :'DateTime',
56
+ :'end_time' => :'DateTime',
57
+ :'disposition_code' => :'String',
58
+ :'warehouse' => :'String',
59
+ :'include_total_record_count' => :'BOOLEAN',
60
+ :'skip' => :'Integer',
61
+ :'top' => :'Integer'
62
+ }
63
+ end
64
+
65
+ # Initializes the object
66
+ # @param [Hash] attributes Model attributes in the form of hash
67
+ def initialize(attributes = {})
68
+ return unless attributes.is_a?(Hash)
69
+
70
+ # convert string to symbol for hash key
71
+ attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
72
+
73
+ if attributes.has_key?(:'Authentication')
74
+ self.authentication = attributes[:'Authentication']
75
+ end
76
+
77
+ if attributes.has_key?(:'OrderNumbers')
78
+ if (value = attributes[:'OrderNumbers']).is_a?(Array)
79
+ self.order_numbers = value
80
+ end
81
+ end
82
+
83
+ if attributes.has_key?(:'StartTime')
84
+ self.start_time = attributes[:'StartTime']
85
+ end
86
+
87
+ if attributes.has_key?(:'EndTime')
88
+ self.end_time = attributes[:'EndTime']
89
+ end
90
+
91
+ if attributes.has_key?(:'DispositionCode')
92
+ self.disposition_code = attributes[:'DispositionCode']
93
+ end
94
+
95
+ if attributes.has_key?(:'Warehouse')
96
+ self.warehouse = attributes[:'Warehouse']
97
+ end
98
+
99
+ if attributes.has_key?(:'IncludeTotalRecordCount')
100
+ self.include_total_record_count = attributes[:'IncludeTotalRecordCount']
101
+ end
102
+
103
+ if attributes.has_key?(:'Skip')
104
+ self.skip = attributes[:'Skip']
105
+ end
106
+
107
+ if attributes.has_key?(:'Top')
108
+ self.top = attributes[:'Top']
109
+ end
110
+ end
111
+
112
+ # Show invalid properties with the reasons. Usually used together with valid?
113
+ # @return Array for valid properties with the reasons
114
+ def list_invalid_properties
115
+ invalid_properties = Array.new
116
+ invalid_properties
117
+ end
118
+
119
+ # Check to see if the all the properties in the model are valid
120
+ # @return true if the model is valid
121
+ def valid?
122
+ true
123
+ end
124
+
125
+ # Checks equality by comparing each attribute.
126
+ # @param [Object] Object to be compared
127
+ def ==(o)
128
+ return true if self.equal?(o)
129
+ self.class == o.class &&
130
+ authentication == o.authentication &&
131
+ order_numbers == o.order_numbers &&
132
+ start_time == o.start_time &&
133
+ end_time == o.end_time &&
134
+ disposition_code == o.disposition_code &&
135
+ warehouse == o.warehouse &&
136
+ include_total_record_count == o.include_total_record_count &&
137
+ skip == o.skip &&
138
+ top == o.top
139
+ end
140
+
141
+ # @see the `==` method
142
+ # @param [Object] Object to be compared
143
+ def eql?(o)
144
+ self == o
145
+ end
146
+
147
+ # Calculates hash code according to all attributes.
148
+ # @return [Fixnum] Hash code
149
+ def hash
150
+ [authentication, order_numbers, start_time, end_time, disposition_code, warehouse, include_total_record_count, skip, top].hash
151
+ end
152
+
153
+ # Builds the object from hash
154
+ # @param [Hash] attributes Model attributes in the form of hash
155
+ # @return [Object] Returns the model itself
156
+ def build_from_hash(attributes)
157
+ return nil unless attributes.is_a?(Hash)
158
+ self.class.swagger_types.each_pair do |key, type|
159
+ if type =~ /\AArray<(.*)>/i
160
+ # check to ensure the input is an array given that the the attribute
161
+ # is documented as an array but the input is not
162
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
163
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
164
+ end
165
+ elsif !attributes[self.class.attribute_map[key]].nil?
166
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
167
+ end # or else data not found in attributes(hash), not an issue as the data can be optional
168
+ end
169
+
170
+ self
171
+ end
172
+
173
+ # Deserializes the data based on type
174
+ # @param string type Data type
175
+ # @param string value Value to be deserialized
176
+ # @return [Object] Deserialized data
177
+ def _deserialize(type, value)
178
+ case type.to_sym
179
+ when :DateTime
180
+ DateTime.parse(value)
181
+ when :Date
182
+ Date.parse(value)
183
+ when :String
184
+ value.to_s
185
+ when :Integer
186
+ value.to_i
187
+ when :Float
188
+ value.to_f
189
+ when :BOOLEAN
190
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
191
+ true
192
+ else
193
+ false
194
+ end
195
+ when :Object
196
+ # generic object (usually a Hash), return directly
197
+ value
198
+ when /\AArray<(?<inner_type>.+)>\z/
199
+ inner_type = Regexp.last_match[:inner_type]
200
+ value.map { |v| _deserialize(inner_type, v) }
201
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
202
+ k_type = Regexp.last_match[:k_type]
203
+ v_type = Regexp.last_match[:v_type]
204
+ {}.tap do |hash|
205
+ value.each do |k, v|
206
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
207
+ end
208
+ end
209
+ else # model
210
+ temp_model = WineShipping.const_get(type).new
211
+ temp_model.build_from_hash(value)
212
+ end
213
+ end
214
+
215
+ # Returns the string representation of the object
216
+ # @return [String] String presentation of the object
217
+ def to_s
218
+ to_hash.to_s
219
+ end
220
+
221
+ # to_body is an alias to to_hash (backward compatibility)
222
+ # @return [Hash] Returns the object in the form of hash
223
+ def to_body
224
+ to_hash
225
+ end
226
+
227
+ # Returns the object in the form of hash
228
+ # @return [Hash] Returns the object in the form of hash
229
+ def to_hash
230
+ hash = {}
231
+ self.class.attribute_map.each_pair do |attr, param|
232
+ value = self.send(attr)
233
+ next if value.nil?
234
+ hash[param] = _to_hash(value)
235
+ end
236
+ hash
237
+ end
238
+
239
+ # Outputs non-array value in the form of hash
240
+ # For object, use to_hash. Otherwise, just return the value
241
+ # @param [Object] value Any valid value
242
+ # @return [Hash] Returns the value in the form of hash
243
+ def _to_hash(value)
244
+ if value.is_a?(Array)
245
+ value.compact.map { |v| _to_hash(v) }
246
+ elsif value.is_a?(Hash)
247
+ {}.tap do |hash|
248
+ value.each { |k, v| hash[k] = _to_hash(v) }
249
+ end
250
+ elsif value.respond_to? :to_hash
251
+ value.to_hash
252
+ else
253
+ value
254
+ end
255
+ end
256
+ end
257
+ end