ultracart_api 4.1.208 → 4.1.210
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 +26 -2
- data/docs/SfvbApi.md +717 -48
- data/docs/SfvbArchiveRequest.md +18 -0
- data/docs/SfvbCampaign.md +16 -0
- data/docs/SfvbCampaignMembership.md +24 -0
- data/docs/SfvbCampaignWriteRequest.md +32 -0
- data/docs/SfvbCommsEmail.md +6 -0
- data/docs/SfvbCommsList.md +24 -0
- data/docs/SfvbCommsListsResponse.md +18 -0
- data/docs/SfvbCommsSegment.md +26 -0
- data/docs/SfvbCommsSegmentsResponse.md +18 -0
- data/docs/SfvbEmail.md +2 -0
- data/docs/SfvbEmailReviewRequest.md +18 -0
- data/docs/SfvbFlow.md +22 -0
- data/docs/SfvbFlowStatusRequest.md +18 -0
- data/docs/SfvbFlowWriteRequest.md +38 -0
- data/lib/ultracart_api/api/sfvb_api.rb +1027 -88
- data/lib/ultracart_api/models/sfvb_archive_request.rb +220 -0
- data/lib/ultracart_api/models/sfvb_campaign.rb +85 -1
- data/lib/ultracart_api/models/sfvb_campaign_membership.rb +250 -0
- data/lib/ultracart_api/models/sfvb_campaign_write_request.rb +292 -0
- data/lib/ultracart_api/models/sfvb_comms_email.rb +31 -1
- data/lib/ultracart_api/models/sfvb_comms_list.rb +250 -0
- data/lib/ultracart_api/models/sfvb_comms_lists_response.rb +222 -0
- data/lib/ultracart_api/models/sfvb_comms_segment.rb +260 -0
- data/lib/ultracart_api/models/sfvb_comms_segments_response.rb +222 -0
- data/lib/ultracart_api/models/sfvb_email.rb +13 -1
- data/lib/ultracart_api/models/sfvb_email_review_request.rb +220 -0
- data/lib/ultracart_api/models/sfvb_flow.rb +113 -1
- data/lib/ultracart_api/models/sfvb_flow_status_request.rb +254 -0
- data/lib/ultracart_api/models/sfvb_flow_write_request.rb +354 -0
- data/lib/ultracart_api/version.rb +1 -1
- data/lib/ultracart_api.rb +10 -0
- metadata +22 -2
|
@@ -0,0 +1,292 @@
|
|
|
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 SfvbCampaignWriteRequest
|
|
18
|
+
# True to end the campaign for a customer once they buy from one of its emails.
|
|
19
|
+
attr_accessor :end_once_customer_purchases
|
|
20
|
+
|
|
21
|
+
# True to end the campaign for a customer once they buy from any source.
|
|
22
|
+
attr_accessor :end_once_customer_purchases_anywhere
|
|
23
|
+
|
|
24
|
+
# The lists and segments it sends to or leaves out. Replaces the whole set. An empty array clears it.
|
|
25
|
+
attr_accessor :memberships
|
|
26
|
+
|
|
27
|
+
# The campaign name, 1 to 250 characters. Required to create.
|
|
28
|
+
attr_accessor :name
|
|
29
|
+
|
|
30
|
+
# When to send once started (ISO 8601). An empty string clears the schedule.
|
|
31
|
+
attr_accessor :scheduled_dts
|
|
32
|
+
|
|
33
|
+
# The sending domain uuid. Defaults to the storefront's marketing sending domain.
|
|
34
|
+
attr_accessor :sending_domain_uuid
|
|
35
|
+
|
|
36
|
+
# The from name. Defaults to the storefront's marketing setting.
|
|
37
|
+
attr_accessor :sending_name
|
|
38
|
+
|
|
39
|
+
# The part of the from address before the at sign. Defaults to the storefront's marketing setting.
|
|
40
|
+
attr_accessor :sending_user
|
|
41
|
+
|
|
42
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
43
|
+
def self.attribute_map
|
|
44
|
+
{
|
|
45
|
+
:'end_once_customer_purchases' => :'end_once_customer_purchases',
|
|
46
|
+
:'end_once_customer_purchases_anywhere' => :'end_once_customer_purchases_anywhere',
|
|
47
|
+
:'memberships' => :'memberships',
|
|
48
|
+
:'name' => :'name',
|
|
49
|
+
:'scheduled_dts' => :'scheduled_dts',
|
|
50
|
+
:'sending_domain_uuid' => :'sending_domain_uuid',
|
|
51
|
+
:'sending_name' => :'sending_name',
|
|
52
|
+
:'sending_user' => :'sending_user'
|
|
53
|
+
}
|
|
54
|
+
end
|
|
55
|
+
|
|
56
|
+
# Returns all the JSON keys this model knows about
|
|
57
|
+
def self.acceptable_attributes
|
|
58
|
+
attribute_map.values
|
|
59
|
+
end
|
|
60
|
+
|
|
61
|
+
# Attribute type mapping.
|
|
62
|
+
def self.openapi_types
|
|
63
|
+
{
|
|
64
|
+
:'end_once_customer_purchases' => :'Boolean',
|
|
65
|
+
:'end_once_customer_purchases_anywhere' => :'Boolean',
|
|
66
|
+
:'memberships' => :'Array<SfvbCampaignMembership>',
|
|
67
|
+
:'name' => :'String',
|
|
68
|
+
:'scheduled_dts' => :'String',
|
|
69
|
+
:'sending_domain_uuid' => :'String',
|
|
70
|
+
:'sending_name' => :'String',
|
|
71
|
+
:'sending_user' => :'String'
|
|
72
|
+
}
|
|
73
|
+
end
|
|
74
|
+
|
|
75
|
+
# List of attributes with nullable: true
|
|
76
|
+
def self.openapi_nullable
|
|
77
|
+
Set.new([
|
|
78
|
+
])
|
|
79
|
+
end
|
|
80
|
+
|
|
81
|
+
# Initializes the object
|
|
82
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
83
|
+
def initialize(attributes = {})
|
|
84
|
+
if (!attributes.is_a?(Hash))
|
|
85
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbCampaignWriteRequest` initialize method"
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
|
89
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
|
90
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
|
91
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbCampaignWriteRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
|
92
|
+
end
|
|
93
|
+
h[k.to_sym] = v
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
if attributes.key?(:'end_once_customer_purchases')
|
|
97
|
+
self.end_once_customer_purchases = attributes[:'end_once_customer_purchases']
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
if attributes.key?(:'end_once_customer_purchases_anywhere')
|
|
101
|
+
self.end_once_customer_purchases_anywhere = attributes[:'end_once_customer_purchases_anywhere']
|
|
102
|
+
end
|
|
103
|
+
|
|
104
|
+
if attributes.key?(:'memberships')
|
|
105
|
+
if (value = attributes[:'memberships']).is_a?(Array)
|
|
106
|
+
self.memberships = value
|
|
107
|
+
end
|
|
108
|
+
end
|
|
109
|
+
|
|
110
|
+
if attributes.key?(:'name')
|
|
111
|
+
self.name = attributes[:'name']
|
|
112
|
+
end
|
|
113
|
+
|
|
114
|
+
if attributes.key?(:'scheduled_dts')
|
|
115
|
+
self.scheduled_dts = attributes[:'scheduled_dts']
|
|
116
|
+
end
|
|
117
|
+
|
|
118
|
+
if attributes.key?(:'sending_domain_uuid')
|
|
119
|
+
self.sending_domain_uuid = attributes[:'sending_domain_uuid']
|
|
120
|
+
end
|
|
121
|
+
|
|
122
|
+
if attributes.key?(:'sending_name')
|
|
123
|
+
self.sending_name = attributes[:'sending_name']
|
|
124
|
+
end
|
|
125
|
+
|
|
126
|
+
if attributes.key?(:'sending_user')
|
|
127
|
+
self.sending_user = attributes[:'sending_user']
|
|
128
|
+
end
|
|
129
|
+
end
|
|
130
|
+
|
|
131
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
132
|
+
# @return Array for valid properties with the reasons
|
|
133
|
+
def list_invalid_properties
|
|
134
|
+
invalid_properties = Array.new
|
|
135
|
+
invalid_properties
|
|
136
|
+
end
|
|
137
|
+
|
|
138
|
+
# Check to see if the all the properties in the model are valid
|
|
139
|
+
# @return true if the model is valid
|
|
140
|
+
def valid?
|
|
141
|
+
true
|
|
142
|
+
end
|
|
143
|
+
|
|
144
|
+
# Checks equality by comparing each attribute.
|
|
145
|
+
# @param [Object] Object to be compared
|
|
146
|
+
def ==(o)
|
|
147
|
+
return true if self.equal?(o)
|
|
148
|
+
self.class == o.class &&
|
|
149
|
+
end_once_customer_purchases == o.end_once_customer_purchases &&
|
|
150
|
+
end_once_customer_purchases_anywhere == o.end_once_customer_purchases_anywhere &&
|
|
151
|
+
memberships == o.memberships &&
|
|
152
|
+
name == o.name &&
|
|
153
|
+
scheduled_dts == o.scheduled_dts &&
|
|
154
|
+
sending_domain_uuid == o.sending_domain_uuid &&
|
|
155
|
+
sending_name == o.sending_name &&
|
|
156
|
+
sending_user == o.sending_user
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# @see the `==` method
|
|
160
|
+
# @param [Object] Object to be compared
|
|
161
|
+
def eql?(o)
|
|
162
|
+
self == o
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# Calculates hash code according to all attributes.
|
|
166
|
+
# @return [Integer] Hash code
|
|
167
|
+
def hash
|
|
168
|
+
[end_once_customer_purchases, end_once_customer_purchases_anywhere, memberships, name, scheduled_dts, sending_domain_uuid, sending_name, sending_user].hash
|
|
169
|
+
end
|
|
170
|
+
|
|
171
|
+
# Builds the object from hash
|
|
172
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
173
|
+
# @return [Object] Returns the model itself
|
|
174
|
+
def self.build_from_hash(attributes)
|
|
175
|
+
new.build_from_hash(attributes)
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
# Builds the object from hash
|
|
179
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
180
|
+
# @return [Object] Returns the model itself
|
|
181
|
+
def build_from_hash(attributes)
|
|
182
|
+
return nil unless attributes.is_a?(Hash)
|
|
183
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
184
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
185
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
186
|
+
self.send("#{key}=", nil)
|
|
187
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
188
|
+
# check to ensure the input is an array given that the attribute
|
|
189
|
+
# is documented as an array but the input is not
|
|
190
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
191
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
192
|
+
end
|
|
193
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
194
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
195
|
+
end
|
|
196
|
+
end
|
|
197
|
+
|
|
198
|
+
self
|
|
199
|
+
end
|
|
200
|
+
|
|
201
|
+
# Deserializes the data based on type
|
|
202
|
+
# @param string type Data type
|
|
203
|
+
# @param string value Value to be deserialized
|
|
204
|
+
# @return [Object] Deserialized data
|
|
205
|
+
def _deserialize(type, value)
|
|
206
|
+
case type.to_sym
|
|
207
|
+
when :Time
|
|
208
|
+
Time.parse(value)
|
|
209
|
+
when :Date
|
|
210
|
+
Date.parse(value)
|
|
211
|
+
when :String
|
|
212
|
+
value.to_s
|
|
213
|
+
when :Integer
|
|
214
|
+
value.to_i
|
|
215
|
+
when :Float
|
|
216
|
+
value.to_f
|
|
217
|
+
when :Boolean
|
|
218
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
219
|
+
true
|
|
220
|
+
else
|
|
221
|
+
false
|
|
222
|
+
end
|
|
223
|
+
when :Object
|
|
224
|
+
# generic object (usually a Hash), return directly
|
|
225
|
+
value
|
|
226
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
227
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
228
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
229
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
230
|
+
k_type = Regexp.last_match[:k_type]
|
|
231
|
+
v_type = Regexp.last_match[:v_type]
|
|
232
|
+
{}.tap do |hash|
|
|
233
|
+
value.each do |k, v|
|
|
234
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
235
|
+
end
|
|
236
|
+
end
|
|
237
|
+
else # model
|
|
238
|
+
# models (e.g. Pet) or oneOf
|
|
239
|
+
klass = UltracartClient.const_get(type)
|
|
240
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
241
|
+
end
|
|
242
|
+
end
|
|
243
|
+
|
|
244
|
+
# Returns the string representation of the object
|
|
245
|
+
# @return [String] String presentation of the object
|
|
246
|
+
def to_s
|
|
247
|
+
to_hash.to_s
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
251
|
+
# @return [Hash] Returns the object in the form of hash
|
|
252
|
+
def to_body
|
|
253
|
+
to_hash
|
|
254
|
+
end
|
|
255
|
+
|
|
256
|
+
# Returns the object in the form of hash
|
|
257
|
+
# @return [Hash] Returns the object in the form of hash
|
|
258
|
+
def to_hash
|
|
259
|
+
hash = {}
|
|
260
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
261
|
+
value = self.send(attr)
|
|
262
|
+
if value.nil?
|
|
263
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
264
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
265
|
+
end
|
|
266
|
+
|
|
267
|
+
hash[param] = _to_hash(value)
|
|
268
|
+
end
|
|
269
|
+
hash
|
|
270
|
+
end
|
|
271
|
+
|
|
272
|
+
# Outputs non-array value in the form of hash
|
|
273
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
274
|
+
# @param [Object] value Any valid value
|
|
275
|
+
# @return [Hash] Returns the value in the form of hash
|
|
276
|
+
def _to_hash(value)
|
|
277
|
+
if value.is_a?(Array)
|
|
278
|
+
value.compact.map { |v| _to_hash(v) }
|
|
279
|
+
elsif value.is_a?(Hash)
|
|
280
|
+
{}.tap do |hash|
|
|
281
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
282
|
+
end
|
|
283
|
+
elsif value.respond_to? :to_hash
|
|
284
|
+
value.to_hash
|
|
285
|
+
else
|
|
286
|
+
value
|
|
287
|
+
end
|
|
288
|
+
end
|
|
289
|
+
|
|
290
|
+
end
|
|
291
|
+
|
|
292
|
+
end
|
|
@@ -45,6 +45,15 @@ module UltracartClient
|
|
|
45
45
|
# True for a transactional email, which skips the marketing footer rules.
|
|
46
46
|
attr_accessor :transactional
|
|
47
47
|
|
|
48
|
+
# For an email in an experiment step, the variant name. Absent otherwise.
|
|
49
|
+
attr_accessor :variant_name
|
|
50
|
+
|
|
51
|
+
# For an email in an experiment step, the share of customers it is sent to.
|
|
52
|
+
attr_accessor :variant_percentage
|
|
53
|
+
|
|
54
|
+
# For an email in an experiment step, true when the experiment chose it as the winner.
|
|
55
|
+
attr_accessor :variant_winner
|
|
56
|
+
|
|
48
57
|
# The email version.
|
|
49
58
|
attr_accessor :version
|
|
50
59
|
|
|
@@ -61,6 +70,9 @@ module UltracartClient
|
|
|
61
70
|
:'step_uuid' => :'step_uuid',
|
|
62
71
|
:'subject' => :'subject',
|
|
63
72
|
:'transactional' => :'transactional',
|
|
73
|
+
:'variant_name' => :'variant_name',
|
|
74
|
+
:'variant_percentage' => :'variant_percentage',
|
|
75
|
+
:'variant_winner' => :'variant_winner',
|
|
64
76
|
:'version' => :'version'
|
|
65
77
|
}
|
|
66
78
|
end
|
|
@@ -83,6 +95,9 @@ module UltracartClient
|
|
|
83
95
|
:'step_uuid' => :'String',
|
|
84
96
|
:'subject' => :'String',
|
|
85
97
|
:'transactional' => :'Boolean',
|
|
98
|
+
:'variant_name' => :'String',
|
|
99
|
+
:'variant_percentage' => :'Float',
|
|
100
|
+
:'variant_winner' => :'Boolean',
|
|
86
101
|
:'version' => :'Integer'
|
|
87
102
|
}
|
|
88
103
|
end
|
|
@@ -148,6 +163,18 @@ module UltracartClient
|
|
|
148
163
|
self.transactional = attributes[:'transactional']
|
|
149
164
|
end
|
|
150
165
|
|
|
166
|
+
if attributes.key?(:'variant_name')
|
|
167
|
+
self.variant_name = attributes[:'variant_name']
|
|
168
|
+
end
|
|
169
|
+
|
|
170
|
+
if attributes.key?(:'variant_percentage')
|
|
171
|
+
self.variant_percentage = attributes[:'variant_percentage']
|
|
172
|
+
end
|
|
173
|
+
|
|
174
|
+
if attributes.key?(:'variant_winner')
|
|
175
|
+
self.variant_winner = attributes[:'variant_winner']
|
|
176
|
+
end
|
|
177
|
+
|
|
151
178
|
if attributes.key?(:'version')
|
|
152
179
|
self.version = attributes[:'version']
|
|
153
180
|
end
|
|
@@ -181,6 +208,9 @@ module UltracartClient
|
|
|
181
208
|
step_uuid == o.step_uuid &&
|
|
182
209
|
subject == o.subject &&
|
|
183
210
|
transactional == o.transactional &&
|
|
211
|
+
variant_name == o.variant_name &&
|
|
212
|
+
variant_percentage == o.variant_percentage &&
|
|
213
|
+
variant_winner == o.variant_winner &&
|
|
184
214
|
version == o.version
|
|
185
215
|
end
|
|
186
216
|
|
|
@@ -193,7 +223,7 @@ module UltracartClient
|
|
|
193
223
|
# Calculates hash code according to all attributes.
|
|
194
224
|
# @return [Integer] Hash code
|
|
195
225
|
def hash
|
|
196
|
-
[container_last_modified_dts, deleted, email_uuid, pending_review, preview_text, rejected, requires_review, step_uuid, subject, transactional, version].hash
|
|
226
|
+
[container_last_modified_dts, deleted, email_uuid, pending_review, preview_text, rejected, requires_review, step_uuid, subject, transactional, variant_name, variant_percentage, variant_winner, version].hash
|
|
197
227
|
end
|
|
198
228
|
|
|
199
229
|
# Builds the object from hash
|
|
@@ -0,0 +1,250 @@
|
|
|
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 SfvbCommsList
|
|
18
|
+
# When it was created (ISO 8601, UTC).
|
|
19
|
+
attr_accessor :created_dts
|
|
20
|
+
|
|
21
|
+
# The list uuid.
|
|
22
|
+
attr_accessor :list_uuid
|
|
23
|
+
|
|
24
|
+
# How many customers are on it.
|
|
25
|
+
attr_accessor :member_count
|
|
26
|
+
|
|
27
|
+
# The list name.
|
|
28
|
+
attr_accessor :name
|
|
29
|
+
|
|
30
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
|
31
|
+
def self.attribute_map
|
|
32
|
+
{
|
|
33
|
+
:'created_dts' => :'created_dts',
|
|
34
|
+
:'list_uuid' => :'list_uuid',
|
|
35
|
+
:'member_count' => :'member_count',
|
|
36
|
+
:'name' => :'name'
|
|
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
|
+
:'created_dts' => :'String',
|
|
49
|
+
:'list_uuid' => :'String',
|
|
50
|
+
:'member_count' => :'Integer',
|
|
51
|
+
:'name' => :'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::SfvbCommsList` 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::SfvbCommsList`. 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?(:'created_dts')
|
|
77
|
+
self.created_dts = attributes[:'created_dts']
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
if attributes.key?(:'list_uuid')
|
|
81
|
+
self.list_uuid = attributes[:'list_uuid']
|
|
82
|
+
end
|
|
83
|
+
|
|
84
|
+
if attributes.key?(:'member_count')
|
|
85
|
+
self.member_count = attributes[:'member_count']
|
|
86
|
+
end
|
|
87
|
+
|
|
88
|
+
if attributes.key?(:'name')
|
|
89
|
+
self.name = attributes[:'name']
|
|
90
|
+
end
|
|
91
|
+
end
|
|
92
|
+
|
|
93
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
|
94
|
+
# @return Array for valid properties with the reasons
|
|
95
|
+
def list_invalid_properties
|
|
96
|
+
invalid_properties = Array.new
|
|
97
|
+
invalid_properties
|
|
98
|
+
end
|
|
99
|
+
|
|
100
|
+
# Check to see if the all the properties in the model are valid
|
|
101
|
+
# @return true if the model is valid
|
|
102
|
+
def valid?
|
|
103
|
+
true
|
|
104
|
+
end
|
|
105
|
+
|
|
106
|
+
# Checks equality by comparing each attribute.
|
|
107
|
+
# @param [Object] Object to be compared
|
|
108
|
+
def ==(o)
|
|
109
|
+
return true if self.equal?(o)
|
|
110
|
+
self.class == o.class &&
|
|
111
|
+
created_dts == o.created_dts &&
|
|
112
|
+
list_uuid == o.list_uuid &&
|
|
113
|
+
member_count == o.member_count &&
|
|
114
|
+
name == o.name
|
|
115
|
+
end
|
|
116
|
+
|
|
117
|
+
# @see the `==` method
|
|
118
|
+
# @param [Object] Object to be compared
|
|
119
|
+
def eql?(o)
|
|
120
|
+
self == o
|
|
121
|
+
end
|
|
122
|
+
|
|
123
|
+
# Calculates hash code according to all attributes.
|
|
124
|
+
# @return [Integer] Hash code
|
|
125
|
+
def hash
|
|
126
|
+
[created_dts, list_uuid, member_count, name].hash
|
|
127
|
+
end
|
|
128
|
+
|
|
129
|
+
# Builds the object from hash
|
|
130
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
131
|
+
# @return [Object] Returns the model itself
|
|
132
|
+
def self.build_from_hash(attributes)
|
|
133
|
+
new.build_from_hash(attributes)
|
|
134
|
+
end
|
|
135
|
+
|
|
136
|
+
# Builds the object from hash
|
|
137
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
|
138
|
+
# @return [Object] Returns the model itself
|
|
139
|
+
def build_from_hash(attributes)
|
|
140
|
+
return nil unless attributes.is_a?(Hash)
|
|
141
|
+
attributes = attributes.transform_keys(&:to_sym)
|
|
142
|
+
self.class.openapi_types.each_pair do |key, type|
|
|
143
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
|
144
|
+
self.send("#{key}=", nil)
|
|
145
|
+
elsif type =~ /\AArray<(.*)>/i
|
|
146
|
+
# check to ensure the input is an array given that the attribute
|
|
147
|
+
# is documented as an array but the input is not
|
|
148
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
|
149
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
|
150
|
+
end
|
|
151
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
|
152
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
|
153
|
+
end
|
|
154
|
+
end
|
|
155
|
+
|
|
156
|
+
self
|
|
157
|
+
end
|
|
158
|
+
|
|
159
|
+
# Deserializes the data based on type
|
|
160
|
+
# @param string type Data type
|
|
161
|
+
# @param string value Value to be deserialized
|
|
162
|
+
# @return [Object] Deserialized data
|
|
163
|
+
def _deserialize(type, value)
|
|
164
|
+
case type.to_sym
|
|
165
|
+
when :Time
|
|
166
|
+
Time.parse(value)
|
|
167
|
+
when :Date
|
|
168
|
+
Date.parse(value)
|
|
169
|
+
when :String
|
|
170
|
+
value.to_s
|
|
171
|
+
when :Integer
|
|
172
|
+
value.to_i
|
|
173
|
+
when :Float
|
|
174
|
+
value.to_f
|
|
175
|
+
when :Boolean
|
|
176
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
|
177
|
+
true
|
|
178
|
+
else
|
|
179
|
+
false
|
|
180
|
+
end
|
|
181
|
+
when :Object
|
|
182
|
+
# generic object (usually a Hash), return directly
|
|
183
|
+
value
|
|
184
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
|
185
|
+
inner_type = Regexp.last_match[:inner_type]
|
|
186
|
+
value.map { |v| _deserialize(inner_type, v) }
|
|
187
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
|
188
|
+
k_type = Regexp.last_match[:k_type]
|
|
189
|
+
v_type = Regexp.last_match[:v_type]
|
|
190
|
+
{}.tap do |hash|
|
|
191
|
+
value.each do |k, v|
|
|
192
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
|
193
|
+
end
|
|
194
|
+
end
|
|
195
|
+
else # model
|
|
196
|
+
# models (e.g. Pet) or oneOf
|
|
197
|
+
klass = UltracartClient.const_get(type)
|
|
198
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
|
199
|
+
end
|
|
200
|
+
end
|
|
201
|
+
|
|
202
|
+
# Returns the string representation of the object
|
|
203
|
+
# @return [String] String presentation of the object
|
|
204
|
+
def to_s
|
|
205
|
+
to_hash.to_s
|
|
206
|
+
end
|
|
207
|
+
|
|
208
|
+
# to_body is an alias to to_hash (backward compatibility)
|
|
209
|
+
# @return [Hash] Returns the object in the form of hash
|
|
210
|
+
def to_body
|
|
211
|
+
to_hash
|
|
212
|
+
end
|
|
213
|
+
|
|
214
|
+
# Returns the object in the form of hash
|
|
215
|
+
# @return [Hash] Returns the object in the form of hash
|
|
216
|
+
def to_hash
|
|
217
|
+
hash = {}
|
|
218
|
+
self.class.attribute_map.each_pair do |attr, param|
|
|
219
|
+
value = self.send(attr)
|
|
220
|
+
if value.nil?
|
|
221
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
|
222
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
|
223
|
+
end
|
|
224
|
+
|
|
225
|
+
hash[param] = _to_hash(value)
|
|
226
|
+
end
|
|
227
|
+
hash
|
|
228
|
+
end
|
|
229
|
+
|
|
230
|
+
# Outputs non-array value in the form of hash
|
|
231
|
+
# For object, use to_hash. Otherwise, just return the value
|
|
232
|
+
# @param [Object] value Any valid value
|
|
233
|
+
# @return [Hash] Returns the value in the form of hash
|
|
234
|
+
def _to_hash(value)
|
|
235
|
+
if value.is_a?(Array)
|
|
236
|
+
value.compact.map { |v| _to_hash(v) }
|
|
237
|
+
elsif value.is_a?(Hash)
|
|
238
|
+
{}.tap do |hash|
|
|
239
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
|
240
|
+
end
|
|
241
|
+
elsif value.respond_to? :to_hash
|
|
242
|
+
value.to_hash
|
|
243
|
+
else
|
|
244
|
+
value
|
|
245
|
+
end
|
|
246
|
+
end
|
|
247
|
+
|
|
248
|
+
end
|
|
249
|
+
|
|
250
|
+
end
|