ultracart_api 3.4.0 → 3.4.4
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 +15 -4
- data/docs/ConfigurationApi.md +14 -14
- data/docs/IntegrationLogApi.md +51 -0
- data/docs/IntegrationLogSummary.md +16 -0
- data/docs/IntegrationLogSummaryQueryRequest.md +9 -0
- data/docs/IntegrationLogSummaryQueryResponse.md +12 -0
- data/docs/OrderChannelPartner.md +1 -0
- data/docs/OrderTrackingNumberDetail.md +2 -0
- data/docs/RotatingTransactionGatewayResponse.md +12 -0
- data/docs/RotatingTransactionGatewaysResponse.md +12 -0
- data/docs/RtgSummaryGateway.md +24 -0
- data/docs/RtgSummaryResponse.md +14 -0
- data/lib/ultracart_api.rb +7 -0
- data/lib/ultracart_api/api/configuration_api.rb +21 -21
- data/lib/ultracart_api/api/integration_log_api.rb +55 -0
- data/lib/ultracart_api/models/integration_log_summary.rb +256 -0
- data/lib/ultracart_api/models/integration_log_summary_query_request.rb +195 -0
- data/lib/ultracart_api/models/integration_log_summary_query_response.rb +223 -0
- data/lib/ultracart_api/models/order_channel_partner.rb +11 -1
- data/lib/ultracart_api/models/order_tracking_number_detail.rb +21 -1
- data/lib/ultracart_api/models/rotating_transaction_gateway_response.rb +221 -0
- data/lib/ultracart_api/models/rotating_transaction_gateways_response.rb +223 -0
- data/lib/ultracart_api/models/rtg_summary_gateway.rb +329 -0
- data/lib/ultracart_api/models/rtg_summary_response.rb +240 -0
- data/lib/ultracart_api/version.rb +1 -1
- metadata +16 -2
@@ -0,0 +1,223 @@
|
|
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 IntegrationLogSummaryQueryResponse
|
17
|
+
attr_accessor :error
|
18
|
+
|
19
|
+
attr_accessor :integration_log_summaries
|
20
|
+
|
21
|
+
attr_accessor :metadata
|
22
|
+
|
23
|
+
# Indicates if API call was successful
|
24
|
+
attr_accessor :success
|
25
|
+
|
26
|
+
attr_accessor :warning
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'error' => :'error',
|
32
|
+
:'integration_log_summaries' => :'integration_log_summaries',
|
33
|
+
:'metadata' => :'metadata',
|
34
|
+
:'success' => :'success',
|
35
|
+
:'warning' => :'warning'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Attribute type mapping.
|
40
|
+
def self.swagger_types
|
41
|
+
{
|
42
|
+
:'error' => :'Error',
|
43
|
+
:'integration_log_summaries' => :'Array<IntegrationLogSummary>',
|
44
|
+
:'metadata' => :'ResponseMetadata',
|
45
|
+
:'success' => :'BOOLEAN',
|
46
|
+
:'warning' => :'Warning'
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
# Initializes the object
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
+
def initialize(attributes = {})
|
53
|
+
return unless attributes.is_a?(Hash)
|
54
|
+
|
55
|
+
# convert string to symbol for hash key
|
56
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
57
|
+
|
58
|
+
if attributes.has_key?(:'error')
|
59
|
+
self.error = attributes[:'error']
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes.has_key?(:'integration_log_summaries')
|
63
|
+
if (value = attributes[:'integration_log_summaries']).is_a?(Array)
|
64
|
+
self.integration_log_summaries = value
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.has_key?(:'metadata')
|
69
|
+
self.metadata = attributes[:'metadata']
|
70
|
+
end
|
71
|
+
|
72
|
+
if attributes.has_key?(:'success')
|
73
|
+
self.success = attributes[:'success']
|
74
|
+
end
|
75
|
+
|
76
|
+
if attributes.has_key?(:'warning')
|
77
|
+
self.warning = attributes[:'warning']
|
78
|
+
end
|
79
|
+
end
|
80
|
+
|
81
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
82
|
+
# @return Array for valid properties with the reasons
|
83
|
+
def list_invalid_properties
|
84
|
+
invalid_properties = Array.new
|
85
|
+
invalid_properties
|
86
|
+
end
|
87
|
+
|
88
|
+
# Check to see if the all the properties in the model are valid
|
89
|
+
# @return true if the model is valid
|
90
|
+
def valid?
|
91
|
+
true
|
92
|
+
end
|
93
|
+
|
94
|
+
# Checks equality by comparing each attribute.
|
95
|
+
# @param [Object] Object to be compared
|
96
|
+
def ==(o)
|
97
|
+
return true if self.equal?(o)
|
98
|
+
self.class == o.class &&
|
99
|
+
error == o.error &&
|
100
|
+
integration_log_summaries == o.integration_log_summaries &&
|
101
|
+
metadata == o.metadata &&
|
102
|
+
success == o.success &&
|
103
|
+
warning == o.warning
|
104
|
+
end
|
105
|
+
|
106
|
+
# @see the `==` method
|
107
|
+
# @param [Object] Object to be compared
|
108
|
+
def eql?(o)
|
109
|
+
self == o
|
110
|
+
end
|
111
|
+
|
112
|
+
# Calculates hash code according to all attributes.
|
113
|
+
# @return [Fixnum] Hash code
|
114
|
+
def hash
|
115
|
+
[error, integration_log_summaries, metadata, success, warning].hash
|
116
|
+
end
|
117
|
+
|
118
|
+
# Builds the object from hash
|
119
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
120
|
+
# @return [Object] Returns the model itself
|
121
|
+
def build_from_hash(attributes)
|
122
|
+
return nil unless attributes.is_a?(Hash)
|
123
|
+
self.class.swagger_types.each_pair do |key, type|
|
124
|
+
if type =~ /\AArray<(.*)>/i
|
125
|
+
# check to ensure the input is an array given that the attribute
|
126
|
+
# is documented as an array but the input is not
|
127
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
128
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
129
|
+
end
|
130
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
131
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
132
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
133
|
+
end
|
134
|
+
|
135
|
+
self
|
136
|
+
end
|
137
|
+
|
138
|
+
# Deserializes the data based on type
|
139
|
+
# @param string type Data type
|
140
|
+
# @param string value Value to be deserialized
|
141
|
+
# @return [Object] Deserialized data
|
142
|
+
def _deserialize(type, value)
|
143
|
+
case type.to_sym
|
144
|
+
when :DateTime
|
145
|
+
DateTime.parse(value)
|
146
|
+
when :Date
|
147
|
+
Date.parse(value)
|
148
|
+
when :String
|
149
|
+
value.to_s
|
150
|
+
when :Integer
|
151
|
+
value.to_i
|
152
|
+
when :Float
|
153
|
+
value.to_f
|
154
|
+
when :BOOLEAN
|
155
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
156
|
+
true
|
157
|
+
else
|
158
|
+
false
|
159
|
+
end
|
160
|
+
when :Object
|
161
|
+
# generic object (usually a Hash), return directly
|
162
|
+
value
|
163
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
164
|
+
inner_type = Regexp.last_match[:inner_type]
|
165
|
+
value.map { |v| _deserialize(inner_type, v) }
|
166
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
167
|
+
k_type = Regexp.last_match[:k_type]
|
168
|
+
v_type = Regexp.last_match[:v_type]
|
169
|
+
{}.tap do |hash|
|
170
|
+
value.each do |k, v|
|
171
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
172
|
+
end
|
173
|
+
end
|
174
|
+
else # model
|
175
|
+
temp_model = UltracartClient.const_get(type).new
|
176
|
+
temp_model.build_from_hash(value)
|
177
|
+
end
|
178
|
+
end
|
179
|
+
|
180
|
+
# Returns the string representation of the object
|
181
|
+
# @return [String] String presentation of the object
|
182
|
+
def to_s
|
183
|
+
to_hash.to_s
|
184
|
+
end
|
185
|
+
|
186
|
+
# to_body is an alias to to_hash (backward compatibility)
|
187
|
+
# @return [Hash] Returns the object in the form of hash
|
188
|
+
def to_body
|
189
|
+
to_hash
|
190
|
+
end
|
191
|
+
|
192
|
+
# Returns the object in the form of hash
|
193
|
+
# @return [Hash] Returns the object in the form of hash
|
194
|
+
def to_hash
|
195
|
+
hash = {}
|
196
|
+
self.class.attribute_map.each_pair do |attr, param|
|
197
|
+
value = self.send(attr)
|
198
|
+
next if value.nil?
|
199
|
+
hash[param] = _to_hash(value)
|
200
|
+
end
|
201
|
+
hash
|
202
|
+
end
|
203
|
+
|
204
|
+
# Outputs non-array value in the form of hash
|
205
|
+
# For object, use to_hash. Otherwise, just return the value
|
206
|
+
# @param [Object] value Any valid value
|
207
|
+
# @return [Hash] Returns the value in the form of hash
|
208
|
+
def _to_hash(value)
|
209
|
+
if value.is_a?(Array)
|
210
|
+
value.compact.map { |v| _to_hash(v) }
|
211
|
+
elsif value.is_a?(Hash)
|
212
|
+
{}.tap do |hash|
|
213
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
214
|
+
end
|
215
|
+
elsif value.respond_to? :to_hash
|
216
|
+
value.to_hash
|
217
|
+
else
|
218
|
+
value
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
end
|
223
|
+
end
|
@@ -29,6 +29,9 @@ module UltracartClient
|
|
29
29
|
# The order ID assigned by the channel partner for this order
|
30
30
|
attr_accessor :channel_partner_order_id
|
31
31
|
|
32
|
+
# Set to true to ignore invalid shipping method being specified. Only applicable on inserting orders.
|
33
|
+
attr_accessor :ignore_invalid_shipping_method
|
34
|
+
|
32
35
|
# Indicates this order should be placed in Account Receivable for later payment processing
|
33
36
|
attr_accessor :no_realtime_payment_processing
|
34
37
|
|
@@ -52,6 +55,7 @@ module UltracartClient
|
|
52
55
|
:'channel_partner_data' => :'channel_partner_data',
|
53
56
|
:'channel_partner_oid' => :'channel_partner_oid',
|
54
57
|
:'channel_partner_order_id' => :'channel_partner_order_id',
|
58
|
+
:'ignore_invalid_shipping_method' => :'ignore_invalid_shipping_method',
|
55
59
|
:'no_realtime_payment_processing' => :'no_realtime_payment_processing',
|
56
60
|
:'skip_payment_processing' => :'skip_payment_processing',
|
57
61
|
:'store_completed' => :'store_completed',
|
@@ -68,6 +72,7 @@ module UltracartClient
|
|
68
72
|
:'channel_partner_data' => :'String',
|
69
73
|
:'channel_partner_oid' => :'Integer',
|
70
74
|
:'channel_partner_order_id' => :'String',
|
75
|
+
:'ignore_invalid_shipping_method' => :'BOOLEAN',
|
71
76
|
:'no_realtime_payment_processing' => :'BOOLEAN',
|
72
77
|
:'skip_payment_processing' => :'BOOLEAN',
|
73
78
|
:'store_completed' => :'BOOLEAN',
|
@@ -104,6 +109,10 @@ module UltracartClient
|
|
104
109
|
self.channel_partner_order_id = attributes[:'channel_partner_order_id']
|
105
110
|
end
|
106
111
|
|
112
|
+
if attributes.has_key?(:'ignore_invalid_shipping_method')
|
113
|
+
self.ignore_invalid_shipping_method = attributes[:'ignore_invalid_shipping_method']
|
114
|
+
end
|
115
|
+
|
107
116
|
if attributes.has_key?(:'no_realtime_payment_processing')
|
108
117
|
self.no_realtime_payment_processing = attributes[:'no_realtime_payment_processing']
|
109
118
|
end
|
@@ -148,6 +157,7 @@ module UltracartClient
|
|
148
157
|
channel_partner_data == o.channel_partner_data &&
|
149
158
|
channel_partner_oid == o.channel_partner_oid &&
|
150
159
|
channel_partner_order_id == o.channel_partner_order_id &&
|
160
|
+
ignore_invalid_shipping_method == o.ignore_invalid_shipping_method &&
|
151
161
|
no_realtime_payment_processing == o.no_realtime_payment_processing &&
|
152
162
|
skip_payment_processing == o.skip_payment_processing &&
|
153
163
|
store_completed == o.store_completed &&
|
@@ -164,7 +174,7 @@ module UltracartClient
|
|
164
174
|
# Calculates hash code according to all attributes.
|
165
175
|
# @return [Fixnum] Hash code
|
166
176
|
def hash
|
167
|
-
[auto_approve_purchase_order, channel_partner_code, channel_partner_data, channel_partner_oid, channel_partner_order_id, no_realtime_payment_processing, skip_payment_processing, store_completed, store_if_payment_declines, treat_warnings_as_errors].hash
|
177
|
+
[auto_approve_purchase_order, channel_partner_code, channel_partner_data, channel_partner_oid, channel_partner_order_id, ignore_invalid_shipping_method, no_realtime_payment_processing, skip_payment_processing, store_completed, store_if_payment_declines, treat_warnings_as_errors].hash
|
168
178
|
end
|
169
179
|
|
170
180
|
# Builds the object from hash
|
@@ -16,10 +16,16 @@ module UltracartClient
|
|
16
16
|
class OrderTrackingNumberDetail
|
17
17
|
attr_accessor :city
|
18
18
|
|
19
|
+
# ISO 8601 timestamp that the event occurred
|
20
|
+
attr_accessor :event_dts
|
21
|
+
|
19
22
|
attr_accessor :event_local_date
|
20
23
|
|
21
24
|
attr_accessor :event_local_time
|
22
25
|
|
26
|
+
# Timezone the event occurred in. Use this in conjunction with event_dts to format a local date/time.
|
27
|
+
attr_accessor :event_timezone_id
|
28
|
+
|
23
29
|
attr_accessor :state
|
24
30
|
|
25
31
|
attr_accessor :subtag
|
@@ -38,8 +44,10 @@ module UltracartClient
|
|
38
44
|
def self.attribute_map
|
39
45
|
{
|
40
46
|
:'city' => :'city',
|
47
|
+
:'event_dts' => :'event_dts',
|
41
48
|
:'event_local_date' => :'event_local_date',
|
42
49
|
:'event_local_time' => :'event_local_time',
|
50
|
+
:'event_timezone_id' => :'event_timezone_id',
|
43
51
|
:'state' => :'state',
|
44
52
|
:'subtag' => :'subtag',
|
45
53
|
:'subtag_message' => :'subtag_message',
|
@@ -54,8 +62,10 @@ module UltracartClient
|
|
54
62
|
def self.swagger_types
|
55
63
|
{
|
56
64
|
:'city' => :'String',
|
65
|
+
:'event_dts' => :'String',
|
57
66
|
:'event_local_date' => :'String',
|
58
67
|
:'event_local_time' => :'String',
|
68
|
+
:'event_timezone_id' => :'String',
|
59
69
|
:'state' => :'String',
|
60
70
|
:'subtag' => :'String',
|
61
71
|
:'subtag_message' => :'String',
|
@@ -78,6 +88,10 @@ module UltracartClient
|
|
78
88
|
self.city = attributes[:'city']
|
79
89
|
end
|
80
90
|
|
91
|
+
if attributes.has_key?(:'event_dts')
|
92
|
+
self.event_dts = attributes[:'event_dts']
|
93
|
+
end
|
94
|
+
|
81
95
|
if attributes.has_key?(:'event_local_date')
|
82
96
|
self.event_local_date = attributes[:'event_local_date']
|
83
97
|
end
|
@@ -86,6 +100,10 @@ module UltracartClient
|
|
86
100
|
self.event_local_time = attributes[:'event_local_time']
|
87
101
|
end
|
88
102
|
|
103
|
+
if attributes.has_key?(:'event_timezone_id')
|
104
|
+
self.event_timezone_id = attributes[:'event_timezone_id']
|
105
|
+
end
|
106
|
+
|
89
107
|
if attributes.has_key?(:'state')
|
90
108
|
self.state = attributes[:'state']
|
91
109
|
end
|
@@ -134,8 +152,10 @@ module UltracartClient
|
|
134
152
|
return true if self.equal?(o)
|
135
153
|
self.class == o.class &&
|
136
154
|
city == o.city &&
|
155
|
+
event_dts == o.event_dts &&
|
137
156
|
event_local_date == o.event_local_date &&
|
138
157
|
event_local_time == o.event_local_time &&
|
158
|
+
event_timezone_id == o.event_timezone_id &&
|
139
159
|
state == o.state &&
|
140
160
|
subtag == o.subtag &&
|
141
161
|
subtag_message == o.subtag_message &&
|
@@ -154,7 +174,7 @@ module UltracartClient
|
|
154
174
|
# Calculates hash code according to all attributes.
|
155
175
|
# @return [Fixnum] Hash code
|
156
176
|
def hash
|
157
|
-
[city, event_local_date, event_local_time, state, subtag, subtag_message, tag, tag_description, tag_icon, zip].hash
|
177
|
+
[city, event_dts, event_local_date, event_local_time, event_timezone_id, state, subtag, subtag_message, tag, tag_description, tag_icon, zip].hash
|
158
178
|
end
|
159
179
|
|
160
180
|
# Builds the object from hash
|
@@ -0,0 +1,221 @@
|
|
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 RotatingTransactionGatewayResponse
|
17
|
+
attr_accessor :error
|
18
|
+
|
19
|
+
attr_accessor :metadata
|
20
|
+
|
21
|
+
attr_accessor :rotating_gateway
|
22
|
+
|
23
|
+
# Indicates if API call was successful
|
24
|
+
attr_accessor :success
|
25
|
+
|
26
|
+
attr_accessor :warning
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'error' => :'error',
|
32
|
+
:'metadata' => :'metadata',
|
33
|
+
:'rotating_gateway' => :'rotating_gateway',
|
34
|
+
:'success' => :'success',
|
35
|
+
:'warning' => :'warning'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Attribute type mapping.
|
40
|
+
def self.swagger_types
|
41
|
+
{
|
42
|
+
:'error' => :'Error',
|
43
|
+
:'metadata' => :'ResponseMetadata',
|
44
|
+
:'rotating_gateway' => :'RotatingTransactionGateway',
|
45
|
+
:'success' => :'BOOLEAN',
|
46
|
+
:'warning' => :'Warning'
|
47
|
+
}
|
48
|
+
end
|
49
|
+
|
50
|
+
# Initializes the object
|
51
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
52
|
+
def initialize(attributes = {})
|
53
|
+
return unless attributes.is_a?(Hash)
|
54
|
+
|
55
|
+
# convert string to symbol for hash key
|
56
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
57
|
+
|
58
|
+
if attributes.has_key?(:'error')
|
59
|
+
self.error = attributes[:'error']
|
60
|
+
end
|
61
|
+
|
62
|
+
if attributes.has_key?(:'metadata')
|
63
|
+
self.metadata = attributes[:'metadata']
|
64
|
+
end
|
65
|
+
|
66
|
+
if attributes.has_key?(:'rotating_gateway')
|
67
|
+
self.rotating_gateway = attributes[:'rotating_gateway']
|
68
|
+
end
|
69
|
+
|
70
|
+
if attributes.has_key?(:'success')
|
71
|
+
self.success = attributes[:'success']
|
72
|
+
end
|
73
|
+
|
74
|
+
if attributes.has_key?(:'warning')
|
75
|
+
self.warning = attributes[:'warning']
|
76
|
+
end
|
77
|
+
end
|
78
|
+
|
79
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
80
|
+
# @return Array for valid properties with the reasons
|
81
|
+
def list_invalid_properties
|
82
|
+
invalid_properties = Array.new
|
83
|
+
invalid_properties
|
84
|
+
end
|
85
|
+
|
86
|
+
# Check to see if the all the properties in the model are valid
|
87
|
+
# @return true if the model is valid
|
88
|
+
def valid?
|
89
|
+
true
|
90
|
+
end
|
91
|
+
|
92
|
+
# Checks equality by comparing each attribute.
|
93
|
+
# @param [Object] Object to be compared
|
94
|
+
def ==(o)
|
95
|
+
return true if self.equal?(o)
|
96
|
+
self.class == o.class &&
|
97
|
+
error == o.error &&
|
98
|
+
metadata == o.metadata &&
|
99
|
+
rotating_gateway == o.rotating_gateway &&
|
100
|
+
success == o.success &&
|
101
|
+
warning == o.warning
|
102
|
+
end
|
103
|
+
|
104
|
+
# @see the `==` method
|
105
|
+
# @param [Object] Object to be compared
|
106
|
+
def eql?(o)
|
107
|
+
self == o
|
108
|
+
end
|
109
|
+
|
110
|
+
# Calculates hash code according to all attributes.
|
111
|
+
# @return [Fixnum] Hash code
|
112
|
+
def hash
|
113
|
+
[error, metadata, rotating_gateway, success, warning].hash
|
114
|
+
end
|
115
|
+
|
116
|
+
# Builds the object from hash
|
117
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
118
|
+
# @return [Object] Returns the model itself
|
119
|
+
def build_from_hash(attributes)
|
120
|
+
return nil unless attributes.is_a?(Hash)
|
121
|
+
self.class.swagger_types.each_pair do |key, type|
|
122
|
+
if type =~ /\AArray<(.*)>/i
|
123
|
+
# check to ensure the input is an array given that the attribute
|
124
|
+
# is documented as an array but the input is not
|
125
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
126
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
127
|
+
end
|
128
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
129
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
130
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
131
|
+
end
|
132
|
+
|
133
|
+
self
|
134
|
+
end
|
135
|
+
|
136
|
+
# Deserializes the data based on type
|
137
|
+
# @param string type Data type
|
138
|
+
# @param string value Value to be deserialized
|
139
|
+
# @return [Object] Deserialized data
|
140
|
+
def _deserialize(type, value)
|
141
|
+
case type.to_sym
|
142
|
+
when :DateTime
|
143
|
+
DateTime.parse(value)
|
144
|
+
when :Date
|
145
|
+
Date.parse(value)
|
146
|
+
when :String
|
147
|
+
value.to_s
|
148
|
+
when :Integer
|
149
|
+
value.to_i
|
150
|
+
when :Float
|
151
|
+
value.to_f
|
152
|
+
when :BOOLEAN
|
153
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
154
|
+
true
|
155
|
+
else
|
156
|
+
false
|
157
|
+
end
|
158
|
+
when :Object
|
159
|
+
# generic object (usually a Hash), return directly
|
160
|
+
value
|
161
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
162
|
+
inner_type = Regexp.last_match[:inner_type]
|
163
|
+
value.map { |v| _deserialize(inner_type, v) }
|
164
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
165
|
+
k_type = Regexp.last_match[:k_type]
|
166
|
+
v_type = Regexp.last_match[:v_type]
|
167
|
+
{}.tap do |hash|
|
168
|
+
value.each do |k, v|
|
169
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
170
|
+
end
|
171
|
+
end
|
172
|
+
else # model
|
173
|
+
temp_model = UltracartClient.const_get(type).new
|
174
|
+
temp_model.build_from_hash(value)
|
175
|
+
end
|
176
|
+
end
|
177
|
+
|
178
|
+
# Returns the string representation of the object
|
179
|
+
# @return [String] String presentation of the object
|
180
|
+
def to_s
|
181
|
+
to_hash.to_s
|
182
|
+
end
|
183
|
+
|
184
|
+
# to_body is an alias to to_hash (backward compatibility)
|
185
|
+
# @return [Hash] Returns the object in the form of hash
|
186
|
+
def to_body
|
187
|
+
to_hash
|
188
|
+
end
|
189
|
+
|
190
|
+
# Returns the object in the form of hash
|
191
|
+
# @return [Hash] Returns the object in the form of hash
|
192
|
+
def to_hash
|
193
|
+
hash = {}
|
194
|
+
self.class.attribute_map.each_pair do |attr, param|
|
195
|
+
value = self.send(attr)
|
196
|
+
next if value.nil?
|
197
|
+
hash[param] = _to_hash(value)
|
198
|
+
end
|
199
|
+
hash
|
200
|
+
end
|
201
|
+
|
202
|
+
# Outputs non-array value in the form of hash
|
203
|
+
# For object, use to_hash. Otherwise, just return the value
|
204
|
+
# @param [Object] value Any valid value
|
205
|
+
# @return [Hash] Returns the value in the form of hash
|
206
|
+
def _to_hash(value)
|
207
|
+
if value.is_a?(Array)
|
208
|
+
value.compact.map { |v| _to_hash(v) }
|
209
|
+
elsif value.is_a?(Hash)
|
210
|
+
{}.tap do |hash|
|
211
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
212
|
+
end
|
213
|
+
elsif value.respond_to? :to_hash
|
214
|
+
value.to_hash
|
215
|
+
else
|
216
|
+
value
|
217
|
+
end
|
218
|
+
end
|
219
|
+
|
220
|
+
end
|
221
|
+
end
|