ultracart_api 3.9.8 → 3.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +20 -4
- data/docs/CartSettingsShippingEstimate.md +1 -0
- data/docs/ChannelPartnerApi.md +212 -0
- data/docs/ChannelPartnerCancelResponse.md +12 -0
- data/docs/ChannelPartnerEstimateShippingResponse.md +12 -0
- data/docs/ChannelPartnerImportResponse.md +13 -0
- data/docs/ChannelPartnerOrder.md +87 -0
- data/docs/ChannelPartnerOrderItem.md +14 -0
- data/docs/ChannelPartnerOrderItemOption.md +9 -0
- data/docs/ChannelPartnerOrderTransaction.md +9 -0
- data/docs/ChannelPartnerOrderTransactionDetail.md +9 -0
- data/docs/ChannelPartnerShippingEstimate.md +9 -0
- data/lib/ultracart_api/api/channel_partner_api.rb +256 -0
- data/lib/ultracart_api/models/cart_settings_shipping_estimate.rb +11 -1
- data/lib/ultracart_api/models/channel_partner_cancel_response.rb +224 -0
- data/lib/ultracart_api/models/channel_partner_estimate_shipping_response.rb +224 -0
- data/lib/ultracart_api/models/channel_partner_import_response.rb +236 -0
- data/lib/ultracart_api/models/channel_partner_order.rb +1569 -0
- data/lib/ultracart_api/models/channel_partner_order_item.rb +296 -0
- data/lib/ultracart_api/models/channel_partner_order_item_option.rb +195 -0
- data/lib/ultracart_api/models/channel_partner_order_transaction.rb +197 -0
- data/lib/ultracart_api/models/channel_partner_order_transaction_detail.rb +195 -0
- data/lib/ultracart_api/models/channel_partner_shipping_estimate.rb +195 -0
- data/lib/ultracart_api/version.rb +1 -1
- data/lib/ultracart_api.rb +10 -0
- metadata +22 -2
@@ -0,0 +1,256 @@
|
|
1
|
+
=begin
|
2
|
+
#UltraCart Rest API V2
|
3
|
+
|
4
|
+
#UltraCart REST API Version 2
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0.0
|
7
|
+
Contact: support@ultracart.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.15-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'addressable/uri'
|
14
|
+
|
15
|
+
module UltracartClient
|
16
|
+
class ChannelPartnerApi
|
17
|
+
attr_accessor :api_client
|
18
|
+
|
19
|
+
def initialize(api_client = ApiClient.default)
|
20
|
+
@api_client = api_client
|
21
|
+
end
|
22
|
+
|
23
|
+
def self.new_using_api_key(simple_key, verify_ssl = true, debugging = false)
|
24
|
+
api_config = Configuration.new
|
25
|
+
api_config.api_key_prefix['x-ultracart-simple-key'] = simple_key
|
26
|
+
api_config.api_version = '2017-03-01'
|
27
|
+
api_config.verify_ssl = verify_ssl
|
28
|
+
|
29
|
+
api_client = ApiClient.new(api_config)
|
30
|
+
api_client.config.debugging = debugging
|
31
|
+
|
32
|
+
UltracartClient::ChannelPartnerApi.new(api_client)
|
33
|
+
end
|
34
|
+
|
35
|
+
# Cancel channel partner order by channel partner order id
|
36
|
+
# Cancel channel partner order by channel partner order id
|
37
|
+
# @param order_id The channel partner order id to delete.
|
38
|
+
# @param [Hash] opts the optional parameters
|
39
|
+
# @return [ChannelPartnerCancelResponse]
|
40
|
+
def cancel_order_by_channel_partner_order_id(order_id, opts = {})
|
41
|
+
data, _status_code, _headers = cancel_order_by_channel_partner_order_id_with_http_info(order_id, opts)
|
42
|
+
data
|
43
|
+
end
|
44
|
+
|
45
|
+
# Cancel channel partner order by channel partner order id
|
46
|
+
# Cancel channel partner order by channel partner order id
|
47
|
+
# @param order_id The channel partner order id to delete.
|
48
|
+
# @param [Hash] opts the optional parameters
|
49
|
+
# @return [Array<(ChannelPartnerCancelResponse, Fixnum, Hash)>] ChannelPartnerCancelResponse data, response status code and response headers
|
50
|
+
def cancel_order_by_channel_partner_order_id_with_http_info(order_id, opts = {})
|
51
|
+
if @api_client.config.debugging
|
52
|
+
@api_client.config.logger.debug 'Calling API: ChannelPartnerApi.cancel_order_by_channel_partner_order_id ...'
|
53
|
+
end
|
54
|
+
# verify the required parameter 'order_id' is set
|
55
|
+
if @api_client.config.client_side_validation && order_id.nil?
|
56
|
+
fail ArgumentError, "Missing the required parameter 'order_id' when calling ChannelPartnerApi.cancel_order_by_channel_partner_order_id"
|
57
|
+
end
|
58
|
+
# resource path
|
59
|
+
local_var_path = '/channel_partner/cancel/by_channel_partner_order_id/{order_id}'.sub('{' + 'order_id' + '}', order_id.to_s)
|
60
|
+
|
61
|
+
# query parameters
|
62
|
+
query_params = {}
|
63
|
+
|
64
|
+
# header parameters
|
65
|
+
header_params = {}
|
66
|
+
header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
|
67
|
+
# HTTP header 'Accept' (if needed)
|
68
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
69
|
+
# HTTP header 'Content-Type'
|
70
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
|
71
|
+
|
72
|
+
# form parameters
|
73
|
+
form_params = {}
|
74
|
+
|
75
|
+
# http body (model)
|
76
|
+
post_body = nil
|
77
|
+
auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
|
78
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
|
79
|
+
:header_params => header_params,
|
80
|
+
:query_params => query_params,
|
81
|
+
:form_params => form_params,
|
82
|
+
:body => post_body,
|
83
|
+
:auth_names => auth_names,
|
84
|
+
:return_type => 'ChannelPartnerCancelResponse')
|
85
|
+
if @api_client.config.debugging
|
86
|
+
@api_client.config.logger.debug "API called: ChannelPartnerApi#cancel_order_by_channel_partner_order_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
87
|
+
end
|
88
|
+
return data, status_code, headers
|
89
|
+
end
|
90
|
+
# Cancel channel partner order by UltraCart order id
|
91
|
+
# Cancel channel partner order by UltraCart order id
|
92
|
+
# @param order_id The UltraCart order id to delete.
|
93
|
+
# @param [Hash] opts the optional parameters
|
94
|
+
# @return [ChannelPartnerCancelResponse]
|
95
|
+
def cancel_order_by_channel_ultra_cart_order_id(order_id, opts = {})
|
96
|
+
data, _status_code, _headers = cancel_order_by_channel_ultra_cart_order_id_with_http_info(order_id, opts)
|
97
|
+
data
|
98
|
+
end
|
99
|
+
|
100
|
+
# Cancel channel partner order by UltraCart order id
|
101
|
+
# Cancel channel partner order by UltraCart order id
|
102
|
+
# @param order_id The UltraCart order id to delete.
|
103
|
+
# @param [Hash] opts the optional parameters
|
104
|
+
# @return [Array<(ChannelPartnerCancelResponse, Fixnum, Hash)>] ChannelPartnerCancelResponse data, response status code and response headers
|
105
|
+
def cancel_order_by_channel_ultra_cart_order_id_with_http_info(order_id, opts = {})
|
106
|
+
if @api_client.config.debugging
|
107
|
+
@api_client.config.logger.debug 'Calling API: ChannelPartnerApi.cancel_order_by_channel_ultra_cart_order_id ...'
|
108
|
+
end
|
109
|
+
# verify the required parameter 'order_id' is set
|
110
|
+
if @api_client.config.client_side_validation && order_id.nil?
|
111
|
+
fail ArgumentError, "Missing the required parameter 'order_id' when calling ChannelPartnerApi.cancel_order_by_channel_ultra_cart_order_id"
|
112
|
+
end
|
113
|
+
# resource path
|
114
|
+
local_var_path = '/channel_partner/cancel/by_ultracart_order_id/{order_id}'.sub('{' + 'order_id' + '}', order_id.to_s)
|
115
|
+
|
116
|
+
# query parameters
|
117
|
+
query_params = {}
|
118
|
+
|
119
|
+
# header parameters
|
120
|
+
header_params = {}
|
121
|
+
header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
|
122
|
+
# HTTP header 'Accept' (if needed)
|
123
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
124
|
+
# HTTP header 'Content-Type'
|
125
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
|
126
|
+
|
127
|
+
# form parameters
|
128
|
+
form_params = {}
|
129
|
+
|
130
|
+
# http body (model)
|
131
|
+
post_body = nil
|
132
|
+
auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
|
133
|
+
data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,
|
134
|
+
:header_params => header_params,
|
135
|
+
:query_params => query_params,
|
136
|
+
:form_params => form_params,
|
137
|
+
:body => post_body,
|
138
|
+
:auth_names => auth_names,
|
139
|
+
:return_type => 'ChannelPartnerCancelResponse')
|
140
|
+
if @api_client.config.debugging
|
141
|
+
@api_client.config.logger.debug "API called: ChannelPartnerApi#cancel_order_by_channel_ultra_cart_order_id\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
142
|
+
end
|
143
|
+
return data, status_code, headers
|
144
|
+
end
|
145
|
+
# Estimate shipping for channel partner order
|
146
|
+
# Estimate shipping for order from a channel partner.
|
147
|
+
# @param channel_partner_order Order needing shipping estimate
|
148
|
+
# @param [Hash] opts the optional parameters
|
149
|
+
# @return [ChannelPartnerEstimateShippingResponse]
|
150
|
+
def estimate_shipping_for_channel_partner_order(channel_partner_order, opts = {})
|
151
|
+
data, _status_code, _headers = estimate_shipping_for_channel_partner_order_with_http_info(channel_partner_order, opts)
|
152
|
+
data
|
153
|
+
end
|
154
|
+
|
155
|
+
# Estimate shipping for channel partner order
|
156
|
+
# Estimate shipping for order from a channel partner.
|
157
|
+
# @param channel_partner_order Order needing shipping estimate
|
158
|
+
# @param [Hash] opts the optional parameters
|
159
|
+
# @return [Array<(ChannelPartnerEstimateShippingResponse, Fixnum, Hash)>] ChannelPartnerEstimateShippingResponse data, response status code and response headers
|
160
|
+
def estimate_shipping_for_channel_partner_order_with_http_info(channel_partner_order, opts = {})
|
161
|
+
if @api_client.config.debugging
|
162
|
+
@api_client.config.logger.debug 'Calling API: ChannelPartnerApi.estimate_shipping_for_channel_partner_order ...'
|
163
|
+
end
|
164
|
+
# verify the required parameter 'channel_partner_order' is set
|
165
|
+
if @api_client.config.client_side_validation && channel_partner_order.nil?
|
166
|
+
fail ArgumentError, "Missing the required parameter 'channel_partner_order' when calling ChannelPartnerApi.estimate_shipping_for_channel_partner_order"
|
167
|
+
end
|
168
|
+
# resource path
|
169
|
+
local_var_path = '/channel_partner/estimate_shipping'
|
170
|
+
|
171
|
+
# query parameters
|
172
|
+
query_params = {}
|
173
|
+
|
174
|
+
# header parameters
|
175
|
+
header_params = {}
|
176
|
+
header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
|
177
|
+
# HTTP header 'Accept' (if needed)
|
178
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
179
|
+
# HTTP header 'Content-Type'
|
180
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
|
181
|
+
|
182
|
+
# form parameters
|
183
|
+
form_params = {}
|
184
|
+
|
185
|
+
# http body (model)
|
186
|
+
post_body = @api_client.object_to_http_body(channel_partner_order)
|
187
|
+
auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
|
188
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
189
|
+
:header_params => header_params,
|
190
|
+
:query_params => query_params,
|
191
|
+
:form_params => form_params,
|
192
|
+
:body => post_body,
|
193
|
+
:auth_names => auth_names,
|
194
|
+
:return_type => 'ChannelPartnerEstimateShippingResponse')
|
195
|
+
if @api_client.config.debugging
|
196
|
+
@api_client.config.logger.debug "API called: ChannelPartnerApi#estimate_shipping_for_channel_partner_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
197
|
+
end
|
198
|
+
return data, status_code, headers
|
199
|
+
end
|
200
|
+
# Insert channel partner order
|
201
|
+
# Insert order from a channel partner.
|
202
|
+
# @param channel_partner_order Order to insert
|
203
|
+
# @param [Hash] opts the optional parameters
|
204
|
+
# @return [ChannelPartnerImportResponse]
|
205
|
+
def import_channel_partner_order(channel_partner_order, opts = {})
|
206
|
+
data, _status_code, _headers = import_channel_partner_order_with_http_info(channel_partner_order, opts)
|
207
|
+
data
|
208
|
+
end
|
209
|
+
|
210
|
+
# Insert channel partner order
|
211
|
+
# Insert order from a channel partner.
|
212
|
+
# @param channel_partner_order Order to insert
|
213
|
+
# @param [Hash] opts the optional parameters
|
214
|
+
# @return [Array<(ChannelPartnerImportResponse, Fixnum, Hash)>] ChannelPartnerImportResponse data, response status code and response headers
|
215
|
+
def import_channel_partner_order_with_http_info(channel_partner_order, opts = {})
|
216
|
+
if @api_client.config.debugging
|
217
|
+
@api_client.config.logger.debug 'Calling API: ChannelPartnerApi.import_channel_partner_order ...'
|
218
|
+
end
|
219
|
+
# verify the required parameter 'channel_partner_order' is set
|
220
|
+
if @api_client.config.client_side_validation && channel_partner_order.nil?
|
221
|
+
fail ArgumentError, "Missing the required parameter 'channel_partner_order' when calling ChannelPartnerApi.import_channel_partner_order"
|
222
|
+
end
|
223
|
+
# resource path
|
224
|
+
local_var_path = '/channel_partner/import'
|
225
|
+
|
226
|
+
# query parameters
|
227
|
+
query_params = {}
|
228
|
+
|
229
|
+
# header parameters
|
230
|
+
header_params = {}
|
231
|
+
header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
|
232
|
+
# HTTP header 'Accept' (if needed)
|
233
|
+
header_params['Accept'] = @api_client.select_header_accept(['application/json'])
|
234
|
+
# HTTP header 'Content-Type'
|
235
|
+
header_params['Content-Type'] = @api_client.select_header_content_type(['application/json; charset=UTF-8'])
|
236
|
+
|
237
|
+
# form parameters
|
238
|
+
form_params = {}
|
239
|
+
|
240
|
+
# http body (model)
|
241
|
+
post_body = @api_client.object_to_http_body(channel_partner_order)
|
242
|
+
auth_names = ['ultraCartOauth', 'ultraCartSimpleApiKey']
|
243
|
+
data, status_code, headers = @api_client.call_api(:POST, local_var_path,
|
244
|
+
:header_params => header_params,
|
245
|
+
:query_params => query_params,
|
246
|
+
:form_params => form_params,
|
247
|
+
:body => post_body,
|
248
|
+
:auth_names => auth_names,
|
249
|
+
:return_type => 'ChannelPartnerImportResponse')
|
250
|
+
if @api_client.config.debugging
|
251
|
+
@api_client.config.logger.debug "API called: ChannelPartnerApi#import_channel_partner_order\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
|
252
|
+
end
|
253
|
+
return data, status_code, headers
|
254
|
+
end
|
255
|
+
end
|
256
|
+
end
|
@@ -44,6 +44,9 @@ module UltracartClient
|
|
44
44
|
# Shipping method name
|
45
45
|
attr_accessor :name
|
46
46
|
|
47
|
+
# True if this shipping method requires customers to physically pickup product themselves
|
48
|
+
attr_accessor :pickup
|
49
|
+
|
47
50
|
attr_accessor :tax
|
48
51
|
|
49
52
|
attr_accessor :total_tax
|
@@ -62,6 +65,7 @@ module UltracartClient
|
|
62
65
|
:'estimated_delivery' => :'estimated_delivery',
|
63
66
|
:'lift_gate_option' => :'lift_gate_option',
|
64
67
|
:'name' => :'name',
|
68
|
+
:'pickup' => :'pickup',
|
65
69
|
:'tax' => :'tax',
|
66
70
|
:'total_tax' => :'total_tax'
|
67
71
|
}
|
@@ -81,6 +85,7 @@ module UltracartClient
|
|
81
85
|
:'estimated_delivery' => :'String',
|
82
86
|
:'lift_gate_option' => :'BOOLEAN',
|
83
87
|
:'name' => :'String',
|
88
|
+
:'pickup' => :'BOOLEAN',
|
84
89
|
:'tax' => :'Currency',
|
85
90
|
:'total_tax' => :'Currency'
|
86
91
|
}
|
@@ -138,6 +143,10 @@ module UltracartClient
|
|
138
143
|
self.name = attributes[:'name']
|
139
144
|
end
|
140
145
|
|
146
|
+
if attributes.has_key?(:'pickup')
|
147
|
+
self.pickup = attributes[:'pickup']
|
148
|
+
end
|
149
|
+
|
141
150
|
if attributes.has_key?(:'tax')
|
142
151
|
self.tax = attributes[:'tax']
|
143
152
|
end
|
@@ -176,6 +185,7 @@ module UltracartClient
|
|
176
185
|
estimated_delivery == o.estimated_delivery &&
|
177
186
|
lift_gate_option == o.lift_gate_option &&
|
178
187
|
name == o.name &&
|
188
|
+
pickup == o.pickup &&
|
179
189
|
tax == o.tax &&
|
180
190
|
total_tax == o.total_tax
|
181
191
|
end
|
@@ -189,7 +199,7 @@ module UltracartClient
|
|
189
199
|
# Calculates hash code according to all attributes.
|
190
200
|
# @return [Fixnum] Hash code
|
191
201
|
def hash
|
192
|
-
[allow_3rd_party_billing, comment, cost, cost_before_discount, default_method, discount, discounted, display_name, estimated_delivery, lift_gate_option, name, tax, total_tax].hash
|
202
|
+
[allow_3rd_party_billing, comment, cost, cost_before_discount, default_method, discount, discounted, display_name, estimated_delivery, lift_gate_option, name, pickup, tax, total_tax].hash
|
193
203
|
end
|
194
204
|
|
195
205
|
# Builds the object from hash
|
@@ -0,0 +1,224 @@
|
|
1
|
+
=begin
|
2
|
+
#UltraCart Rest API V2
|
3
|
+
|
4
|
+
#UltraCart REST API Version 2
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0.0
|
7
|
+
Contact: support@ultracart.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.15-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module UltracartClient
|
16
|
+
class ChannelPartnerCancelResponse
|
17
|
+
# Array of errors if errors occurred
|
18
|
+
attr_accessor :cancel_errors
|
19
|
+
|
20
|
+
attr_accessor :error
|
21
|
+
|
22
|
+
attr_accessor :metadata
|
23
|
+
|
24
|
+
# Indicates if API call was successful
|
25
|
+
attr_accessor :success
|
26
|
+
|
27
|
+
attr_accessor :warning
|
28
|
+
|
29
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
30
|
+
def self.attribute_map
|
31
|
+
{
|
32
|
+
:'cancel_errors' => :'cancel_errors',
|
33
|
+
:'error' => :'error',
|
34
|
+
:'metadata' => :'metadata',
|
35
|
+
:'success' => :'success',
|
36
|
+
:'warning' => :'warning'
|
37
|
+
}
|
38
|
+
end
|
39
|
+
|
40
|
+
# Attribute type mapping.
|
41
|
+
def self.swagger_types
|
42
|
+
{
|
43
|
+
:'cancel_errors' => :'Array<String>',
|
44
|
+
:'error' => :'Error',
|
45
|
+
:'metadata' => :'ResponseMetadata',
|
46
|
+
:'success' => :'BOOLEAN',
|
47
|
+
:'warning' => :'Warning'
|
48
|
+
}
|
49
|
+
end
|
50
|
+
|
51
|
+
# Initializes the object
|
52
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
53
|
+
def initialize(attributes = {})
|
54
|
+
return unless attributes.is_a?(Hash)
|
55
|
+
|
56
|
+
# convert string to symbol for hash key
|
57
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
58
|
+
|
59
|
+
if attributes.has_key?(:'cancel_errors')
|
60
|
+
if (value = attributes[:'cancel_errors']).is_a?(Array)
|
61
|
+
self.cancel_errors = value
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
if attributes.has_key?(:'error')
|
66
|
+
self.error = attributes[:'error']
|
67
|
+
end
|
68
|
+
|
69
|
+
if attributes.has_key?(:'metadata')
|
70
|
+
self.metadata = attributes[:'metadata']
|
71
|
+
end
|
72
|
+
|
73
|
+
if attributes.has_key?(:'success')
|
74
|
+
self.success = attributes[:'success']
|
75
|
+
end
|
76
|
+
|
77
|
+
if attributes.has_key?(:'warning')
|
78
|
+
self.warning = attributes[:'warning']
|
79
|
+
end
|
80
|
+
end
|
81
|
+
|
82
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
83
|
+
# @return Array for valid properties with the reasons
|
84
|
+
def list_invalid_properties
|
85
|
+
invalid_properties = Array.new
|
86
|
+
invalid_properties
|
87
|
+
end
|
88
|
+
|
89
|
+
# Check to see if the all the properties in the model are valid
|
90
|
+
# @return true if the model is valid
|
91
|
+
def valid?
|
92
|
+
true
|
93
|
+
end
|
94
|
+
|
95
|
+
# Checks equality by comparing each attribute.
|
96
|
+
# @param [Object] Object to be compared
|
97
|
+
def ==(o)
|
98
|
+
return true if self.equal?(o)
|
99
|
+
self.class == o.class &&
|
100
|
+
cancel_errors == o.cancel_errors &&
|
101
|
+
error == o.error &&
|
102
|
+
metadata == o.metadata &&
|
103
|
+
success == o.success &&
|
104
|
+
warning == o.warning
|
105
|
+
end
|
106
|
+
|
107
|
+
# @see the `==` method
|
108
|
+
# @param [Object] Object to be compared
|
109
|
+
def eql?(o)
|
110
|
+
self == o
|
111
|
+
end
|
112
|
+
|
113
|
+
# Calculates hash code according to all attributes.
|
114
|
+
# @return [Fixnum] Hash code
|
115
|
+
def hash
|
116
|
+
[cancel_errors, error, metadata, success, warning].hash
|
117
|
+
end
|
118
|
+
|
119
|
+
# Builds the object from hash
|
120
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
121
|
+
# @return [Object] Returns the model itself
|
122
|
+
def build_from_hash(attributes)
|
123
|
+
return nil unless attributes.is_a?(Hash)
|
124
|
+
self.class.swagger_types.each_pair do |key, type|
|
125
|
+
if type =~ /\AArray<(.*)>/i
|
126
|
+
# check to ensure the input is an array given that the attribute
|
127
|
+
# is documented as an array but the input is not
|
128
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
129
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
130
|
+
end
|
131
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
132
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
133
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
134
|
+
end
|
135
|
+
|
136
|
+
self
|
137
|
+
end
|
138
|
+
|
139
|
+
# Deserializes the data based on type
|
140
|
+
# @param string type Data type
|
141
|
+
# @param string value Value to be deserialized
|
142
|
+
# @return [Object] Deserialized data
|
143
|
+
def _deserialize(type, value)
|
144
|
+
case type.to_sym
|
145
|
+
when :DateTime
|
146
|
+
DateTime.parse(value)
|
147
|
+
when :Date
|
148
|
+
Date.parse(value)
|
149
|
+
when :String
|
150
|
+
value.to_s
|
151
|
+
when :Integer
|
152
|
+
value.to_i
|
153
|
+
when :Float
|
154
|
+
value.to_f
|
155
|
+
when :BOOLEAN
|
156
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
157
|
+
true
|
158
|
+
else
|
159
|
+
false
|
160
|
+
end
|
161
|
+
when :Object
|
162
|
+
# generic object (usually a Hash), return directly
|
163
|
+
value
|
164
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
165
|
+
inner_type = Regexp.last_match[:inner_type]
|
166
|
+
value.map { |v| _deserialize(inner_type, v) }
|
167
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
168
|
+
k_type = Regexp.last_match[:k_type]
|
169
|
+
v_type = Regexp.last_match[:v_type]
|
170
|
+
{}.tap do |hash|
|
171
|
+
value.each do |k, v|
|
172
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
else # model
|
176
|
+
temp_model = UltracartClient.const_get(type).new
|
177
|
+
temp_model.build_from_hash(value)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
|
181
|
+
# Returns the string representation of the object
|
182
|
+
# @return [String] String presentation of the object
|
183
|
+
def to_s
|
184
|
+
to_hash.to_s
|
185
|
+
end
|
186
|
+
|
187
|
+
# to_body is an alias to to_hash (backward compatibility)
|
188
|
+
# @return [Hash] Returns the object in the form of hash
|
189
|
+
def to_body
|
190
|
+
to_hash
|
191
|
+
end
|
192
|
+
|
193
|
+
# Returns the object in the form of hash
|
194
|
+
# @return [Hash] Returns the object in the form of hash
|
195
|
+
def to_hash
|
196
|
+
hash = {}
|
197
|
+
self.class.attribute_map.each_pair do |attr, param|
|
198
|
+
value = self.send(attr)
|
199
|
+
next if value.nil?
|
200
|
+
hash[param] = _to_hash(value)
|
201
|
+
end
|
202
|
+
hash
|
203
|
+
end
|
204
|
+
|
205
|
+
# Outputs non-array value in the form of hash
|
206
|
+
# For object, use to_hash. Otherwise, just return the value
|
207
|
+
# @param [Object] value Any valid value
|
208
|
+
# @return [Hash] Returns the value in the form of hash
|
209
|
+
def _to_hash(value)
|
210
|
+
if value.is_a?(Array)
|
211
|
+
value.compact.map { |v| _to_hash(v) }
|
212
|
+
elsif value.is_a?(Hash)
|
213
|
+
{}.tap do |hash|
|
214
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
215
|
+
end
|
216
|
+
elsif value.respond_to? :to_hash
|
217
|
+
value.to_hash
|
218
|
+
else
|
219
|
+
value
|
220
|
+
end
|
221
|
+
end
|
222
|
+
|
223
|
+
end
|
224
|
+
end
|