ultracart_api 4.0.45.rc → 4.0.48.rc
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -4
- data/docs/ConversationAgentAuth.md +2 -2
- data/docs/ConversationEventRRWeb.md +30 -0
- data/docs/ConversationMessage.md +4 -0
- data/docs/ConversationSummary.md +5 -1
- data/docs/ConversationTwilioAccount.md +20 -0
- data/docs/ConversationWebsocketMessage.md +2 -0
- data/docs/EmailCommseqSequenceTestRequest.md +32 -0
- data/docs/EmailCommseqSequenceTestResponse.md +24 -0
- data/docs/StorefrontApi.md +74 -0
- data/lib/ultracart_api/api/storefront_api.rb +79 -0
- data/lib/ultracart_api/models/conversation_agent_auth.rb +8 -8
- data/lib/ultracart_api/models/conversation_event_rr_web.rb +308 -0
- data/lib/ultracart_api/models/conversation_message.rb +54 -1
- data/lib/ultracart_api/models/conversation_summary.rb +23 -4
- data/lib/ultracart_api/models/conversation_twilio_account.rb +230 -0
- data/lib/ultracart_api/models/conversation_websocket_message.rb +14 -5
- data/lib/ultracart_api/models/email_commseq_sequence_test_request.rb +284 -0
- data/lib/ultracart_api/models/email_commseq_sequence_test_response.rb +247 -0
- data/lib/ultracart_api/version.rb +1 -1
- data/lib/ultracart_api.rb +4 -0
- metadata +10 -2
@@ -0,0 +1,230 @@
|
|
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 ConversationTwilioAccount
|
18
|
+
attr_accessor :merchant_id
|
19
|
+
|
20
|
+
attr_accessor :twilio_phone_numbers
|
21
|
+
|
22
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
23
|
+
def self.attribute_map
|
24
|
+
{
|
25
|
+
:'merchant_id' => :'merchant_id',
|
26
|
+
:'twilio_phone_numbers' => :'twilio_phone_numbers'
|
27
|
+
}
|
28
|
+
end
|
29
|
+
|
30
|
+
# Returns all the JSON keys this model knows about
|
31
|
+
def self.acceptable_attributes
|
32
|
+
attribute_map.values
|
33
|
+
end
|
34
|
+
|
35
|
+
# Attribute type mapping.
|
36
|
+
def self.openapi_types
|
37
|
+
{
|
38
|
+
:'merchant_id' => :'String',
|
39
|
+
:'twilio_phone_numbers' => :'Array<String>'
|
40
|
+
}
|
41
|
+
end
|
42
|
+
|
43
|
+
# List of attributes with nullable: true
|
44
|
+
def self.openapi_nullable
|
45
|
+
Set.new([
|
46
|
+
])
|
47
|
+
end
|
48
|
+
|
49
|
+
# Initializes the object
|
50
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
51
|
+
def initialize(attributes = {})
|
52
|
+
if (!attributes.is_a?(Hash))
|
53
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::ConversationTwilioAccount` initialize method"
|
54
|
+
end
|
55
|
+
|
56
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
57
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
58
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
59
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::ConversationTwilioAccount`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
60
|
+
end
|
61
|
+
h[k.to_sym] = v
|
62
|
+
}
|
63
|
+
|
64
|
+
if attributes.key?(:'merchant_id')
|
65
|
+
self.merchant_id = attributes[:'merchant_id']
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.key?(:'twilio_phone_numbers')
|
69
|
+
if (value = attributes[:'twilio_phone_numbers']).is_a?(Array)
|
70
|
+
self.twilio_phone_numbers = value
|
71
|
+
end
|
72
|
+
end
|
73
|
+
end
|
74
|
+
|
75
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
76
|
+
# @return Array for valid properties with the reasons
|
77
|
+
def list_invalid_properties
|
78
|
+
invalid_properties = Array.new
|
79
|
+
invalid_properties
|
80
|
+
end
|
81
|
+
|
82
|
+
# Check to see if the all the properties in the model are valid
|
83
|
+
# @return true if the model is valid
|
84
|
+
def valid?
|
85
|
+
true
|
86
|
+
end
|
87
|
+
|
88
|
+
# Checks equality by comparing each attribute.
|
89
|
+
# @param [Object] Object to be compared
|
90
|
+
def ==(o)
|
91
|
+
return true if self.equal?(o)
|
92
|
+
self.class == o.class &&
|
93
|
+
merchant_id == o.merchant_id &&
|
94
|
+
twilio_phone_numbers == o.twilio_phone_numbers
|
95
|
+
end
|
96
|
+
|
97
|
+
# @see the `==` method
|
98
|
+
# @param [Object] Object to be compared
|
99
|
+
def eql?(o)
|
100
|
+
self == o
|
101
|
+
end
|
102
|
+
|
103
|
+
# Calculates hash code according to all attributes.
|
104
|
+
# @return [Integer] Hash code
|
105
|
+
def hash
|
106
|
+
[merchant_id, twilio_phone_numbers].hash
|
107
|
+
end
|
108
|
+
|
109
|
+
# Builds the object from hash
|
110
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
111
|
+
# @return [Object] Returns the model itself
|
112
|
+
def self.build_from_hash(attributes)
|
113
|
+
new.build_from_hash(attributes)
|
114
|
+
end
|
115
|
+
|
116
|
+
# Builds the object from hash
|
117
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
118
|
+
# @return [Object] Returns the model itself
|
119
|
+
def build_from_hash(attributes)
|
120
|
+
return nil unless attributes.is_a?(Hash)
|
121
|
+
attributes = attributes.transform_keys(&:to_sym)
|
122
|
+
self.class.openapi_types.each_pair do |key, type|
|
123
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
124
|
+
self.send("#{key}=", nil)
|
125
|
+
elsif type =~ /\AArray<(.*)>/i
|
126
|
+
# check to ensure the input is an array given that the attribute
|
127
|
+
# is documented as an array but the input is not
|
128
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
129
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
130
|
+
end
|
131
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
132
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
133
|
+
end
|
134
|
+
end
|
135
|
+
|
136
|
+
self
|
137
|
+
end
|
138
|
+
|
139
|
+
# Deserializes the data based on type
|
140
|
+
# @param string type Data type
|
141
|
+
# @param string value Value to be deserialized
|
142
|
+
# @return [Object] Deserialized data
|
143
|
+
def _deserialize(type, value)
|
144
|
+
case type.to_sym
|
145
|
+
when :Time
|
146
|
+
Time.parse(value)
|
147
|
+
when :Date
|
148
|
+
Date.parse(value)
|
149
|
+
when :String
|
150
|
+
value.to_s
|
151
|
+
when :Integer
|
152
|
+
value.to_i
|
153
|
+
when :Float
|
154
|
+
value.to_f
|
155
|
+
when :Boolean
|
156
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
157
|
+
true
|
158
|
+
else
|
159
|
+
false
|
160
|
+
end
|
161
|
+
when :Object
|
162
|
+
# generic object (usually a Hash), return directly
|
163
|
+
value
|
164
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
165
|
+
inner_type = Regexp.last_match[:inner_type]
|
166
|
+
value.map { |v| _deserialize(inner_type, v) }
|
167
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
168
|
+
k_type = Regexp.last_match[:k_type]
|
169
|
+
v_type = Regexp.last_match[:v_type]
|
170
|
+
{}.tap do |hash|
|
171
|
+
value.each do |k, v|
|
172
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
173
|
+
end
|
174
|
+
end
|
175
|
+
else # model
|
176
|
+
# models (e.g. Pet) or oneOf
|
177
|
+
klass = UltracartClient.const_get(type)
|
178
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
179
|
+
end
|
180
|
+
end
|
181
|
+
|
182
|
+
# Returns the string representation of the object
|
183
|
+
# @return [String] String presentation of the object
|
184
|
+
def to_s
|
185
|
+
to_hash.to_s
|
186
|
+
end
|
187
|
+
|
188
|
+
# to_body is an alias to to_hash (backward compatibility)
|
189
|
+
# @return [Hash] Returns the object in the form of hash
|
190
|
+
def to_body
|
191
|
+
to_hash
|
192
|
+
end
|
193
|
+
|
194
|
+
# Returns the object in the form of hash
|
195
|
+
# @return [Hash] Returns the object in the form of hash
|
196
|
+
def to_hash
|
197
|
+
hash = {}
|
198
|
+
self.class.attribute_map.each_pair do |attr, param|
|
199
|
+
value = self.send(attr)
|
200
|
+
if value.nil?
|
201
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
202
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
203
|
+
end
|
204
|
+
|
205
|
+
hash[param] = _to_hash(value)
|
206
|
+
end
|
207
|
+
hash
|
208
|
+
end
|
209
|
+
|
210
|
+
# Outputs non-array value in the form of hash
|
211
|
+
# For object, use to_hash. Otherwise, just return the value
|
212
|
+
# @param [Object] value Any valid value
|
213
|
+
# @return [Hash] Returns the value in the form of hash
|
214
|
+
def _to_hash(value)
|
215
|
+
if value.is_a?(Array)
|
216
|
+
value.compact.map { |v| _to_hash(v) }
|
217
|
+
elsif value.is_a?(Hash)
|
218
|
+
{}.tap do |hash|
|
219
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
220
|
+
end
|
221
|
+
elsif value.respond_to? :to_hash
|
222
|
+
value.to_hash
|
223
|
+
else
|
224
|
+
value
|
225
|
+
end
|
226
|
+
end
|
227
|
+
|
228
|
+
end
|
229
|
+
|
230
|
+
end
|
@@ -28,6 +28,8 @@ module UltracartClient
|
|
28
28
|
|
29
29
|
attr_accessor :event_queue_status_update
|
30
30
|
|
31
|
+
attr_accessor :event_rrweb
|
32
|
+
|
31
33
|
# Type of event
|
32
34
|
attr_accessor :event_type
|
33
35
|
|
@@ -69,6 +71,7 @@ module UltracartClient
|
|
69
71
|
:'event_new_message' => :'event_new_message',
|
70
72
|
:'event_queue_position' => :'event_queue_position',
|
71
73
|
:'event_queue_status_update' => :'event_queue_status_update',
|
74
|
+
:'event_rrweb' => :'event_rrweb',
|
72
75
|
:'event_type' => :'event_type',
|
73
76
|
:'event_updated_message' => :'event_updated_message',
|
74
77
|
:'message' => :'message',
|
@@ -90,6 +93,7 @@ module UltracartClient
|
|
90
93
|
:'event_new_message' => :'ConversationSummary',
|
91
94
|
:'event_queue_position' => :'ConversationEventQueuePosition',
|
92
95
|
:'event_queue_status_update' => :'ConversationWebchatQueueStatus',
|
96
|
+
:'event_rrweb' => :'ConversationEventRRWeb',
|
93
97
|
:'event_type' => :'String',
|
94
98
|
:'event_updated_message' => :'ConversationMessage',
|
95
99
|
:'message' => :'ConversationMessage',
|
@@ -142,6 +146,10 @@ module UltracartClient
|
|
142
146
|
self.event_queue_status_update = attributes[:'event_queue_status_update']
|
143
147
|
end
|
144
148
|
|
149
|
+
if attributes.key?(:'event_rrweb')
|
150
|
+
self.event_rrweb = attributes[:'event_rrweb']
|
151
|
+
end
|
152
|
+
|
145
153
|
if attributes.key?(:'event_type')
|
146
154
|
self.event_type = attributes[:'event_type']
|
147
155
|
end
|
@@ -169,9 +177,9 @@ module UltracartClient
|
|
169
177
|
# Check to see if the all the properties in the model are valid
|
170
178
|
# @return true if the model is valid
|
171
179
|
def valid?
|
172
|
-
event_type_validator = EnumAttributeValidator.new('String', ["queue position", "webchat start conversation", "conversation closed", "new conversation", "new message", "updated message", "queue status update"])
|
180
|
+
event_type_validator = EnumAttributeValidator.new('String', ["queue position", "webchat start conversation", "conversation closed", "new conversation", "new message", "updated message", "queue status update", "rrweb"])
|
173
181
|
return false unless event_type_validator.valid?(@event_type)
|
174
|
-
type_validator = EnumAttributeValidator.new('String', ["message", "event", "ping"])
|
182
|
+
type_validator = EnumAttributeValidator.new('String', ["message", "event", "ping", "check queue position"])
|
175
183
|
return false unless type_validator.valid?(@type)
|
176
184
|
true
|
177
185
|
end
|
@@ -179,7 +187,7 @@ module UltracartClient
|
|
179
187
|
# Custom attribute writer method checking allowed values (enum).
|
180
188
|
# @param [Object] event_type Object to be assigned
|
181
189
|
def event_type=(event_type)
|
182
|
-
validator = EnumAttributeValidator.new('String', ["queue position", "webchat start conversation", "conversation closed", "new conversation", "new message", "updated message", "queue status update"])
|
190
|
+
validator = EnumAttributeValidator.new('String', ["queue position", "webchat start conversation", "conversation closed", "new conversation", "new message", "updated message", "queue status update", "rrweb"])
|
183
191
|
unless validator.valid?(event_type)
|
184
192
|
fail ArgumentError, "invalid value for \"event_type\", must be one of #{validator.allowable_values}."
|
185
193
|
end
|
@@ -189,7 +197,7 @@ module UltracartClient
|
|
189
197
|
# Custom attribute writer method checking allowed values (enum).
|
190
198
|
# @param [Object] type Object to be assigned
|
191
199
|
def type=(type)
|
192
|
-
validator = EnumAttributeValidator.new('String', ["message", "event", "ping"])
|
200
|
+
validator = EnumAttributeValidator.new('String', ["message", "event", "ping", "check queue position"])
|
193
201
|
unless validator.valid?(type)
|
194
202
|
fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
|
195
203
|
end
|
@@ -207,6 +215,7 @@ module UltracartClient
|
|
207
215
|
event_new_message == o.event_new_message &&
|
208
216
|
event_queue_position == o.event_queue_position &&
|
209
217
|
event_queue_status_update == o.event_queue_status_update &&
|
218
|
+
event_rrweb == o.event_rrweb &&
|
210
219
|
event_type == o.event_type &&
|
211
220
|
event_updated_message == o.event_updated_message &&
|
212
221
|
message == o.message &&
|
@@ -222,7 +231,7 @@ module UltracartClient
|
|
222
231
|
# Calculates hash code according to all attributes.
|
223
232
|
# @return [Integer] Hash code
|
224
233
|
def hash
|
225
|
-
[conversation_uuid, event_conversation_closed, event_new_conversation, event_new_message, event_queue_position, event_queue_status_update, event_type, event_updated_message, message, type].hash
|
234
|
+
[conversation_uuid, event_conversation_closed, event_new_conversation, event_new_message, event_queue_position, event_queue_status_update, event_rrweb, event_type, event_updated_message, message, type].hash
|
226
235
|
end
|
227
236
|
|
228
237
|
# Builds the object from hash
|
@@ -0,0 +1,284 @@
|
|
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 EmailCommseqSequenceTestRequest
|
18
|
+
attr_accessor :cart_id
|
19
|
+
|
20
|
+
attr_accessor :cart_item_ids
|
21
|
+
|
22
|
+
attr_accessor :esp_commseq_uuid
|
23
|
+
|
24
|
+
attr_accessor :name
|
25
|
+
|
26
|
+
attr_accessor :order_id
|
27
|
+
|
28
|
+
attr_accessor :please_review
|
29
|
+
|
30
|
+
attr_accessor :send_to_email
|
31
|
+
|
32
|
+
attr_accessor :send_to_logged_in_user
|
33
|
+
|
34
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
35
|
+
def self.attribute_map
|
36
|
+
{
|
37
|
+
:'cart_id' => :'cart_id',
|
38
|
+
:'cart_item_ids' => :'cart_item_ids',
|
39
|
+
:'esp_commseq_uuid' => :'esp_commseq_uuid',
|
40
|
+
:'name' => :'name',
|
41
|
+
:'order_id' => :'order_id',
|
42
|
+
:'please_review' => :'please_review',
|
43
|
+
:'send_to_email' => :'send_to_email',
|
44
|
+
:'send_to_logged_in_user' => :'send_to_logged_in_user'
|
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
|
+
:'cart_id' => :'String',
|
57
|
+
:'cart_item_ids' => :'Array<String>',
|
58
|
+
:'esp_commseq_uuid' => :'String',
|
59
|
+
:'name' => :'String',
|
60
|
+
:'order_id' => :'String',
|
61
|
+
:'please_review' => :'Boolean',
|
62
|
+
:'send_to_email' => :'String',
|
63
|
+
:'send_to_logged_in_user' => :'Boolean'
|
64
|
+
}
|
65
|
+
end
|
66
|
+
|
67
|
+
# List of attributes with nullable: true
|
68
|
+
def self.openapi_nullable
|
69
|
+
Set.new([
|
70
|
+
])
|
71
|
+
end
|
72
|
+
|
73
|
+
# Initializes the object
|
74
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
75
|
+
def initialize(attributes = {})
|
76
|
+
if (!attributes.is_a?(Hash))
|
77
|
+
fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::EmailCommseqSequenceTestRequest` initialize method"
|
78
|
+
end
|
79
|
+
|
80
|
+
# check to see if the attribute exists and convert string to symbol for hash key
|
81
|
+
attributes = attributes.each_with_object({}) { |(k, v), h|
|
82
|
+
if (!self.class.attribute_map.key?(k.to_sym))
|
83
|
+
fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::EmailCommseqSequenceTestRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
|
84
|
+
end
|
85
|
+
h[k.to_sym] = v
|
86
|
+
}
|
87
|
+
|
88
|
+
if attributes.key?(:'cart_id')
|
89
|
+
self.cart_id = attributes[:'cart_id']
|
90
|
+
end
|
91
|
+
|
92
|
+
if attributes.key?(:'cart_item_ids')
|
93
|
+
if (value = attributes[:'cart_item_ids']).is_a?(Array)
|
94
|
+
self.cart_item_ids = value
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
if attributes.key?(:'esp_commseq_uuid')
|
99
|
+
self.esp_commseq_uuid = attributes[:'esp_commseq_uuid']
|
100
|
+
end
|
101
|
+
|
102
|
+
if attributes.key?(:'name')
|
103
|
+
self.name = attributes[:'name']
|
104
|
+
end
|
105
|
+
|
106
|
+
if attributes.key?(:'order_id')
|
107
|
+
self.order_id = attributes[:'order_id']
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes.key?(:'please_review')
|
111
|
+
self.please_review = attributes[:'please_review']
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes.key?(:'send_to_email')
|
115
|
+
self.send_to_email = attributes[:'send_to_email']
|
116
|
+
end
|
117
|
+
|
118
|
+
if attributes.key?(:'send_to_logged_in_user')
|
119
|
+
self.send_to_logged_in_user = attributes[:'send_to_logged_in_user']
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
124
|
+
# @return Array for valid properties with the reasons
|
125
|
+
def list_invalid_properties
|
126
|
+
invalid_properties = Array.new
|
127
|
+
invalid_properties
|
128
|
+
end
|
129
|
+
|
130
|
+
# Check to see if the all the properties in the model are valid
|
131
|
+
# @return true if the model is valid
|
132
|
+
def valid?
|
133
|
+
true
|
134
|
+
end
|
135
|
+
|
136
|
+
# Checks equality by comparing each attribute.
|
137
|
+
# @param [Object] Object to be compared
|
138
|
+
def ==(o)
|
139
|
+
return true if self.equal?(o)
|
140
|
+
self.class == o.class &&
|
141
|
+
cart_id == o.cart_id &&
|
142
|
+
cart_item_ids == o.cart_item_ids &&
|
143
|
+
esp_commseq_uuid == o.esp_commseq_uuid &&
|
144
|
+
name == o.name &&
|
145
|
+
order_id == o.order_id &&
|
146
|
+
please_review == o.please_review &&
|
147
|
+
send_to_email == o.send_to_email &&
|
148
|
+
send_to_logged_in_user == o.send_to_logged_in_user
|
149
|
+
end
|
150
|
+
|
151
|
+
# @see the `==` method
|
152
|
+
# @param [Object] Object to be compared
|
153
|
+
def eql?(o)
|
154
|
+
self == o
|
155
|
+
end
|
156
|
+
|
157
|
+
# Calculates hash code according to all attributes.
|
158
|
+
# @return [Integer] Hash code
|
159
|
+
def hash
|
160
|
+
[cart_id, cart_item_ids, esp_commseq_uuid, name, order_id, please_review, send_to_email, send_to_logged_in_user].hash
|
161
|
+
end
|
162
|
+
|
163
|
+
# Builds the object from hash
|
164
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
165
|
+
# @return [Object] Returns the model itself
|
166
|
+
def self.build_from_hash(attributes)
|
167
|
+
new.build_from_hash(attributes)
|
168
|
+
end
|
169
|
+
|
170
|
+
# Builds the object from hash
|
171
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
172
|
+
# @return [Object] Returns the model itself
|
173
|
+
def build_from_hash(attributes)
|
174
|
+
return nil unless attributes.is_a?(Hash)
|
175
|
+
attributes = attributes.transform_keys(&:to_sym)
|
176
|
+
self.class.openapi_types.each_pair do |key, type|
|
177
|
+
if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
|
178
|
+
self.send("#{key}=", nil)
|
179
|
+
elsif type =~ /\AArray<(.*)>/i
|
180
|
+
# check to ensure the input is an array given that the attribute
|
181
|
+
# is documented as an array but the input is not
|
182
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
183
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
184
|
+
end
|
185
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
186
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
187
|
+
end
|
188
|
+
end
|
189
|
+
|
190
|
+
self
|
191
|
+
end
|
192
|
+
|
193
|
+
# Deserializes the data based on type
|
194
|
+
# @param string type Data type
|
195
|
+
# @param string value Value to be deserialized
|
196
|
+
# @return [Object] Deserialized data
|
197
|
+
def _deserialize(type, value)
|
198
|
+
case type.to_sym
|
199
|
+
when :Time
|
200
|
+
Time.parse(value)
|
201
|
+
when :Date
|
202
|
+
Date.parse(value)
|
203
|
+
when :String
|
204
|
+
value.to_s
|
205
|
+
when :Integer
|
206
|
+
value.to_i
|
207
|
+
when :Float
|
208
|
+
value.to_f
|
209
|
+
when :Boolean
|
210
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
211
|
+
true
|
212
|
+
else
|
213
|
+
false
|
214
|
+
end
|
215
|
+
when :Object
|
216
|
+
# generic object (usually a Hash), return directly
|
217
|
+
value
|
218
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
219
|
+
inner_type = Regexp.last_match[:inner_type]
|
220
|
+
value.map { |v| _deserialize(inner_type, v) }
|
221
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
222
|
+
k_type = Regexp.last_match[:k_type]
|
223
|
+
v_type = Regexp.last_match[:v_type]
|
224
|
+
{}.tap do |hash|
|
225
|
+
value.each do |k, v|
|
226
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
227
|
+
end
|
228
|
+
end
|
229
|
+
else # model
|
230
|
+
# models (e.g. Pet) or oneOf
|
231
|
+
klass = UltracartClient.const_get(type)
|
232
|
+
klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
|
233
|
+
end
|
234
|
+
end
|
235
|
+
|
236
|
+
# Returns the string representation of the object
|
237
|
+
# @return [String] String presentation of the object
|
238
|
+
def to_s
|
239
|
+
to_hash.to_s
|
240
|
+
end
|
241
|
+
|
242
|
+
# to_body is an alias to to_hash (backward compatibility)
|
243
|
+
# @return [Hash] Returns the object in the form of hash
|
244
|
+
def to_body
|
245
|
+
to_hash
|
246
|
+
end
|
247
|
+
|
248
|
+
# Returns the object in the form of hash
|
249
|
+
# @return [Hash] Returns the object in the form of hash
|
250
|
+
def to_hash
|
251
|
+
hash = {}
|
252
|
+
self.class.attribute_map.each_pair do |attr, param|
|
253
|
+
value = self.send(attr)
|
254
|
+
if value.nil?
|
255
|
+
is_nullable = self.class.openapi_nullable.include?(attr)
|
256
|
+
next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
|
257
|
+
end
|
258
|
+
|
259
|
+
hash[param] = _to_hash(value)
|
260
|
+
end
|
261
|
+
hash
|
262
|
+
end
|
263
|
+
|
264
|
+
# Outputs non-array value in the form of hash
|
265
|
+
# For object, use to_hash. Otherwise, just return the value
|
266
|
+
# @param [Object] value Any valid value
|
267
|
+
# @return [Hash] Returns the value in the form of hash
|
268
|
+
def _to_hash(value)
|
269
|
+
if value.is_a?(Array)
|
270
|
+
value.compact.map { |v| _to_hash(v) }
|
271
|
+
elsif value.is_a?(Hash)
|
272
|
+
{}.tap do |hash|
|
273
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
274
|
+
end
|
275
|
+
elsif value.respond_to? :to_hash
|
276
|
+
value.to_hash
|
277
|
+
else
|
278
|
+
value
|
279
|
+
end
|
280
|
+
end
|
281
|
+
|
282
|
+
end
|
283
|
+
|
284
|
+
end
|