ultracart_api 3.11.14 → 3.11.16
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 +27 -5
- data/docs/CartUpsellAfter.md +3 -1
- data/docs/ConversationVirtualAgentCapabilities.md +2 -0
- data/docs/CustomReport.md +17 -0
- data/docs/CustomReportAccountConfig.md +16 -0
- data/docs/CustomReportAccountConfigResponse.md +12 -0
- data/docs/CustomReportExecutionParameter.md +10 -0
- data/docs/CustomReportExecutionRequest.md +8 -0
- data/docs/CustomReportParameter.md +13 -0
- data/docs/CustomReportParameterOption.md +9 -0
- data/docs/CustomReportQuery.md +13 -0
- data/docs/CustomReportResponse.md +12 -0
- data/docs/CustomReportTooltip.md +9 -0
- data/docs/CustomReportsResponse.md +12 -0
- data/docs/DatawarehouseApi.md +403 -0
- data/docs/Item.md +1 -1
- data/docs/OrderApi.md +98 -65
- data/docs/WebhookApi.md +0 -16
- data/lib/ultracart_api/api/datawarehouse_api.rb +439 -0
- data/lib/ultracart_api/api/order_api.rb +111 -82
- data/lib/ultracart_api/api/webhook_api.rb +0 -24
- data/lib/ultracart_api/models/cart_upsell_after.rb +25 -5
- data/lib/ultracart_api/models/conversation_virtual_agent_capabilities.rb +55 -1
- data/lib/ultracart_api/models/custom_report.rb +271 -0
- data/lib/ultracart_api/models/custom_report_account_config.rb +261 -0
- data/lib/ultracart_api/models/custom_report_account_config_response.rb +221 -0
- data/lib/ultracart_api/models/custom_report_execution_parameter.rb +202 -0
- data/lib/ultracart_api/models/custom_report_execution_request.rb +186 -0
- data/lib/ultracart_api/models/custom_report_parameter.rb +231 -0
- data/lib/ultracart_api/models/custom_report_parameter_option.rb +193 -0
- data/lib/ultracart_api/models/custom_report_query.rb +231 -0
- data/lib/ultracart_api/models/custom_report_response.rb +221 -0
- data/lib/ultracart_api/models/custom_report_tooltip.rb +193 -0
- data/lib/ultracart_api/models/custom_reports_response.rb +224 -0
- data/lib/ultracart_api/models/item.rb +1 -1
- data/lib/ultracart_api/version.rb +1 -1
- data/lib/ultracart_api.rb +11 -0
- metadata +24 -2
@@ -206,14 +206,6 @@ module UltracartClient
|
|
206
206
|
# Retrieves the log summary information for a given webhook. This is useful for displaying all the various logs that can be viewed.
|
207
207
|
# @param webhook_oid The webhook oid to retrieve log summaries for.
|
208
208
|
# @param [Hash] opts the optional parameters
|
209
|
-
# @option opts [String] :request_id
|
210
|
-
# @option opts [String] :begin_date
|
211
|
-
# @option opts [String] :end_date
|
212
|
-
# @option opts [String] :status
|
213
|
-
# @option opts [String] :event
|
214
|
-
# @option opts [String] :order_id
|
215
|
-
# @option opts [String] :request
|
216
|
-
# @option opts [Integer] :duration
|
217
209
|
# @option opts [Integer] :_limit The maximum number of records to return on this one API call. (default to 100)
|
218
210
|
# @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index. (default to 0)
|
219
211
|
# @option opts [String] :_since Fetch log summaries that have been delivered since this date/time.
|
@@ -227,14 +219,6 @@ module UltracartClient
|
|
227
219
|
# Retrieves the log summary information for a given webhook. This is useful for displaying all the various logs that can be viewed.
|
228
220
|
# @param webhook_oid The webhook oid to retrieve log summaries for.
|
229
221
|
# @param [Hash] opts the optional parameters
|
230
|
-
# @option opts [String] :request_id
|
231
|
-
# @option opts [String] :begin_date
|
232
|
-
# @option opts [String] :end_date
|
233
|
-
# @option opts [String] :status
|
234
|
-
# @option opts [String] :event
|
235
|
-
# @option opts [String] :order_id
|
236
|
-
# @option opts [String] :request
|
237
|
-
# @option opts [Integer] :duration
|
238
222
|
# @option opts [Integer] :_limit The maximum number of records to return on this one API call.
|
239
223
|
# @option opts [Integer] :_offset Pagination of the record set. Offset is a zero based index.
|
240
224
|
# @option opts [String] :_since Fetch log summaries that have been delivered since this date/time.
|
@@ -252,14 +236,6 @@ module UltracartClient
|
|
252
236
|
|
253
237
|
# query parameters
|
254
238
|
query_params = {}
|
255
|
-
query_params[:'requestId'] = opts[:'request_id'] if !opts[:'request_id'].nil?
|
256
|
-
query_params[:'beginDate'] = opts[:'begin_date'] if !opts[:'begin_date'].nil?
|
257
|
-
query_params[:'endDate'] = opts[:'end_date'] if !opts[:'end_date'].nil?
|
258
|
-
query_params[:'status'] = opts[:'status'] if !opts[:'status'].nil?
|
259
|
-
query_params[:'event'] = opts[:'event'] if !opts[:'event'].nil?
|
260
|
-
query_params[:'orderId'] = opts[:'order_id'] if !opts[:'order_id'].nil?
|
261
|
-
query_params[:'request'] = opts[:'request'] if !opts[:'request'].nil?
|
262
|
-
query_params[:'duration'] = opts[:'duration'] if !opts[:'duration'].nil?
|
263
239
|
query_params[:'_limit'] = opts[:'_limit'] if !opts[:'_limit'].nil?
|
264
240
|
query_params[:'_offset'] = opts[:'_offset'] if !opts[:'_offset'].nil?
|
265
241
|
query_params[:'_since'] = opts[:'_since'] if !opts[:'_since'].nil?
|
@@ -20,15 +20,23 @@ module UltracartClient
|
|
20
20
|
# The amount of inactivity in minutes after which the cart should be finalized into an order. This will calculate the finalize_after_dts field.
|
21
21
|
attr_accessor :finalize_after_minutes
|
22
22
|
|
23
|
-
# Upsell path code
|
23
|
+
# Upsell path code (this is for legacy upsells only)
|
24
24
|
attr_accessor :upsell_path_code
|
25
25
|
|
26
|
+
# Upsell path name to start on (StoreFront Upsells). Will only be respected on a handoff API call.
|
27
|
+
attr_accessor :upsell_path_name
|
28
|
+
|
29
|
+
# Upsell path variation to start on (StoreFront Upsells). Will only be respected on a handoff API call.
|
30
|
+
attr_accessor :upsell_path_variation
|
31
|
+
|
26
32
|
# Attribute mapping from ruby-style variable name to JSON key.
|
27
33
|
def self.attribute_map
|
28
34
|
{
|
29
35
|
:'finalize_after_dts' => :'finalize_after_dts',
|
30
36
|
:'finalize_after_minutes' => :'finalize_after_minutes',
|
31
|
-
:'upsell_path_code' => :'upsell_path_code'
|
37
|
+
:'upsell_path_code' => :'upsell_path_code',
|
38
|
+
:'upsell_path_name' => :'upsell_path_name',
|
39
|
+
:'upsell_path_variation' => :'upsell_path_variation'
|
32
40
|
}
|
33
41
|
end
|
34
42
|
|
@@ -37,7 +45,9 @@ module UltracartClient
|
|
37
45
|
{
|
38
46
|
:'finalize_after_dts' => :'String',
|
39
47
|
:'finalize_after_minutes' => :'Integer',
|
40
|
-
:'upsell_path_code' => :'String'
|
48
|
+
:'upsell_path_code' => :'String',
|
49
|
+
:'upsell_path_name' => :'String',
|
50
|
+
:'upsell_path_variation' => :'String'
|
41
51
|
}
|
42
52
|
end
|
43
53
|
|
@@ -60,6 +70,14 @@ module UltracartClient
|
|
60
70
|
if attributes.has_key?(:'upsell_path_code')
|
61
71
|
self.upsell_path_code = attributes[:'upsell_path_code']
|
62
72
|
end
|
73
|
+
|
74
|
+
if attributes.has_key?(:'upsell_path_name')
|
75
|
+
self.upsell_path_name = attributes[:'upsell_path_name']
|
76
|
+
end
|
77
|
+
|
78
|
+
if attributes.has_key?(:'upsell_path_variation')
|
79
|
+
self.upsell_path_variation = attributes[:'upsell_path_variation']
|
80
|
+
end
|
63
81
|
end
|
64
82
|
|
65
83
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -97,7 +115,9 @@ module UltracartClient
|
|
97
115
|
self.class == o.class &&
|
98
116
|
finalize_after_dts == o.finalize_after_dts &&
|
99
117
|
finalize_after_minutes == o.finalize_after_minutes &&
|
100
|
-
upsell_path_code == o.upsell_path_code
|
118
|
+
upsell_path_code == o.upsell_path_code &&
|
119
|
+
upsell_path_name == o.upsell_path_name &&
|
120
|
+
upsell_path_variation == o.upsell_path_variation
|
101
121
|
end
|
102
122
|
|
103
123
|
# @see the `==` method
|
@@ -109,7 +129,7 @@ module UltracartClient
|
|
109
129
|
# Calculates hash code according to all attributes.
|
110
130
|
# @return [Fixnum] Hash code
|
111
131
|
def hash
|
112
|
-
[finalize_after_dts, finalize_after_minutes, upsell_path_code].hash
|
132
|
+
[finalize_after_dts, finalize_after_minutes, upsell_path_code, upsell_path_name, upsell_path_variation].hash
|
113
133
|
end
|
114
134
|
|
115
135
|
# Builds the object from hash
|
@@ -24,6 +24,12 @@ module UltracartClient
|
|
24
24
|
|
25
25
|
attr_accessor :open_support_ticket
|
26
26
|
|
27
|
+
# Channel to use to open the support ticket
|
28
|
+
attr_accessor :open_support_ticket_channel
|
29
|
+
|
30
|
+
# Email to send support ticket to
|
31
|
+
attr_accessor :open_support_ticket_channel_email
|
32
|
+
|
27
33
|
attr_accessor :pause_subscription
|
28
34
|
|
29
35
|
attr_accessor :resume_subscription
|
@@ -32,6 +38,28 @@ module UltracartClient
|
|
32
38
|
|
33
39
|
attr_accessor :update_subscription_credit_card
|
34
40
|
|
41
|
+
class EnumAttributeValidator
|
42
|
+
attr_reader :datatype
|
43
|
+
attr_reader :allowable_values
|
44
|
+
|
45
|
+
def initialize(datatype, allowable_values)
|
46
|
+
@allowable_values = allowable_values.map do |value|
|
47
|
+
case datatype.to_s
|
48
|
+
when /Integer/i
|
49
|
+
value.to_i
|
50
|
+
when /Float/i
|
51
|
+
value.to_f
|
52
|
+
else
|
53
|
+
value
|
54
|
+
end
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
58
|
+
def valid?(value)
|
59
|
+
!value || allowable_values.include?(value)
|
60
|
+
end
|
61
|
+
end
|
62
|
+
|
35
63
|
# Attribute mapping from ruby-style variable name to JSON key.
|
36
64
|
def self.attribute_map
|
37
65
|
{
|
@@ -40,6 +68,8 @@ module UltracartClient
|
|
40
68
|
:'lookup_order_information' => :'lookup_order_information',
|
41
69
|
:'lookup_subscription_information' => :'lookup_subscription_information',
|
42
70
|
:'open_support_ticket' => :'open_support_ticket',
|
71
|
+
:'open_support_ticket_channel' => :'open_support_ticket_channel',
|
72
|
+
:'open_support_ticket_channel_email' => :'open_support_ticket_channel_email',
|
43
73
|
:'pause_subscription' => :'pause_subscription',
|
44
74
|
:'resume_subscription' => :'resume_subscription',
|
45
75
|
:'transfer_chat_to_live_agent' => :'transfer_chat_to_live_agent',
|
@@ -55,6 +85,8 @@ module UltracartClient
|
|
55
85
|
:'lookup_order_information' => :'BOOLEAN',
|
56
86
|
:'lookup_subscription_information' => :'BOOLEAN',
|
57
87
|
:'open_support_ticket' => :'BOOLEAN',
|
88
|
+
:'open_support_ticket_channel' => :'String',
|
89
|
+
:'open_support_ticket_channel_email' => :'String',
|
58
90
|
:'pause_subscription' => :'BOOLEAN',
|
59
91
|
:'resume_subscription' => :'BOOLEAN',
|
60
92
|
:'transfer_chat_to_live_agent' => :'BOOLEAN',
|
@@ -90,6 +122,14 @@ module UltracartClient
|
|
90
122
|
self.open_support_ticket = attributes[:'open_support_ticket']
|
91
123
|
end
|
92
124
|
|
125
|
+
if attributes.has_key?(:'open_support_ticket_channel')
|
126
|
+
self.open_support_ticket_channel = attributes[:'open_support_ticket_channel']
|
127
|
+
end
|
128
|
+
|
129
|
+
if attributes.has_key?(:'open_support_ticket_channel_email')
|
130
|
+
self.open_support_ticket_channel_email = attributes[:'open_support_ticket_channel_email']
|
131
|
+
end
|
132
|
+
|
93
133
|
if attributes.has_key?(:'pause_subscription')
|
94
134
|
self.pause_subscription = attributes[:'pause_subscription']
|
95
135
|
end
|
@@ -117,9 +157,21 @@ module UltracartClient
|
|
117
157
|
# Check to see if the all the properties in the model are valid
|
118
158
|
# @return true if the model is valid
|
119
159
|
def valid?
|
160
|
+
open_support_ticket_channel_validator = EnumAttributeValidator.new('String', ['none', 'email', 'UltraCart Task', 'Zoho Desk Ticket'])
|
161
|
+
return false unless open_support_ticket_channel_validator.valid?(@open_support_ticket_channel)
|
120
162
|
true
|
121
163
|
end
|
122
164
|
|
165
|
+
# Custom attribute writer method checking allowed values (enum).
|
166
|
+
# @param [Object] open_support_ticket_channel Object to be assigned
|
167
|
+
def open_support_ticket_channel=(open_support_ticket_channel)
|
168
|
+
validator = EnumAttributeValidator.new('String', ['none', 'email', 'UltraCart Task', 'Zoho Desk Ticket'])
|
169
|
+
unless validator.valid?(open_support_ticket_channel)
|
170
|
+
fail ArgumentError, 'invalid value for "open_support_ticket_channel", must be one of #{validator.allowable_values}.'
|
171
|
+
end
|
172
|
+
@open_support_ticket_channel = open_support_ticket_channel
|
173
|
+
end
|
174
|
+
|
123
175
|
# Checks equality by comparing each attribute.
|
124
176
|
# @param [Object] Object to be compared
|
125
177
|
def ==(o)
|
@@ -130,6 +182,8 @@ module UltracartClient
|
|
130
182
|
lookup_order_information == o.lookup_order_information &&
|
131
183
|
lookup_subscription_information == o.lookup_subscription_information &&
|
132
184
|
open_support_ticket == o.open_support_ticket &&
|
185
|
+
open_support_ticket_channel == o.open_support_ticket_channel &&
|
186
|
+
open_support_ticket_channel_email == o.open_support_ticket_channel_email &&
|
133
187
|
pause_subscription == o.pause_subscription &&
|
134
188
|
resume_subscription == o.resume_subscription &&
|
135
189
|
transfer_chat_to_live_agent == o.transfer_chat_to_live_agent &&
|
@@ -145,7 +199,7 @@ module UltracartClient
|
|
145
199
|
# Calculates hash code according to all attributes.
|
146
200
|
# @return [Fixnum] Hash code
|
147
201
|
def hash
|
148
|
-
[cancel_subscription, delay_subscription, lookup_order_information, lookup_subscription_information, open_support_ticket, pause_subscription, resume_subscription, transfer_chat_to_live_agent, update_subscription_credit_card].hash
|
202
|
+
[cancel_subscription, delay_subscription, lookup_order_information, lookup_subscription_information, open_support_ticket, open_support_ticket_channel, open_support_ticket_channel_email, pause_subscription, resume_subscription, transfer_chat_to_live_agent, update_subscription_credit_card].hash
|
149
203
|
end
|
150
204
|
|
151
205
|
# Builds the object from hash
|
@@ -0,0 +1,271 @@
|
|
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 CustomReport
|
17
|
+
attr_accessor :chart_javascript
|
18
|
+
|
19
|
+
attr_accessor :chart_javascript_url
|
20
|
+
|
21
|
+
attr_accessor :data_warehouse_report_config_oid
|
22
|
+
|
23
|
+
attr_accessor :dataset_security_level
|
24
|
+
|
25
|
+
attr_accessor :group_name
|
26
|
+
|
27
|
+
attr_accessor :merchant_id
|
28
|
+
|
29
|
+
attr_accessor :name
|
30
|
+
|
31
|
+
attr_accessor :parameters
|
32
|
+
|
33
|
+
attr_accessor :queries
|
34
|
+
|
35
|
+
attr_accessor :tooltips
|
36
|
+
|
37
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
38
|
+
def self.attribute_map
|
39
|
+
{
|
40
|
+
:'chart_javascript' => :'chart_javascript',
|
41
|
+
:'chart_javascript_url' => :'chart_javascript_url',
|
42
|
+
:'data_warehouse_report_config_oid' => :'data_warehouse_report_config_oid',
|
43
|
+
:'dataset_security_level' => :'dataset_security_level',
|
44
|
+
:'group_name' => :'group_name',
|
45
|
+
:'merchant_id' => :'merchant_id',
|
46
|
+
:'name' => :'name',
|
47
|
+
:'parameters' => :'parameters',
|
48
|
+
:'queries' => :'queries',
|
49
|
+
:'tooltips' => :'tooltips'
|
50
|
+
}
|
51
|
+
end
|
52
|
+
|
53
|
+
# Attribute type mapping.
|
54
|
+
def self.swagger_types
|
55
|
+
{
|
56
|
+
:'chart_javascript' => :'String',
|
57
|
+
:'chart_javascript_url' => :'String',
|
58
|
+
:'data_warehouse_report_config_oid' => :'Integer',
|
59
|
+
:'dataset_security_level' => :'String',
|
60
|
+
:'group_name' => :'String',
|
61
|
+
:'merchant_id' => :'String',
|
62
|
+
:'name' => :'String',
|
63
|
+
:'parameters' => :'Array<CustomReportParameter>',
|
64
|
+
:'queries' => :'Array<CustomReportQuery>',
|
65
|
+
:'tooltips' => :'Array<CustomReportTooltip>'
|
66
|
+
}
|
67
|
+
end
|
68
|
+
|
69
|
+
# Initializes the object
|
70
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
71
|
+
def initialize(attributes = {})
|
72
|
+
return unless attributes.is_a?(Hash)
|
73
|
+
|
74
|
+
# convert string to symbol for hash key
|
75
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
76
|
+
|
77
|
+
if attributes.has_key?(:'chart_javascript')
|
78
|
+
self.chart_javascript = attributes[:'chart_javascript']
|
79
|
+
end
|
80
|
+
|
81
|
+
if attributes.has_key?(:'chart_javascript_url')
|
82
|
+
self.chart_javascript_url = attributes[:'chart_javascript_url']
|
83
|
+
end
|
84
|
+
|
85
|
+
if attributes.has_key?(:'data_warehouse_report_config_oid')
|
86
|
+
self.data_warehouse_report_config_oid = attributes[:'data_warehouse_report_config_oid']
|
87
|
+
end
|
88
|
+
|
89
|
+
if attributes.has_key?(:'dataset_security_level')
|
90
|
+
self.dataset_security_level = attributes[:'dataset_security_level']
|
91
|
+
end
|
92
|
+
|
93
|
+
if attributes.has_key?(:'group_name')
|
94
|
+
self.group_name = attributes[:'group_name']
|
95
|
+
end
|
96
|
+
|
97
|
+
if attributes.has_key?(:'merchant_id')
|
98
|
+
self.merchant_id = attributes[:'merchant_id']
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.has_key?(:'name')
|
102
|
+
self.name = attributes[:'name']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.has_key?(:'parameters')
|
106
|
+
if (value = attributes[:'parameters']).is_a?(Array)
|
107
|
+
self.parameters = value
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.has_key?(:'queries')
|
112
|
+
if (value = attributes[:'queries']).is_a?(Array)
|
113
|
+
self.queries = value
|
114
|
+
end
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.has_key?(:'tooltips')
|
118
|
+
if (value = attributes[:'tooltips']).is_a?(Array)
|
119
|
+
self.tooltips = value
|
120
|
+
end
|
121
|
+
end
|
122
|
+
end
|
123
|
+
|
124
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
125
|
+
# @return Array for valid properties with the reasons
|
126
|
+
def list_invalid_properties
|
127
|
+
invalid_properties = Array.new
|
128
|
+
invalid_properties
|
129
|
+
end
|
130
|
+
|
131
|
+
# Check to see if the all the properties in the model are valid
|
132
|
+
# @return true if the model is valid
|
133
|
+
def valid?
|
134
|
+
true
|
135
|
+
end
|
136
|
+
|
137
|
+
# Checks equality by comparing each attribute.
|
138
|
+
# @param [Object] Object to be compared
|
139
|
+
def ==(o)
|
140
|
+
return true if self.equal?(o)
|
141
|
+
self.class == o.class &&
|
142
|
+
chart_javascript == o.chart_javascript &&
|
143
|
+
chart_javascript_url == o.chart_javascript_url &&
|
144
|
+
data_warehouse_report_config_oid == o.data_warehouse_report_config_oid &&
|
145
|
+
dataset_security_level == o.dataset_security_level &&
|
146
|
+
group_name == o.group_name &&
|
147
|
+
merchant_id == o.merchant_id &&
|
148
|
+
name == o.name &&
|
149
|
+
parameters == o.parameters &&
|
150
|
+
queries == o.queries &&
|
151
|
+
tooltips == o.tooltips
|
152
|
+
end
|
153
|
+
|
154
|
+
# @see the `==` method
|
155
|
+
# @param [Object] Object to be compared
|
156
|
+
def eql?(o)
|
157
|
+
self == o
|
158
|
+
end
|
159
|
+
|
160
|
+
# Calculates hash code according to all attributes.
|
161
|
+
# @return [Fixnum] Hash code
|
162
|
+
def hash
|
163
|
+
[chart_javascript, chart_javascript_url, data_warehouse_report_config_oid, dataset_security_level, group_name, merchant_id, name, parameters, queries, tooltips].hash
|
164
|
+
end
|
165
|
+
|
166
|
+
# Builds the object from hash
|
167
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
168
|
+
# @return [Object] Returns the model itself
|
169
|
+
def build_from_hash(attributes)
|
170
|
+
return nil unless attributes.is_a?(Hash)
|
171
|
+
self.class.swagger_types.each_pair do |key, type|
|
172
|
+
if type =~ /\AArray<(.*)>/i
|
173
|
+
# check to ensure the input is an array given that the attribute
|
174
|
+
# is documented as an array but the input is not
|
175
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
176
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
177
|
+
end
|
178
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
179
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
180
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
181
|
+
end
|
182
|
+
|
183
|
+
self
|
184
|
+
end
|
185
|
+
|
186
|
+
# Deserializes the data based on type
|
187
|
+
# @param string type Data type
|
188
|
+
# @param string value Value to be deserialized
|
189
|
+
# @return [Object] Deserialized data
|
190
|
+
def _deserialize(type, value)
|
191
|
+
case type.to_sym
|
192
|
+
when :DateTime
|
193
|
+
DateTime.parse(value)
|
194
|
+
when :Date
|
195
|
+
Date.parse(value)
|
196
|
+
when :String
|
197
|
+
value.to_s
|
198
|
+
when :Integer
|
199
|
+
value.to_i
|
200
|
+
when :Float
|
201
|
+
value.to_f
|
202
|
+
when :BOOLEAN
|
203
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
204
|
+
true
|
205
|
+
else
|
206
|
+
false
|
207
|
+
end
|
208
|
+
when :Object
|
209
|
+
# generic object (usually a Hash), return directly
|
210
|
+
value
|
211
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
212
|
+
inner_type = Regexp.last_match[:inner_type]
|
213
|
+
value.map { |v| _deserialize(inner_type, v) }
|
214
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
215
|
+
k_type = Regexp.last_match[:k_type]
|
216
|
+
v_type = Regexp.last_match[:v_type]
|
217
|
+
{}.tap do |hash|
|
218
|
+
value.each do |k, v|
|
219
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
220
|
+
end
|
221
|
+
end
|
222
|
+
else # model
|
223
|
+
temp_model = UltracartClient.const_get(type).new
|
224
|
+
temp_model.build_from_hash(value)
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
# Returns the string representation of the object
|
229
|
+
# @return [String] String presentation of the object
|
230
|
+
def to_s
|
231
|
+
to_hash.to_s
|
232
|
+
end
|
233
|
+
|
234
|
+
# to_body is an alias to to_hash (backward compatibility)
|
235
|
+
# @return [Hash] Returns the object in the form of hash
|
236
|
+
def to_body
|
237
|
+
to_hash
|
238
|
+
end
|
239
|
+
|
240
|
+
# Returns the object in the form of hash
|
241
|
+
# @return [Hash] Returns the object in the form of hash
|
242
|
+
def to_hash
|
243
|
+
hash = {}
|
244
|
+
self.class.attribute_map.each_pair do |attr, param|
|
245
|
+
value = self.send(attr)
|
246
|
+
next if value.nil?
|
247
|
+
hash[param] = _to_hash(value)
|
248
|
+
end
|
249
|
+
hash
|
250
|
+
end
|
251
|
+
|
252
|
+
# Outputs non-array value in the form of hash
|
253
|
+
# For object, use to_hash. Otherwise, just return the value
|
254
|
+
# @param [Object] value Any valid value
|
255
|
+
# @return [Hash] Returns the value in the form of hash
|
256
|
+
def _to_hash(value)
|
257
|
+
if value.is_a?(Array)
|
258
|
+
value.compact.map { |v| _to_hash(v) }
|
259
|
+
elsif value.is_a?(Hash)
|
260
|
+
{}.tap do |hash|
|
261
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
262
|
+
end
|
263
|
+
elsif value.respond_to? :to_hash
|
264
|
+
value.to_hash
|
265
|
+
else
|
266
|
+
value
|
267
|
+
end
|
268
|
+
end
|
269
|
+
|
270
|
+
end
|
271
|
+
end
|