ultracart_api 4.1.231 → 4.1.233

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 (105) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +72 -2
  3. data/docs/ItemContentMultimedia.md +2 -0
  4. data/docs/SfvbApi.md +1660 -162
  5. data/docs/SfvbApprovalCreateRequest.md +8 -0
  6. data/docs/SfvbCampaign.md +4 -0
  7. data/docs/SfvbCampaignWriteRequest.md +2 -0
  8. data/docs/SfvbCommsBranchStat.md +20 -0
  9. data/docs/SfvbCommsChange.md +22 -0
  10. data/docs/SfvbCommsClick.md +20 -0
  11. data/docs/SfvbCommsClicksResponse.md +26 -0
  12. data/docs/SfvbCommsDailyStat.md +30 -0
  13. data/docs/SfvbCommsDashboardResponse.md +24 -0
  14. data/docs/SfvbCommsDashboardRow.md +28 -0
  15. data/docs/SfvbCommsLookupOwner.md +26 -0
  16. data/docs/SfvbCommsLookupResponse.md +34 -0
  17. data/docs/SfvbCommsPlan.md +66 -0
  18. data/docs/SfvbCommsPlanResponse.md +20 -0
  19. data/docs/SfvbCommsProvider.md +28 -0
  20. data/docs/SfvbCommsProviderImportRequest.md +22 -0
  21. data/docs/SfvbCommsProviderImportResponse.md +26 -0
  22. data/docs/SfvbCommsProviderList.md +20 -0
  23. data/docs/SfvbCommsProvidersResponse.md +22 -0
  24. data/docs/SfvbCommsRulerValidateRequest.md +18 -0
  25. data/docs/SfvbCommsRulerValidateResponse.md +22 -0
  26. data/docs/SfvbCommsSender.md +24 -0
  27. data/docs/SfvbCommsSenderUpdate.md +22 -0
  28. data/docs/SfvbCommsSequenceFolder.md +28 -0
  29. data/docs/SfvbCommsSequenceFolderResponse.md +22 -0
  30. data/docs/SfvbCommsSequenceFoldersResponse.md +18 -0
  31. data/docs/SfvbCommsSequenceStatsResponse.md +26 -0
  32. data/docs/SfvbCommsSettings.md +34 -0
  33. data/docs/SfvbCommsSettingsResponse.md +24 -0
  34. data/docs/SfvbCommsSettingsUpdateRequest.md +26 -0
  35. data/docs/SfvbCommsStat.md +54 -0
  36. data/docs/SfvbCommsStepStat.md +34 -0
  37. data/docs/SfvbCommsTemplate.md +30 -0
  38. data/docs/SfvbCommsTemplateResponse.md +30 -0
  39. data/docs/SfvbCommsTemplatesResponse.md +20 -0
  40. data/docs/SfvbCommsTestEmailRequest.md +24 -0
  41. data/docs/SfvbCommsTestPostcardRequest.md +36 -0
  42. data/docs/SfvbCommsTestSendResponse.md +32 -0
  43. data/docs/SfvbCommsTestSmsRequest.md +18 -0
  44. data/docs/SfvbCommsUnreferencedEmail.md +30 -0
  45. data/docs/SfvbCommsUnreferencedPostcard.md +24 -0
  46. data/docs/SfvbCommsUnreferencedResponse.md +32 -0
  47. data/docs/SfvbEmail.md +8 -0
  48. data/docs/SfvbFlow.md +4 -0
  49. data/docs/SfvbFlowBackfillRequest.md +24 -0
  50. data/docs/SfvbFlowBackfillResponse.md +38 -0
  51. data/docs/SfvbFlowWriteRequest.md +2 -0
  52. data/docs/SfvbStepCounts.md +1 -1
  53. data/lib/ultracart_api/api/sfvb_api.rb +2356 -348
  54. data/lib/ultracart_api/models/item_content_multimedia.rb +11 -1
  55. data/lib/ultracart_api/models/sfvb_approval_create_request.rb +39 -3
  56. data/lib/ultracart_api/models/sfvb_campaign.rb +21 -1
  57. data/lib/ultracart_api/models/sfvb_campaign_write_request.rb +11 -1
  58. data/lib/ultracart_api/models/sfvb_comms_branch_stat.rb +229 -0
  59. data/lib/ultracart_api/models/sfvb_comms_change.rb +240 -0
  60. data/lib/ultracart_api/models/sfvb_comms_click.rb +230 -0
  61. data/lib/ultracart_api/models/sfvb_comms_clicks_response.rb +264 -0
  62. data/lib/ultracart_api/models/sfvb_comms_daily_stat.rb +280 -0
  63. data/lib/ultracart_api/models/sfvb_comms_dashboard_response.rb +256 -0
  64. data/lib/ultracart_api/models/sfvb_comms_dashboard_row.rb +269 -0
  65. data/lib/ultracart_api/models/sfvb_comms_lookup_owner.rb +260 -0
  66. data/lib/ultracart_api/models/sfvb_comms_lookup_response.rb +301 -0
  67. data/lib/ultracart_api/models/sfvb_comms_plan.rb +460 -0
  68. data/lib/ultracart_api/models/sfvb_comms_plan_response.rb +231 -0
  69. data/lib/ultracart_api/models/sfvb_comms_provider.rb +272 -0
  70. data/lib/ultracart_api/models/sfvb_comms_provider_import_request.rb +242 -0
  71. data/lib/ultracart_api/models/sfvb_comms_provider_import_response.rb +264 -0
  72. data/lib/ultracart_api/models/sfvb_comms_provider_list.rb +230 -0
  73. data/lib/ultracart_api/models/sfvb_comms_providers_response.rb +244 -0
  74. data/lib/ultracart_api/models/sfvb_comms_ruler_validate_request.rb +220 -0
  75. data/lib/ultracart_api/models/sfvb_comms_ruler_validate_response.rb +242 -0
  76. data/lib/ultracart_api/models/sfvb_comms_sender.rb +250 -0
  77. data/lib/ultracart_api/models/sfvb_comms_sender_update.rb +240 -0
  78. data/lib/ultracart_api/models/sfvb_comms_sequence_folder.rb +270 -0
  79. data/lib/ultracart_api/models/sfvb_comms_sequence_folder_response.rb +243 -0
  80. data/lib/ultracart_api/models/sfvb_comms_sequence_folders_response.rb +222 -0
  81. data/lib/ultracart_api/models/sfvb_comms_sequence_stats_response.rb +263 -0
  82. data/lib/ultracart_api/models/sfvb_comms_settings.rb +297 -0
  83. data/lib/ultracart_api/models/sfvb_comms_settings_response.rb +253 -0
  84. data/lib/ultracart_api/models/sfvb_comms_settings_update_request.rb +257 -0
  85. data/lib/ultracart_api/models/sfvb_comms_stat.rb +402 -0
  86. data/lib/ultracart_api/models/sfvb_comms_step_stat.rb +301 -0
  87. data/lib/ultracart_api/models/sfvb_comms_template.rb +280 -0
  88. data/lib/ultracart_api/models/sfvb_comms_template_response.rb +281 -0
  89. data/lib/ultracart_api/models/sfvb_comms_templates_response.rb +234 -0
  90. data/lib/ultracart_api/models/sfvb_comms_test_email_request.rb +252 -0
  91. data/lib/ultracart_api/models/sfvb_comms_test_postcard_request.rb +312 -0
  92. data/lib/ultracart_api/models/sfvb_comms_test_send_response.rb +292 -0
  93. data/lib/ultracart_api/models/sfvb_comms_test_sms_request.rb +220 -0
  94. data/lib/ultracart_api/models/sfvb_comms_unreferenced_email.rb +280 -0
  95. data/lib/ultracart_api/models/sfvb_comms_unreferenced_postcard.rb +250 -0
  96. data/lib/ultracart_api/models/sfvb_comms_unreferenced_response.rb +296 -0
  97. data/lib/ultracart_api/models/sfvb_email.rb +41 -1
  98. data/lib/ultracart_api/models/sfvb_flow.rb +21 -1
  99. data/lib/ultracart_api/models/sfvb_flow_backfill_request.rb +250 -0
  100. data/lib/ultracart_api/models/sfvb_flow_backfill_response.rb +322 -0
  101. data/lib/ultracart_api/models/sfvb_flow_write_request.rb +11 -1
  102. data/lib/ultracart_api/models/sfvb_step_counts.rb +1 -1
  103. data/lib/ultracart_api/version.rb +1 -1
  104. data/lib/ultracart_api.rb +41 -0
  105. metadata +84 -2
@@ -0,0 +1,252 @@
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 SfvbCommsTestEmailRequest
18
+ # Items for a cart flow's email. The cart is built for the test.
19
+ attr_accessor :cart_item_ids
20
+
21
+ # The email, which this step sends. For an experiment step, one variant's email.
22
+ attr_accessor :email_uuid
23
+
24
+ # A test order to render an order flow's email with. A real customer's order is refused.
25
+ attr_accessor :order_id
26
+
27
+ # The recipient, which must be the email address of a user on this account.
28
+ attr_accessor :to_email
29
+
30
+ # Attribute mapping from ruby-style variable name to JSON key.
31
+ def self.attribute_map
32
+ {
33
+ :'cart_item_ids' => :'cart_item_ids',
34
+ :'email_uuid' => :'email_uuid',
35
+ :'order_id' => :'order_id',
36
+ :'to_email' => :'to_email'
37
+ }
38
+ end
39
+
40
+ # Returns all the JSON keys this model knows about
41
+ def self.acceptable_attributes
42
+ attribute_map.values
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.openapi_types
47
+ {
48
+ :'cart_item_ids' => :'Array<String>',
49
+ :'email_uuid' => :'String',
50
+ :'order_id' => :'String',
51
+ :'to_email' => :'String'
52
+ }
53
+ end
54
+
55
+ # List of attributes with nullable: true
56
+ def self.openapi_nullable
57
+ Set.new([
58
+ ])
59
+ end
60
+
61
+ # Initializes the object
62
+ # @param [Hash] attributes Model attributes in the form of hash
63
+ def initialize(attributes = {})
64
+ if (!attributes.is_a?(Hash))
65
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbCommsTestEmailRequest` initialize method"
66
+ end
67
+
68
+ # check to see if the attribute exists and convert string to symbol for hash key
69
+ attributes = attributes.each_with_object({}) { |(k, v), h|
70
+ if (!self.class.attribute_map.key?(k.to_sym))
71
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbCommsTestEmailRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
72
+ end
73
+ h[k.to_sym] = v
74
+ }
75
+
76
+ if attributes.key?(:'cart_item_ids')
77
+ if (value = attributes[:'cart_item_ids']).is_a?(Array)
78
+ self.cart_item_ids = value
79
+ end
80
+ end
81
+
82
+ if attributes.key?(:'email_uuid')
83
+ self.email_uuid = attributes[:'email_uuid']
84
+ end
85
+
86
+ if attributes.key?(:'order_id')
87
+ self.order_id = attributes[:'order_id']
88
+ end
89
+
90
+ if attributes.key?(:'to_email')
91
+ self.to_email = attributes[:'to_email']
92
+ end
93
+ end
94
+
95
+ # Show invalid properties with the reasons. Usually used together with valid?
96
+ # @return Array for valid properties with the reasons
97
+ def list_invalid_properties
98
+ invalid_properties = Array.new
99
+ invalid_properties
100
+ end
101
+
102
+ # Check to see if the all the properties in the model are valid
103
+ # @return true if the model is valid
104
+ def valid?
105
+ true
106
+ end
107
+
108
+ # Checks equality by comparing each attribute.
109
+ # @param [Object] Object to be compared
110
+ def ==(o)
111
+ return true if self.equal?(o)
112
+ self.class == o.class &&
113
+ cart_item_ids == o.cart_item_ids &&
114
+ email_uuid == o.email_uuid &&
115
+ order_id == o.order_id &&
116
+ to_email == o.to_email
117
+ end
118
+
119
+ # @see the `==` method
120
+ # @param [Object] Object to be compared
121
+ def eql?(o)
122
+ self == o
123
+ end
124
+
125
+ # Calculates hash code according to all attributes.
126
+ # @return [Integer] Hash code
127
+ def hash
128
+ [cart_item_ids, email_uuid, order_id, to_email].hash
129
+ end
130
+
131
+ # Builds the object from hash
132
+ # @param [Hash] attributes Model attributes in the form of hash
133
+ # @return [Object] Returns the model itself
134
+ def self.build_from_hash(attributes)
135
+ new.build_from_hash(attributes)
136
+ end
137
+
138
+ # Builds the object from hash
139
+ # @param [Hash] attributes Model attributes in the form of hash
140
+ # @return [Object] Returns the model itself
141
+ def build_from_hash(attributes)
142
+ return nil unless attributes.is_a?(Hash)
143
+ attributes = attributes.transform_keys(&:to_sym)
144
+ self.class.openapi_types.each_pair do |key, type|
145
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
146
+ self.send("#{key}=", nil)
147
+ elsif type =~ /\AArray<(.*)>/i
148
+ # check to ensure the input is an array given that the attribute
149
+ # is documented as an array but the input is not
150
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
151
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
152
+ end
153
+ elsif !attributes[self.class.attribute_map[key]].nil?
154
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
155
+ end
156
+ end
157
+
158
+ self
159
+ end
160
+
161
+ # Deserializes the data based on type
162
+ # @param string type Data type
163
+ # @param string value Value to be deserialized
164
+ # @return [Object] Deserialized data
165
+ def _deserialize(type, value)
166
+ case type.to_sym
167
+ when :Time
168
+ Time.parse(value)
169
+ when :Date
170
+ Date.parse(value)
171
+ when :String
172
+ value.to_s
173
+ when :Integer
174
+ value.to_i
175
+ when :Float
176
+ value.to_f
177
+ when :Boolean
178
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
179
+ true
180
+ else
181
+ false
182
+ end
183
+ when :Object
184
+ # generic object (usually a Hash), return directly
185
+ value
186
+ when /\AArray<(?<inner_type>.+)>\z/
187
+ inner_type = Regexp.last_match[:inner_type]
188
+ value.map { |v| _deserialize(inner_type, v) }
189
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
190
+ k_type = Regexp.last_match[:k_type]
191
+ v_type = Regexp.last_match[:v_type]
192
+ {}.tap do |hash|
193
+ value.each do |k, v|
194
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
195
+ end
196
+ end
197
+ else # model
198
+ # models (e.g. Pet) or oneOf
199
+ klass = UltracartClient.const_get(type)
200
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
201
+ end
202
+ end
203
+
204
+ # Returns the string representation of the object
205
+ # @return [String] String presentation of the object
206
+ def to_s
207
+ to_hash.to_s
208
+ end
209
+
210
+ # to_body is an alias to to_hash (backward compatibility)
211
+ # @return [Hash] Returns the object in the form of hash
212
+ def to_body
213
+ to_hash
214
+ end
215
+
216
+ # Returns the object in the form of hash
217
+ # @return [Hash] Returns the object in the form of hash
218
+ def to_hash
219
+ hash = {}
220
+ self.class.attribute_map.each_pair do |attr, param|
221
+ value = self.send(attr)
222
+ if value.nil?
223
+ is_nullable = self.class.openapi_nullable.include?(attr)
224
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
225
+ end
226
+
227
+ hash[param] = _to_hash(value)
228
+ end
229
+ hash
230
+ end
231
+
232
+ # Outputs non-array value in the form of hash
233
+ # For object, use to_hash. Otherwise, just return the value
234
+ # @param [Object] value Any valid value
235
+ # @return [Hash] Returns the value in the form of hash
236
+ def _to_hash(value)
237
+ if value.is_a?(Array)
238
+ value.compact.map { |v| _to_hash(v) }
239
+ elsif value.is_a?(Hash)
240
+ {}.tap do |hash|
241
+ value.each { |k, v| hash[k] = _to_hash(v) }
242
+ end
243
+ elsif value.respond_to? :to_hash
244
+ value.to_hash
245
+ else
246
+ value
247
+ end
248
+ end
249
+
250
+ end
251
+
252
+ end
@@ -0,0 +1,312 @@
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 SfvbCommsTestPostcardRequest
18
+ # The street address.
19
+ attr_accessor :address1
20
+
21
+ # The second address line.
22
+ attr_accessor :address2
23
+
24
+ # Items for a cart flow's card.
25
+ attr_accessor :cart_item_ids
26
+
27
+ # The city.
28
+ attr_accessor :city
29
+
30
+ # Check everything, including that postcards are turned on, and show the cost, without mailing or using an approval.
31
+ attr_accessor :dry_run
32
+
33
+ # Must be true. Without it nothing is mailed; use the postcard proof to see the card.
34
+ attr_accessor :mail_card
35
+
36
+ # The recipient's name.
37
+ attr_accessor :name
38
+
39
+ # A test order to render an order flow's card with. A real customer's order is refused.
40
+ attr_accessor :order_id
41
+
42
+ # The postal code.
43
+ attr_accessor :postal_code
44
+
45
+ # The state.
46
+ attr_accessor :state
47
+
48
+ # Attribute mapping from ruby-style variable name to JSON key.
49
+ def self.attribute_map
50
+ {
51
+ :'address1' => :'address1',
52
+ :'address2' => :'address2',
53
+ :'cart_item_ids' => :'cart_item_ids',
54
+ :'city' => :'city',
55
+ :'dry_run' => :'dry_run',
56
+ :'mail_card' => :'mail_card',
57
+ :'name' => :'name',
58
+ :'order_id' => :'order_id',
59
+ :'postal_code' => :'postal_code',
60
+ :'state' => :'state'
61
+ }
62
+ end
63
+
64
+ # Returns all the JSON keys this model knows about
65
+ def self.acceptable_attributes
66
+ attribute_map.values
67
+ end
68
+
69
+ # Attribute type mapping.
70
+ def self.openapi_types
71
+ {
72
+ :'address1' => :'String',
73
+ :'address2' => :'String',
74
+ :'cart_item_ids' => :'Array<String>',
75
+ :'city' => :'String',
76
+ :'dry_run' => :'Boolean',
77
+ :'mail_card' => :'Boolean',
78
+ :'name' => :'String',
79
+ :'order_id' => :'String',
80
+ :'postal_code' => :'String',
81
+ :'state' => :'String'
82
+ }
83
+ end
84
+
85
+ # List of attributes with nullable: true
86
+ def self.openapi_nullable
87
+ Set.new([
88
+ ])
89
+ end
90
+
91
+ # Initializes the object
92
+ # @param [Hash] attributes Model attributes in the form of hash
93
+ def initialize(attributes = {})
94
+ if (!attributes.is_a?(Hash))
95
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbCommsTestPostcardRequest` initialize method"
96
+ end
97
+
98
+ # check to see if the attribute exists and convert string to symbol for hash key
99
+ attributes = attributes.each_with_object({}) { |(k, v), h|
100
+ if (!self.class.attribute_map.key?(k.to_sym))
101
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbCommsTestPostcardRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
102
+ end
103
+ h[k.to_sym] = v
104
+ }
105
+
106
+ if attributes.key?(:'address1')
107
+ self.address1 = attributes[:'address1']
108
+ end
109
+
110
+ if attributes.key?(:'address2')
111
+ self.address2 = attributes[:'address2']
112
+ end
113
+
114
+ if attributes.key?(:'cart_item_ids')
115
+ if (value = attributes[:'cart_item_ids']).is_a?(Array)
116
+ self.cart_item_ids = value
117
+ end
118
+ end
119
+
120
+ if attributes.key?(:'city')
121
+ self.city = attributes[:'city']
122
+ end
123
+
124
+ if attributes.key?(:'dry_run')
125
+ self.dry_run = attributes[:'dry_run']
126
+ end
127
+
128
+ if attributes.key?(:'mail_card')
129
+ self.mail_card = attributes[:'mail_card']
130
+ end
131
+
132
+ if attributes.key?(:'name')
133
+ self.name = attributes[:'name']
134
+ end
135
+
136
+ if attributes.key?(:'order_id')
137
+ self.order_id = attributes[:'order_id']
138
+ end
139
+
140
+ if attributes.key?(:'postal_code')
141
+ self.postal_code = attributes[:'postal_code']
142
+ end
143
+
144
+ if attributes.key?(:'state')
145
+ self.state = attributes[:'state']
146
+ end
147
+ end
148
+
149
+ # Show invalid properties with the reasons. Usually used together with valid?
150
+ # @return Array for valid properties with the reasons
151
+ def list_invalid_properties
152
+ invalid_properties = Array.new
153
+ invalid_properties
154
+ end
155
+
156
+ # Check to see if the all the properties in the model are valid
157
+ # @return true if the model is valid
158
+ def valid?
159
+ true
160
+ end
161
+
162
+ # Checks equality by comparing each attribute.
163
+ # @param [Object] Object to be compared
164
+ def ==(o)
165
+ return true if self.equal?(o)
166
+ self.class == o.class &&
167
+ address1 == o.address1 &&
168
+ address2 == o.address2 &&
169
+ cart_item_ids == o.cart_item_ids &&
170
+ city == o.city &&
171
+ dry_run == o.dry_run &&
172
+ mail_card == o.mail_card &&
173
+ name == o.name &&
174
+ order_id == o.order_id &&
175
+ postal_code == o.postal_code &&
176
+ state == o.state
177
+ end
178
+
179
+ # @see the `==` method
180
+ # @param [Object] Object to be compared
181
+ def eql?(o)
182
+ self == o
183
+ end
184
+
185
+ # Calculates hash code according to all attributes.
186
+ # @return [Integer] Hash code
187
+ def hash
188
+ [address1, address2, cart_item_ids, city, dry_run, mail_card, name, order_id, postal_code, state].hash
189
+ end
190
+
191
+ # Builds the object from hash
192
+ # @param [Hash] attributes Model attributes in the form of hash
193
+ # @return [Object] Returns the model itself
194
+ def self.build_from_hash(attributes)
195
+ new.build_from_hash(attributes)
196
+ end
197
+
198
+ # Builds the object from hash
199
+ # @param [Hash] attributes Model attributes in the form of hash
200
+ # @return [Object] Returns the model itself
201
+ def build_from_hash(attributes)
202
+ return nil unless attributes.is_a?(Hash)
203
+ attributes = attributes.transform_keys(&:to_sym)
204
+ self.class.openapi_types.each_pair do |key, type|
205
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
206
+ self.send("#{key}=", nil)
207
+ elsif type =~ /\AArray<(.*)>/i
208
+ # check to ensure the input is an array given that the attribute
209
+ # is documented as an array but the input is not
210
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
211
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
212
+ end
213
+ elsif !attributes[self.class.attribute_map[key]].nil?
214
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
215
+ end
216
+ end
217
+
218
+ self
219
+ end
220
+
221
+ # Deserializes the data based on type
222
+ # @param string type Data type
223
+ # @param string value Value to be deserialized
224
+ # @return [Object] Deserialized data
225
+ def _deserialize(type, value)
226
+ case type.to_sym
227
+ when :Time
228
+ Time.parse(value)
229
+ when :Date
230
+ Date.parse(value)
231
+ when :String
232
+ value.to_s
233
+ when :Integer
234
+ value.to_i
235
+ when :Float
236
+ value.to_f
237
+ when :Boolean
238
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
239
+ true
240
+ else
241
+ false
242
+ end
243
+ when :Object
244
+ # generic object (usually a Hash), return directly
245
+ value
246
+ when /\AArray<(?<inner_type>.+)>\z/
247
+ inner_type = Regexp.last_match[:inner_type]
248
+ value.map { |v| _deserialize(inner_type, v) }
249
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
250
+ k_type = Regexp.last_match[:k_type]
251
+ v_type = Regexp.last_match[:v_type]
252
+ {}.tap do |hash|
253
+ value.each do |k, v|
254
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
255
+ end
256
+ end
257
+ else # model
258
+ # models (e.g. Pet) or oneOf
259
+ klass = UltracartClient.const_get(type)
260
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
261
+ end
262
+ end
263
+
264
+ # Returns the string representation of the object
265
+ # @return [String] String presentation of the object
266
+ def to_s
267
+ to_hash.to_s
268
+ end
269
+
270
+ # to_body is an alias to to_hash (backward compatibility)
271
+ # @return [Hash] Returns the object in the form of hash
272
+ def to_body
273
+ to_hash
274
+ end
275
+
276
+ # Returns the object in the form of hash
277
+ # @return [Hash] Returns the object in the form of hash
278
+ def to_hash
279
+ hash = {}
280
+ self.class.attribute_map.each_pair do |attr, param|
281
+ value = self.send(attr)
282
+ if value.nil?
283
+ is_nullable = self.class.openapi_nullable.include?(attr)
284
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
285
+ end
286
+
287
+ hash[param] = _to_hash(value)
288
+ end
289
+ hash
290
+ end
291
+
292
+ # Outputs non-array value in the form of hash
293
+ # For object, use to_hash. Otherwise, just return the value
294
+ # @param [Object] value Any valid value
295
+ # @return [Hash] Returns the value in the form of hash
296
+ def _to_hash(value)
297
+ if value.is_a?(Array)
298
+ value.compact.map { |v| _to_hash(v) }
299
+ elsif value.is_a?(Hash)
300
+ {}.tap do |hash|
301
+ value.each { |k, v| hash[k] = _to_hash(v) }
302
+ end
303
+ elsif value.respond_to? :to_hash
304
+ value.to_hash
305
+ else
306
+ value
307
+ end
308
+ end
309
+
310
+ end
311
+
312
+ end