ultracart_api 4.1.232 → 4.1.234

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.
Files changed (61) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +35 -2
  3. data/docs/SfvbApi.md +922 -34
  4. data/docs/SfvbApprovalCreateRequest.md +2 -0
  5. data/docs/SfvbApprovalParams.md +1 -1
  6. data/docs/SfvbCampaign.md +4 -0
  7. data/docs/SfvbCampaignWriteRequest.md +2 -0
  8. data/docs/SfvbCommsLookupOwner.md +28 -0
  9. data/docs/SfvbCommsLookupResponse.md +36 -0
  10. data/docs/SfvbCommsRulerValidateRequest.md +18 -0
  11. data/docs/SfvbCommsRulerValidateResponse.md +22 -0
  12. data/docs/SfvbCommsSequenceFolder.md +28 -0
  13. data/docs/SfvbCommsSequenceFolderResponse.md +22 -0
  14. data/docs/SfvbCommsSequenceFoldersResponse.md +18 -0
  15. data/docs/SfvbCommsStat.md +1 -1
  16. data/docs/SfvbCommsTemplateResponse.md +8 -2
  17. data/docs/SfvbCommsUnreferencedEmail.md +30 -0
  18. data/docs/SfvbCommsUnreferencedPostcard.md +24 -0
  19. data/docs/SfvbCommsUnreferencedResponse.md +32 -0
  20. data/docs/SfvbEmail.md +8 -0
  21. data/docs/SfvbFlow.md +4 -0
  22. data/docs/SfvbFlowBackfillRequest.md +24 -0
  23. data/docs/SfvbFlowBackfillResponse.md +38 -0
  24. data/docs/SfvbFlowWriteRequest.md +2 -0
  25. data/docs/SfvbPreviewTrackingHtmlRequest.md +20 -0
  26. data/docs/SfvbServerLog.md +1 -1
  27. data/docs/SfvbStepCounts.md +1 -1
  28. data/docs/SfvbTrackingHtmlRenderRequest.md +20 -0
  29. data/docs/SfvbTrackingHtmlRenderResponse.md +32 -0
  30. data/docs/SfvbTrackingProvider.md +2 -0
  31. data/lib/ultracart_api/api/sfvb_api.rb +1235 -31
  32. data/lib/ultracart_api/models/sfvb_approval_create_request.rb +12 -3
  33. data/lib/ultracart_api/models/sfvb_approval_params.rb +1 -1
  34. data/lib/ultracart_api/models/sfvb_campaign.rb +21 -1
  35. data/lib/ultracart_api/models/sfvb_campaign_write_request.rb +11 -1
  36. data/lib/ultracart_api/models/sfvb_comms_lookup_owner.rb +270 -0
  37. data/lib/ultracart_api/models/sfvb_comms_lookup_response.rb +311 -0
  38. data/lib/ultracart_api/models/sfvb_comms_ruler_validate_request.rb +220 -0
  39. data/lib/ultracart_api/models/sfvb_comms_ruler_validate_response.rb +242 -0
  40. data/lib/ultracart_api/models/sfvb_comms_sequence_folder.rb +270 -0
  41. data/lib/ultracart_api/models/sfvb_comms_sequence_folder_response.rb +243 -0
  42. data/lib/ultracart_api/models/sfvb_comms_sequence_folders_response.rb +222 -0
  43. data/lib/ultracart_api/models/sfvb_comms_stat.rb +1 -1
  44. data/lib/ultracart_api/models/sfvb_comms_template_response.rb +35 -5
  45. data/lib/ultracart_api/models/sfvb_comms_unreferenced_email.rb +280 -0
  46. data/lib/ultracart_api/models/sfvb_comms_unreferenced_postcard.rb +250 -0
  47. data/lib/ultracart_api/models/sfvb_comms_unreferenced_response.rb +296 -0
  48. data/lib/ultracart_api/models/sfvb_email.rb +41 -1
  49. data/lib/ultracart_api/models/sfvb_flow.rb +21 -1
  50. data/lib/ultracart_api/models/sfvb_flow_backfill_request.rb +250 -0
  51. data/lib/ultracart_api/models/sfvb_flow_backfill_response.rb +322 -0
  52. data/lib/ultracart_api/models/sfvb_flow_write_request.rb +11 -1
  53. data/lib/ultracart_api/models/sfvb_preview_tracking_html_request.rb +230 -0
  54. data/lib/ultracart_api/models/sfvb_server_log.rb +1 -1
  55. data/lib/ultracart_api/models/sfvb_step_counts.rb +1 -1
  56. data/lib/ultracart_api/models/sfvb_tracking_html_render_request.rb +230 -0
  57. data/lib/ultracart_api/models/sfvb_tracking_html_render_response.rb +328 -0
  58. data/lib/ultracart_api/models/sfvb_tracking_provider.rb +11 -1
  59. data/lib/ultracart_api/version.rb +1 -1
  60. data/lib/ultracart_api.rb +15 -0
  61. metadata +32 -2
@@ -29,6 +29,8 @@ module UltracartClient
29
29
 
30
30
  attr_accessor :experiment_start
31
31
 
32
+ attr_accessor :flow_backfill
33
+
32
34
  # For item.attribute_batch, exactly the rows the batch will send - the dry run's change rows, each with merchant_item_oid and current_sha256. UltraCart keeps only their hash.
33
35
  attr_accessor :item_attribute_rows
34
36
 
@@ -85,6 +87,7 @@ module UltracartClient
85
87
  :'comms_settings' => :'comms_settings',
86
88
  :'content' => :'content',
87
89
  :'experiment_start' => :'experiment_start',
90
+ :'flow_backfill' => :'flow_backfill',
88
91
  :'item_attribute_rows' => :'item_attribute_rows',
89
92
  :'item_pricing' => :'item_pricing',
90
93
  :'params' => :'params',
@@ -113,6 +116,7 @@ module UltracartClient
113
116
  :'comms_settings' => :'SfvbCommsSettingsUpdateRequest',
114
117
  :'content' => :'String',
115
118
  :'experiment_start' => :'SfvbExperimentStartRequest',
119
+ :'flow_backfill' => :'SfvbFlowBackfillRequest',
116
120
  :'item_attribute_rows' => :'Array<SfvbItemAttributeBatchRow>',
117
121
  :'item_pricing' => :'SfvbItemPricingRequest',
118
122
  :'params' => :'SfvbApprovalParams',
@@ -172,6 +176,10 @@ module UltracartClient
172
176
  self.experiment_start = attributes[:'experiment_start']
173
177
  end
174
178
 
179
+ if attributes.key?(:'flow_backfill')
180
+ self.flow_backfill = attributes[:'flow_backfill']
181
+ end
182
+
175
183
  if attributes.key?(:'item_attribute_rows')
176
184
  if (value = attributes[:'item_attribute_rows']).is_a?(Array)
177
185
  self.item_attribute_rows = value
@@ -231,7 +239,7 @@ module UltracartClient
231
239
  # Check to see if the all the properties in the model are valid
232
240
  # @return true if the model is valid
233
241
  def valid?
234
- action_validator = EnumAttributeValidator.new('String', ["file.delete", "blog_post.delete", "file.put_script", "redirect.delete_batch", "experiment.start", "experiment.end", "upsell.enable", "item.attribute_batch", "item.pricing", "twilio_account.delete", "sending_domain.delete", "sequence_step.delete", "sequence_step.move", "sequence_step.enable_postcard", "segment.update", "smart_attribution.change", "smart_attribution.delete", "tracking_provider.change", "tracking_html.put", "affiliate_network.change", "affiliate_network.delete", "site_seo.change", "transactional_email.update", "comms_settings.update", "comms_list.import", "postcard.test_mail"])
242
+ action_validator = EnumAttributeValidator.new('String', ["file.delete", "blog_post.delete", "file.put_script", "redirect.delete_batch", "experiment.start", "experiment.end", "upsell.enable", "item.attribute_batch", "item.pricing", "twilio_account.delete", "sending_domain.delete", "sequence_step.delete", "sequence_step.move", "sequence_step.enable_postcard", "segment.update", "smart_attribution.change", "smart_attribution.delete", "tracking_provider.change", "tracking_html.put", "affiliate_network.change", "affiliate_network.delete", "site_seo.change", "transactional_email.update", "comms_settings.update", "comms_list.import", "postcard.test_mail", "flow.backfill"])
235
243
  return false unless action_validator.valid?(@action)
236
244
  true
237
245
  end
@@ -239,7 +247,7 @@ module UltracartClient
239
247
  # Custom attribute writer method checking allowed values (enum).
240
248
  # @param [Object] action Object to be assigned
241
249
  def action=(action)
242
- validator = EnumAttributeValidator.new('String', ["file.delete", "blog_post.delete", "file.put_script", "redirect.delete_batch", "experiment.start", "experiment.end", "upsell.enable", "item.attribute_batch", "item.pricing", "twilio_account.delete", "sending_domain.delete", "sequence_step.delete", "sequence_step.move", "sequence_step.enable_postcard", "segment.update", "smart_attribution.change", "smart_attribution.delete", "tracking_provider.change", "tracking_html.put", "affiliate_network.change", "affiliate_network.delete", "site_seo.change", "transactional_email.update", "comms_settings.update", "comms_list.import", "postcard.test_mail"])
250
+ validator = EnumAttributeValidator.new('String', ["file.delete", "blog_post.delete", "file.put_script", "redirect.delete_batch", "experiment.start", "experiment.end", "upsell.enable", "item.attribute_batch", "item.pricing", "twilio_account.delete", "sending_domain.delete", "sequence_step.delete", "sequence_step.move", "sequence_step.enable_postcard", "segment.update", "smart_attribution.change", "smart_attribution.delete", "tracking_provider.change", "tracking_html.put", "affiliate_network.change", "affiliate_network.delete", "site_seo.change", "transactional_email.update", "comms_settings.update", "comms_list.import", "postcard.test_mail", "flow.backfill"])
243
251
  unless validator.valid?(action)
244
252
  fail ArgumentError, "invalid value for \"action\", must be one of #{validator.allowable_values}."
245
253
  end
@@ -257,6 +265,7 @@ module UltracartClient
257
265
  comms_settings == o.comms_settings &&
258
266
  content == o.content &&
259
267
  experiment_start == o.experiment_start &&
268
+ flow_backfill == o.flow_backfill &&
260
269
  item_attribute_rows == o.item_attribute_rows &&
261
270
  item_pricing == o.item_pricing &&
262
271
  params == o.params &&
@@ -279,7 +288,7 @@ module UltracartClient
279
288
  # Calculates hash code according to all attributes.
280
289
  # @return [Integer] Hash code
281
290
  def hash
282
- [action, affiliate_network, comms_list_import, comms_settings, content, experiment_start, item_attribute_rows, item_pricing, params, postcard_test_mail, reason, redirect_rows, segment_update, site_seo, smart_attribution, tracking_provider, transactional_email].hash
291
+ [action, affiliate_network, comms_list_import, comms_settings, content, experiment_start, flow_backfill, item_attribute_rows, item_pricing, params, postcard_test_mail, reason, redirect_rows, segment_update, site_seo, smart_attribution, tracking_provider, transactional_email].hash
283
292
  end
284
293
 
285
294
  # Builds the object from hash
@@ -75,7 +75,7 @@ module UltracartClient
75
75
  # The step to remove, for sequence_step.delete, to move, for sequence_step.move, or to turn on, for sequence_step.enable_postcard.
76
76
  attr_accessor :step_uuid
77
77
 
78
- # The tracking provider key, for tracking_provider.change.
78
+ # The tracking provider key, for tracking_provider.change and tracking_provider.clear.
79
79
  attr_accessor :tracking_provider
80
80
 
81
81
  # For upsell.enable, what to switch on.
@@ -36,6 +36,12 @@ module UltracartClient
36
36
  # True when a customer leaves the campaign once they buy from any source.
37
37
  attr_accessor :end_once_customer_purchases_anywhere
38
38
 
39
+ # That folder's name.
40
+ attr_accessor :folder_name
41
+
42
+ # The campaign folder it is filed in, or none.
43
+ attr_accessor :folder_uuid
44
+
39
45
  # Send this as If-Match when changing or archiving the campaign.
40
46
  attr_accessor :hash_sha256
41
47
 
@@ -85,6 +91,8 @@ module UltracartClient
85
91
  :'emails' => :'emails',
86
92
  :'end_once_customer_purchases' => :'end_once_customer_purchases',
87
93
  :'end_once_customer_purchases_anywhere' => :'end_once_customer_purchases_anywhere',
94
+ :'folder_name' => :'folder_name',
95
+ :'folder_uuid' => :'folder_uuid',
88
96
  :'hash_sha256' => :'hash_sha256',
89
97
  :'live' => :'live',
90
98
  :'memberships' => :'memberships',
@@ -116,6 +124,8 @@ module UltracartClient
116
124
  :'emails' => :'Array<SfvbCommsEmail>',
117
125
  :'end_once_customer_purchases' => :'Boolean',
118
126
  :'end_once_customer_purchases_anywhere' => :'Boolean',
127
+ :'folder_name' => :'String',
128
+ :'folder_uuid' => :'String',
119
129
  :'hash_sha256' => :'String',
120
130
  :'live' => :'Boolean',
121
131
  :'memberships' => :'Array<SfvbCampaignMembership>',
@@ -183,6 +193,14 @@ module UltracartClient
183
193
  self.end_once_customer_purchases_anywhere = attributes[:'end_once_customer_purchases_anywhere']
184
194
  end
185
195
 
196
+ if attributes.key?(:'folder_name')
197
+ self.folder_name = attributes[:'folder_name']
198
+ end
199
+
200
+ if attributes.key?(:'folder_uuid')
201
+ self.folder_uuid = attributes[:'folder_uuid']
202
+ end
203
+
186
204
  if attributes.key?(:'hash_sha256')
187
205
  self.hash_sha256 = attributes[:'hash_sha256']
188
206
  end
@@ -267,6 +285,8 @@ module UltracartClient
267
285
  emails == o.emails &&
268
286
  end_once_customer_purchases == o.end_once_customer_purchases &&
269
287
  end_once_customer_purchases_anywhere == o.end_once_customer_purchases_anywhere &&
288
+ folder_name == o.folder_name &&
289
+ folder_uuid == o.folder_uuid &&
270
290
  hash_sha256 == o.hash_sha256 &&
271
291
  live == o.live &&
272
292
  memberships == o.memberships &&
@@ -291,7 +311,7 @@ module UltracartClient
291
311
  # Calculates hash code according to all attributes.
292
312
  # @return [Integer] Hash code
293
313
  def hash
294
- [campaign_uuid, communication_sequence_uuid, created_dts, deleted, emails, end_once_customer_purchases, end_once_customer_purchases_anywhere, hash_sha256, live, memberships, name, notes, postcards, scheduled_dts, sending_domain_uuid, sending_name, sending_user, sms_phone_number, status, status_dts].hash
314
+ [campaign_uuid, communication_sequence_uuid, created_dts, deleted, emails, end_once_customer_purchases, end_once_customer_purchases_anywhere, folder_name, folder_uuid, hash_sha256, live, memberships, name, notes, postcards, scheduled_dts, sending_domain_uuid, sending_name, sending_user, sms_phone_number, status, status_dts].hash
295
315
  end
296
316
 
297
317
  # Builds the object from hash
@@ -21,6 +21,9 @@ module UltracartClient
21
21
  # True to end the campaign for a customer once they buy from any source.
22
22
  attr_accessor :end_once_customer_purchases_anywhere
23
23
 
24
+ # File it in this campaign folder. An empty value takes it out of its folder.
25
+ attr_accessor :folder_uuid
26
+
24
27
  # The lists and segments it sends to or leaves out. Replaces the whole set. An empty array clears it.
25
28
  attr_accessor :memberships
26
29
 
@@ -44,6 +47,7 @@ module UltracartClient
44
47
  {
45
48
  :'end_once_customer_purchases' => :'end_once_customer_purchases',
46
49
  :'end_once_customer_purchases_anywhere' => :'end_once_customer_purchases_anywhere',
50
+ :'folder_uuid' => :'folder_uuid',
47
51
  :'memberships' => :'memberships',
48
52
  :'name' => :'name',
49
53
  :'scheduled_dts' => :'scheduled_dts',
@@ -63,6 +67,7 @@ module UltracartClient
63
67
  {
64
68
  :'end_once_customer_purchases' => :'Boolean',
65
69
  :'end_once_customer_purchases_anywhere' => :'Boolean',
70
+ :'folder_uuid' => :'String',
66
71
  :'memberships' => :'Array<SfvbCampaignMembership>',
67
72
  :'name' => :'String',
68
73
  :'scheduled_dts' => :'String',
@@ -101,6 +106,10 @@ module UltracartClient
101
106
  self.end_once_customer_purchases_anywhere = attributes[:'end_once_customer_purchases_anywhere']
102
107
  end
103
108
 
109
+ if attributes.key?(:'folder_uuid')
110
+ self.folder_uuid = attributes[:'folder_uuid']
111
+ end
112
+
104
113
  if attributes.key?(:'memberships')
105
114
  if (value = attributes[:'memberships']).is_a?(Array)
106
115
  self.memberships = value
@@ -148,6 +157,7 @@ module UltracartClient
148
157
  self.class == o.class &&
149
158
  end_once_customer_purchases == o.end_once_customer_purchases &&
150
159
  end_once_customer_purchases_anywhere == o.end_once_customer_purchases_anywhere &&
160
+ folder_uuid == o.folder_uuid &&
151
161
  memberships == o.memberships &&
152
162
  name == o.name &&
153
163
  scheduled_dts == o.scheduled_dts &&
@@ -165,7 +175,7 @@ module UltracartClient
165
175
  # Calculates hash code according to all attributes.
166
176
  # @return [Integer] Hash code
167
177
  def hash
168
- [end_once_customer_purchases, end_once_customer_purchases_anywhere, memberships, name, scheduled_dts, sending_domain_uuid, sending_name, sending_user].hash
178
+ [end_once_customer_purchases, end_once_customer_purchases_anywhere, folder_uuid, memberships, name, scheduled_dts, sending_domain_uuid, sending_name, sending_user].hash
169
179
  end
170
180
 
171
181
  # Builds the object from hash
@@ -0,0 +1,270 @@
1
+ =begin
2
+ #UltraCart Rest API V2
3
+
4
+ #UltraCart REST API Version 2
5
+
6
+ The version of the OpenAPI document: 2.0.0
7
+ Contact: support@ultracart.com
8
+ Generated by: https://openapi-generator.tech
9
+ OpenAPI Generator version: 6.0.1-SNAPSHOT
10
+
11
+ =end
12
+
13
+ require 'date'
14
+ require 'time'
15
+
16
+ module UltracartClient
17
+ class SfvbCommsLookupOwner
18
+ # True when the campaign or flow is archived. It sends nothing, and 'sf comms flows list' or 'campaigns list' shows it only with --include-deleted.
19
+ attr_accessor :archived
20
+
21
+ # True when it is sending now, by the same rule the sequence read uses.
22
+ attr_accessor :live
23
+
24
+ # Its name.
25
+ attr_accessor :name
26
+
27
+ # Its status as stored.
28
+ attr_accessor :status
29
+
30
+ # campaign or flow.
31
+ attr_accessor :type
32
+
33
+ # The campaign or flow uuid.
34
+ attr_accessor :uuid
35
+
36
+ # Attribute mapping from ruby-style variable name to JSON key.
37
+ def self.attribute_map
38
+ {
39
+ :'archived' => :'archived',
40
+ :'live' => :'live',
41
+ :'name' => :'name',
42
+ :'status' => :'status',
43
+ :'type' => :'type',
44
+ :'uuid' => :'uuid'
45
+ }
46
+ end
47
+
48
+ # Returns all the JSON keys this model knows about
49
+ def self.acceptable_attributes
50
+ attribute_map.values
51
+ end
52
+
53
+ # Attribute type mapping.
54
+ def self.openapi_types
55
+ {
56
+ :'archived' => :'Boolean',
57
+ :'live' => :'Boolean',
58
+ :'name' => :'String',
59
+ :'status' => :'String',
60
+ :'type' => :'String',
61
+ :'uuid' => :'String'
62
+ }
63
+ end
64
+
65
+ # List of attributes with nullable: true
66
+ def self.openapi_nullable
67
+ Set.new([
68
+ ])
69
+ end
70
+
71
+ # Initializes the object
72
+ # @param [Hash] attributes Model attributes in the form of hash
73
+ def initialize(attributes = {})
74
+ if (!attributes.is_a?(Hash))
75
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbCommsLookupOwner` initialize method"
76
+ end
77
+
78
+ # check to see if the attribute exists and convert string to symbol for hash key
79
+ attributes = attributes.each_with_object({}) { |(k, v), h|
80
+ if (!self.class.attribute_map.key?(k.to_sym))
81
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbCommsLookupOwner`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
82
+ end
83
+ h[k.to_sym] = v
84
+ }
85
+
86
+ if attributes.key?(:'archived')
87
+ self.archived = attributes[:'archived']
88
+ end
89
+
90
+ if attributes.key?(:'live')
91
+ self.live = attributes[:'live']
92
+ end
93
+
94
+ if attributes.key?(:'name')
95
+ self.name = attributes[:'name']
96
+ end
97
+
98
+ if attributes.key?(:'status')
99
+ self.status = attributes[:'status']
100
+ end
101
+
102
+ if attributes.key?(:'type')
103
+ self.type = attributes[:'type']
104
+ end
105
+
106
+ if attributes.key?(:'uuid')
107
+ self.uuid = attributes[:'uuid']
108
+ end
109
+ end
110
+
111
+ # Show invalid properties with the reasons. Usually used together with valid?
112
+ # @return Array for valid properties with the reasons
113
+ def list_invalid_properties
114
+ invalid_properties = Array.new
115
+ invalid_properties
116
+ end
117
+
118
+ # Check to see if the all the properties in the model are valid
119
+ # @return true if the model is valid
120
+ def valid?
121
+ true
122
+ end
123
+
124
+ # Checks equality by comparing each attribute.
125
+ # @param [Object] Object to be compared
126
+ def ==(o)
127
+ return true if self.equal?(o)
128
+ self.class == o.class &&
129
+ archived == o.archived &&
130
+ live == o.live &&
131
+ name == o.name &&
132
+ status == o.status &&
133
+ type == o.type &&
134
+ uuid == o.uuid
135
+ end
136
+
137
+ # @see the `==` method
138
+ # @param [Object] Object to be compared
139
+ def eql?(o)
140
+ self == o
141
+ end
142
+
143
+ # Calculates hash code according to all attributes.
144
+ # @return [Integer] Hash code
145
+ def hash
146
+ [archived, live, name, status, type, uuid].hash
147
+ end
148
+
149
+ # Builds the object from hash
150
+ # @param [Hash] attributes Model attributes in the form of hash
151
+ # @return [Object] Returns the model itself
152
+ def self.build_from_hash(attributes)
153
+ new.build_from_hash(attributes)
154
+ end
155
+
156
+ # Builds the object from hash
157
+ # @param [Hash] attributes Model attributes in the form of hash
158
+ # @return [Object] Returns the model itself
159
+ def build_from_hash(attributes)
160
+ return nil unless attributes.is_a?(Hash)
161
+ attributes = attributes.transform_keys(&:to_sym)
162
+ self.class.openapi_types.each_pair do |key, type|
163
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
164
+ self.send("#{key}=", nil)
165
+ elsif type =~ /\AArray<(.*)>/i
166
+ # check to ensure the input is an array given that the attribute
167
+ # is documented as an array but the input is not
168
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
169
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
170
+ end
171
+ elsif !attributes[self.class.attribute_map[key]].nil?
172
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
173
+ end
174
+ end
175
+
176
+ self
177
+ end
178
+
179
+ # Deserializes the data based on type
180
+ # @param string type Data type
181
+ # @param string value Value to be deserialized
182
+ # @return [Object] Deserialized data
183
+ def _deserialize(type, value)
184
+ case type.to_sym
185
+ when :Time
186
+ Time.parse(value)
187
+ when :Date
188
+ Date.parse(value)
189
+ when :String
190
+ value.to_s
191
+ when :Integer
192
+ value.to_i
193
+ when :Float
194
+ value.to_f
195
+ when :Boolean
196
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
197
+ true
198
+ else
199
+ false
200
+ end
201
+ when :Object
202
+ # generic object (usually a Hash), return directly
203
+ value
204
+ when /\AArray<(?<inner_type>.+)>\z/
205
+ inner_type = Regexp.last_match[:inner_type]
206
+ value.map { |v| _deserialize(inner_type, v) }
207
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
208
+ k_type = Regexp.last_match[:k_type]
209
+ v_type = Regexp.last_match[:v_type]
210
+ {}.tap do |hash|
211
+ value.each do |k, v|
212
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
213
+ end
214
+ end
215
+ else # model
216
+ # models (e.g. Pet) or oneOf
217
+ klass = UltracartClient.const_get(type)
218
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
219
+ end
220
+ end
221
+
222
+ # Returns the string representation of the object
223
+ # @return [String] String presentation of the object
224
+ def to_s
225
+ to_hash.to_s
226
+ end
227
+
228
+ # to_body is an alias to to_hash (backward compatibility)
229
+ # @return [Hash] Returns the object in the form of hash
230
+ def to_body
231
+ to_hash
232
+ end
233
+
234
+ # Returns the object in the form of hash
235
+ # @return [Hash] Returns the object in the form of hash
236
+ def to_hash
237
+ hash = {}
238
+ self.class.attribute_map.each_pair do |attr, param|
239
+ value = self.send(attr)
240
+ if value.nil?
241
+ is_nullable = self.class.openapi_nullable.include?(attr)
242
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
243
+ end
244
+
245
+ hash[param] = _to_hash(value)
246
+ end
247
+ hash
248
+ end
249
+
250
+ # Outputs non-array value in the form of hash
251
+ # For object, use to_hash. Otherwise, just return the value
252
+ # @param [Object] value Any valid value
253
+ # @return [Hash] Returns the value in the form of hash
254
+ def _to_hash(value)
255
+ if value.is_a?(Array)
256
+ value.compact.map { |v| _to_hash(v) }
257
+ elsif value.is_a?(Hash)
258
+ {}.tap do |hash|
259
+ value.each { |k, v| hash[k] = _to_hash(v) }
260
+ end
261
+ elsif value.respond_to? :to_hash
262
+ value.to_hash
263
+ else
264
+ value
265
+ end
266
+ end
267
+
268
+ end
269
+
270
+ end