ultracart_api 3.6.37 → 3.8.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +25 -4
- data/docs/AutoOrder.md +1 -0
- data/docs/AutoOrderLog.md +9 -0
- data/docs/CustomerApi.md +3 -4
- data/docs/ExperimentVariation.md +1 -0
- data/docs/GiftCertificate.md +19 -0
- data/docs/GiftCertificateApi.md +433 -0
- data/docs/GiftCertificateCreateRequest.md +11 -0
- data/docs/GiftCertificateLedgerEntry.md +13 -0
- data/docs/GiftCertificateQuery.md +16 -0
- data/docs/GiftCertificateResponse.md +12 -0
- data/docs/GiftCertificatesResponse.md +12 -0
- data/lib/ultracart_api/api/customer_api.rb +5 -6
- data/lib/ultracart_api/api/gift_certificate_api.rb +502 -0
- data/lib/ultracart_api/models/auto_order.rb +13 -1
- data/lib/ultracart_api/models/auto_order_log.rb +195 -0
- data/lib/ultracart_api/models/experiment_variation.rb +11 -1
- data/lib/ultracart_api/models/gift_certificate.rb +297 -0
- data/lib/ultracart_api/models/gift_certificate_create_request.rb +215 -0
- data/lib/ultracart_api/models/gift_certificate_ledger_entry.rb +235 -0
- data/lib/ultracart_api/models/gift_certificate_query.rb +265 -0
- data/lib/ultracart_api/models/gift_certificate_response.rb +221 -0
- data/lib/ultracart_api/models/gift_certificates_response.rb +223 -0
- data/lib/ultracart_api/version.rb +1 -1
- data/lib/ultracart_api.rb +8 -0
- metadata +18 -2
@@ -0,0 +1,195 @@
|
|
1
|
+
=begin
|
2
|
+
#UltraCart Rest API V2
|
3
|
+
|
4
|
+
#UltraCart REST API Version 2
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0.0
|
7
|
+
Contact: support@ultracart.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.15-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module UltracartClient
|
16
|
+
class AutoOrderLog
|
17
|
+
# Date/time that the log message was added
|
18
|
+
attr_accessor :log_dts
|
19
|
+
|
20
|
+
# Log message
|
21
|
+
attr_accessor :log_message
|
22
|
+
|
23
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
24
|
+
def self.attribute_map
|
25
|
+
{
|
26
|
+
:'log_dts' => :'log_dts',
|
27
|
+
:'log_message' => :'log_message'
|
28
|
+
}
|
29
|
+
end
|
30
|
+
|
31
|
+
# Attribute type mapping.
|
32
|
+
def self.swagger_types
|
33
|
+
{
|
34
|
+
:'log_dts' => :'String',
|
35
|
+
:'log_message' => :'String'
|
36
|
+
}
|
37
|
+
end
|
38
|
+
|
39
|
+
# Initializes the object
|
40
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
41
|
+
def initialize(attributes = {})
|
42
|
+
return unless attributes.is_a?(Hash)
|
43
|
+
|
44
|
+
# convert string to symbol for hash key
|
45
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
46
|
+
|
47
|
+
if attributes.has_key?(:'log_dts')
|
48
|
+
self.log_dts = attributes[:'log_dts']
|
49
|
+
end
|
50
|
+
|
51
|
+
if attributes.has_key?(:'log_message')
|
52
|
+
self.log_message = attributes[:'log_message']
|
53
|
+
end
|
54
|
+
end
|
55
|
+
|
56
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
57
|
+
# @return Array for valid properties with the reasons
|
58
|
+
def list_invalid_properties
|
59
|
+
invalid_properties = Array.new
|
60
|
+
invalid_properties
|
61
|
+
end
|
62
|
+
|
63
|
+
# Check to see if the all the properties in the model are valid
|
64
|
+
# @return true if the model is valid
|
65
|
+
def valid?
|
66
|
+
true
|
67
|
+
end
|
68
|
+
|
69
|
+
# Checks equality by comparing each attribute.
|
70
|
+
# @param [Object] Object to be compared
|
71
|
+
def ==(o)
|
72
|
+
return true if self.equal?(o)
|
73
|
+
self.class == o.class &&
|
74
|
+
log_dts == o.log_dts &&
|
75
|
+
log_message == o.log_message
|
76
|
+
end
|
77
|
+
|
78
|
+
# @see the `==` method
|
79
|
+
# @param [Object] Object to be compared
|
80
|
+
def eql?(o)
|
81
|
+
self == o
|
82
|
+
end
|
83
|
+
|
84
|
+
# Calculates hash code according to all attributes.
|
85
|
+
# @return [Fixnum] Hash code
|
86
|
+
def hash
|
87
|
+
[log_dts, log_message].hash
|
88
|
+
end
|
89
|
+
|
90
|
+
# Builds the object from hash
|
91
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
92
|
+
# @return [Object] Returns the model itself
|
93
|
+
def build_from_hash(attributes)
|
94
|
+
return nil unless attributes.is_a?(Hash)
|
95
|
+
self.class.swagger_types.each_pair do |key, type|
|
96
|
+
if type =~ /\AArray<(.*)>/i
|
97
|
+
# check to ensure the input is an array given that the attribute
|
98
|
+
# is documented as an array but the input is not
|
99
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
100
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
101
|
+
end
|
102
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
103
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
104
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
105
|
+
end
|
106
|
+
|
107
|
+
self
|
108
|
+
end
|
109
|
+
|
110
|
+
# Deserializes the data based on type
|
111
|
+
# @param string type Data type
|
112
|
+
# @param string value Value to be deserialized
|
113
|
+
# @return [Object] Deserialized data
|
114
|
+
def _deserialize(type, value)
|
115
|
+
case type.to_sym
|
116
|
+
when :DateTime
|
117
|
+
DateTime.parse(value)
|
118
|
+
when :Date
|
119
|
+
Date.parse(value)
|
120
|
+
when :String
|
121
|
+
value.to_s
|
122
|
+
when :Integer
|
123
|
+
value.to_i
|
124
|
+
when :Float
|
125
|
+
value.to_f
|
126
|
+
when :BOOLEAN
|
127
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
128
|
+
true
|
129
|
+
else
|
130
|
+
false
|
131
|
+
end
|
132
|
+
when :Object
|
133
|
+
# generic object (usually a Hash), return directly
|
134
|
+
value
|
135
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
136
|
+
inner_type = Regexp.last_match[:inner_type]
|
137
|
+
value.map { |v| _deserialize(inner_type, v) }
|
138
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
139
|
+
k_type = Regexp.last_match[:k_type]
|
140
|
+
v_type = Regexp.last_match[:v_type]
|
141
|
+
{}.tap do |hash|
|
142
|
+
value.each do |k, v|
|
143
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
144
|
+
end
|
145
|
+
end
|
146
|
+
else # model
|
147
|
+
temp_model = UltracartClient.const_get(type).new
|
148
|
+
temp_model.build_from_hash(value)
|
149
|
+
end
|
150
|
+
end
|
151
|
+
|
152
|
+
# Returns the string representation of the object
|
153
|
+
# @return [String] String presentation of the object
|
154
|
+
def to_s
|
155
|
+
to_hash.to_s
|
156
|
+
end
|
157
|
+
|
158
|
+
# to_body is an alias to to_hash (backward compatibility)
|
159
|
+
# @return [Hash] Returns the object in the form of hash
|
160
|
+
def to_body
|
161
|
+
to_hash
|
162
|
+
end
|
163
|
+
|
164
|
+
# Returns the object in the form of hash
|
165
|
+
# @return [Hash] Returns the object in the form of hash
|
166
|
+
def to_hash
|
167
|
+
hash = {}
|
168
|
+
self.class.attribute_map.each_pair do |attr, param|
|
169
|
+
value = self.send(attr)
|
170
|
+
next if value.nil?
|
171
|
+
hash[param] = _to_hash(value)
|
172
|
+
end
|
173
|
+
hash
|
174
|
+
end
|
175
|
+
|
176
|
+
# Outputs non-array value in the form of hash
|
177
|
+
# For object, use to_hash. Otherwise, just return the value
|
178
|
+
# @param [Object] value Any valid value
|
179
|
+
# @return [Hash] Returns the value in the form of hash
|
180
|
+
def _to_hash(value)
|
181
|
+
if value.is_a?(Array)
|
182
|
+
value.compact.map { |v| _to_hash(v) }
|
183
|
+
elsif value.is_a?(Hash)
|
184
|
+
{}.tap do |hash|
|
185
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
186
|
+
end
|
187
|
+
elsif value.respond_to? :to_hash
|
188
|
+
value.to_hash
|
189
|
+
else
|
190
|
+
value
|
191
|
+
end
|
192
|
+
end
|
193
|
+
|
194
|
+
end
|
195
|
+
end
|
@@ -56,6 +56,9 @@ module UltracartClient
|
|
56
56
|
# Total page view count for this variation
|
57
57
|
attr_accessor :page_view_count
|
58
58
|
|
59
|
+
# True if traffic should be paused to this variation
|
60
|
+
attr_accessor :paused
|
61
|
+
|
59
62
|
# Total revenue for this variation
|
60
63
|
attr_accessor :revenue
|
61
64
|
|
@@ -94,6 +97,7 @@ module UltracartClient
|
|
94
97
|
:'order_item_count' => :'order_item_count',
|
95
98
|
:'original_traffic_percentage' => :'original_traffic_percentage',
|
96
99
|
:'page_view_count' => :'page_view_count',
|
100
|
+
:'paused' => :'paused',
|
97
101
|
:'revenue' => :'revenue',
|
98
102
|
:'session_count' => :'session_count',
|
99
103
|
:'traffic_percentage' => :'traffic_percentage',
|
@@ -121,6 +125,7 @@ module UltracartClient
|
|
121
125
|
:'order_item_count' => :'Integer',
|
122
126
|
:'original_traffic_percentage' => :'Float',
|
123
127
|
:'page_view_count' => :'Integer',
|
128
|
+
:'paused' => :'BOOLEAN',
|
124
129
|
:'revenue' => :'Float',
|
125
130
|
:'session_count' => :'Integer',
|
126
131
|
:'traffic_percentage' => :'Float',
|
@@ -197,6 +202,10 @@ module UltracartClient
|
|
197
202
|
self.page_view_count = attributes[:'page_view_count']
|
198
203
|
end
|
199
204
|
|
205
|
+
if attributes.has_key?(:'paused')
|
206
|
+
self.paused = attributes[:'paused']
|
207
|
+
end
|
208
|
+
|
200
209
|
if attributes.has_key?(:'revenue')
|
201
210
|
self.revenue = attributes[:'revenue']
|
202
211
|
end
|
@@ -258,6 +267,7 @@ module UltracartClient
|
|
258
267
|
order_item_count == o.order_item_count &&
|
259
268
|
original_traffic_percentage == o.original_traffic_percentage &&
|
260
269
|
page_view_count == o.page_view_count &&
|
270
|
+
paused == o.paused &&
|
261
271
|
revenue == o.revenue &&
|
262
272
|
session_count == o.session_count &&
|
263
273
|
traffic_percentage == o.traffic_percentage &&
|
@@ -276,7 +286,7 @@ module UltracartClient
|
|
276
286
|
# Calculates hash code according to all attributes.
|
277
287
|
# @return [Fixnum] Hash code
|
278
288
|
def hash
|
279
|
-
[add_to_cart_count, average_duration_seconds, average_objective_per_session, average_order_value, bounce_count, conversion_rate, daily_statistics, duration_seconds_sum, event_count, initiate_checkout_count, order_count, order_item_count, original_traffic_percentage, page_view_count, revenue, session_count, traffic_percentage, url, variation_name, variation_number, winner].hash
|
289
|
+
[add_to_cart_count, average_duration_seconds, average_objective_per_session, average_order_value, bounce_count, conversion_rate, daily_statistics, duration_seconds_sum, event_count, initiate_checkout_count, order_count, order_item_count, original_traffic_percentage, page_view_count, paused, revenue, session_count, traffic_percentage, url, variation_name, variation_number, winner].hash
|
280
290
|
end
|
281
291
|
|
282
292
|
# Builds the object from hash
|
@@ -0,0 +1,297 @@
|
|
1
|
+
=begin
|
2
|
+
#UltraCart Rest API V2
|
3
|
+
|
4
|
+
#UltraCart REST API Version 2
|
5
|
+
|
6
|
+
OpenAPI spec version: 2.0.0
|
7
|
+
Contact: support@ultracart.com
|
8
|
+
Generated by: https://github.com/swagger-api/swagger-codegen.git
|
9
|
+
Swagger Codegen version: 2.4.15-SNAPSHOT
|
10
|
+
|
11
|
+
=end
|
12
|
+
|
13
|
+
require 'date'
|
14
|
+
|
15
|
+
module UltracartClient
|
16
|
+
class GiftCertificate
|
17
|
+
# True if this gift certificate is activated and ready to apply to purchases.
|
18
|
+
attr_accessor :activated
|
19
|
+
|
20
|
+
# The code used by the customer to purchase against this gift certificate.
|
21
|
+
attr_accessor :code
|
22
|
+
|
23
|
+
# True if this gift certificate was deleted.
|
24
|
+
attr_accessor :deleted
|
25
|
+
|
26
|
+
# Email of the customer associated with this gift certificate.
|
27
|
+
attr_accessor :email
|
28
|
+
|
29
|
+
# Expiration date time.
|
30
|
+
attr_accessor :expiration_dts
|
31
|
+
|
32
|
+
# Gift certificate oid.
|
33
|
+
attr_accessor :gift_certificate_oid
|
34
|
+
|
35
|
+
# A list of all ledger activity for this gift certificate.
|
36
|
+
attr_accessor :ledger_entries
|
37
|
+
|
38
|
+
# Merchant Id
|
39
|
+
attr_accessor :merchant_id
|
40
|
+
|
41
|
+
# A list of all ledger activity for this gift certificate.
|
42
|
+
attr_accessor :merchant_note
|
43
|
+
|
44
|
+
# Original balance of the gift certificate.
|
45
|
+
attr_accessor :original_balance
|
46
|
+
|
47
|
+
# The order used to purchase this gift certificate. This value is ONLY set during checkout when a certificate is purchased, not when it is used. Any usage is recorded in the ledger
|
48
|
+
attr_accessor :reference_order_id
|
49
|
+
|
50
|
+
# The remaining balance on the gift certificate. This is never set directly, but calculated from the ledger. To change the remaining balance, add a ledger entry.
|
51
|
+
attr_accessor :remaining_balance
|
52
|
+
|
53
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
54
|
+
def self.attribute_map
|
55
|
+
{
|
56
|
+
:'activated' => :'activated',
|
57
|
+
:'code' => :'code',
|
58
|
+
:'deleted' => :'deleted',
|
59
|
+
:'email' => :'email',
|
60
|
+
:'expiration_dts' => :'expiration_dts',
|
61
|
+
:'gift_certificate_oid' => :'gift_certificate_oid',
|
62
|
+
:'ledger_entries' => :'ledger_entries',
|
63
|
+
:'merchant_id' => :'merchant_id',
|
64
|
+
:'merchant_note' => :'merchant_note',
|
65
|
+
:'original_balance' => :'original_balance',
|
66
|
+
:'reference_order_id' => :'reference_order_id',
|
67
|
+
:'remaining_balance' => :'remaining_balance'
|
68
|
+
}
|
69
|
+
end
|
70
|
+
|
71
|
+
# Attribute type mapping.
|
72
|
+
def self.swagger_types
|
73
|
+
{
|
74
|
+
:'activated' => :'BOOLEAN',
|
75
|
+
:'code' => :'String',
|
76
|
+
:'deleted' => :'BOOLEAN',
|
77
|
+
:'email' => :'String',
|
78
|
+
:'expiration_dts' => :'String',
|
79
|
+
:'gift_certificate_oid' => :'Integer',
|
80
|
+
:'ledger_entries' => :'Array<GiftCertificateLedgerEntry>',
|
81
|
+
:'merchant_id' => :'String',
|
82
|
+
:'merchant_note' => :'String',
|
83
|
+
:'original_balance' => :'Float',
|
84
|
+
:'reference_order_id' => :'String',
|
85
|
+
:'remaining_balance' => :'Float'
|
86
|
+
}
|
87
|
+
end
|
88
|
+
|
89
|
+
# Initializes the object
|
90
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
91
|
+
def initialize(attributes = {})
|
92
|
+
return unless attributes.is_a?(Hash)
|
93
|
+
|
94
|
+
# convert string to symbol for hash key
|
95
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
96
|
+
|
97
|
+
if attributes.has_key?(:'activated')
|
98
|
+
self.activated = attributes[:'activated']
|
99
|
+
end
|
100
|
+
|
101
|
+
if attributes.has_key?(:'code')
|
102
|
+
self.code = attributes[:'code']
|
103
|
+
end
|
104
|
+
|
105
|
+
if attributes.has_key?(:'deleted')
|
106
|
+
self.deleted = attributes[:'deleted']
|
107
|
+
end
|
108
|
+
|
109
|
+
if attributes.has_key?(:'email')
|
110
|
+
self.email = attributes[:'email']
|
111
|
+
end
|
112
|
+
|
113
|
+
if attributes.has_key?(:'expiration_dts')
|
114
|
+
self.expiration_dts = attributes[:'expiration_dts']
|
115
|
+
end
|
116
|
+
|
117
|
+
if attributes.has_key?(:'gift_certificate_oid')
|
118
|
+
self.gift_certificate_oid = attributes[:'gift_certificate_oid']
|
119
|
+
end
|
120
|
+
|
121
|
+
if attributes.has_key?(:'ledger_entries')
|
122
|
+
if (value = attributes[:'ledger_entries']).is_a?(Array)
|
123
|
+
self.ledger_entries = value
|
124
|
+
end
|
125
|
+
end
|
126
|
+
|
127
|
+
if attributes.has_key?(:'merchant_id')
|
128
|
+
self.merchant_id = attributes[:'merchant_id']
|
129
|
+
end
|
130
|
+
|
131
|
+
if attributes.has_key?(:'merchant_note')
|
132
|
+
self.merchant_note = attributes[:'merchant_note']
|
133
|
+
end
|
134
|
+
|
135
|
+
if attributes.has_key?(:'original_balance')
|
136
|
+
self.original_balance = attributes[:'original_balance']
|
137
|
+
end
|
138
|
+
|
139
|
+
if attributes.has_key?(:'reference_order_id')
|
140
|
+
self.reference_order_id = attributes[:'reference_order_id']
|
141
|
+
end
|
142
|
+
|
143
|
+
if attributes.has_key?(:'remaining_balance')
|
144
|
+
self.remaining_balance = attributes[:'remaining_balance']
|
145
|
+
end
|
146
|
+
end
|
147
|
+
|
148
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
149
|
+
# @return Array for valid properties with the reasons
|
150
|
+
def list_invalid_properties
|
151
|
+
invalid_properties = Array.new
|
152
|
+
invalid_properties
|
153
|
+
end
|
154
|
+
|
155
|
+
# Check to see if the all the properties in the model are valid
|
156
|
+
# @return true if the model is valid
|
157
|
+
def valid?
|
158
|
+
true
|
159
|
+
end
|
160
|
+
|
161
|
+
# Checks equality by comparing each attribute.
|
162
|
+
# @param [Object] Object to be compared
|
163
|
+
def ==(o)
|
164
|
+
return true if self.equal?(o)
|
165
|
+
self.class == o.class &&
|
166
|
+
activated == o.activated &&
|
167
|
+
code == o.code &&
|
168
|
+
deleted == o.deleted &&
|
169
|
+
email == o.email &&
|
170
|
+
expiration_dts == o.expiration_dts &&
|
171
|
+
gift_certificate_oid == o.gift_certificate_oid &&
|
172
|
+
ledger_entries == o.ledger_entries &&
|
173
|
+
merchant_id == o.merchant_id &&
|
174
|
+
merchant_note == o.merchant_note &&
|
175
|
+
original_balance == o.original_balance &&
|
176
|
+
reference_order_id == o.reference_order_id &&
|
177
|
+
remaining_balance == o.remaining_balance
|
178
|
+
end
|
179
|
+
|
180
|
+
# @see the `==` method
|
181
|
+
# @param [Object] Object to be compared
|
182
|
+
def eql?(o)
|
183
|
+
self == o
|
184
|
+
end
|
185
|
+
|
186
|
+
# Calculates hash code according to all attributes.
|
187
|
+
# @return [Fixnum] Hash code
|
188
|
+
def hash
|
189
|
+
[activated, code, deleted, email, expiration_dts, gift_certificate_oid, ledger_entries, merchant_id, merchant_note, original_balance, reference_order_id, remaining_balance].hash
|
190
|
+
end
|
191
|
+
|
192
|
+
# Builds the object from hash
|
193
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
194
|
+
# @return [Object] Returns the model itself
|
195
|
+
def build_from_hash(attributes)
|
196
|
+
return nil unless attributes.is_a?(Hash)
|
197
|
+
self.class.swagger_types.each_pair do |key, type|
|
198
|
+
if type =~ /\AArray<(.*)>/i
|
199
|
+
# check to ensure the input is an array given that the attribute
|
200
|
+
# is documented as an array but the input is not
|
201
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
202
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
203
|
+
end
|
204
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
205
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
206
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
207
|
+
end
|
208
|
+
|
209
|
+
self
|
210
|
+
end
|
211
|
+
|
212
|
+
# Deserializes the data based on type
|
213
|
+
# @param string type Data type
|
214
|
+
# @param string value Value to be deserialized
|
215
|
+
# @return [Object] Deserialized data
|
216
|
+
def _deserialize(type, value)
|
217
|
+
case type.to_sym
|
218
|
+
when :DateTime
|
219
|
+
DateTime.parse(value)
|
220
|
+
when :Date
|
221
|
+
Date.parse(value)
|
222
|
+
when :String
|
223
|
+
value.to_s
|
224
|
+
when :Integer
|
225
|
+
value.to_i
|
226
|
+
when :Float
|
227
|
+
value.to_f
|
228
|
+
when :BOOLEAN
|
229
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
230
|
+
true
|
231
|
+
else
|
232
|
+
false
|
233
|
+
end
|
234
|
+
when :Object
|
235
|
+
# generic object (usually a Hash), return directly
|
236
|
+
value
|
237
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
238
|
+
inner_type = Regexp.last_match[:inner_type]
|
239
|
+
value.map { |v| _deserialize(inner_type, v) }
|
240
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
241
|
+
k_type = Regexp.last_match[:k_type]
|
242
|
+
v_type = Regexp.last_match[:v_type]
|
243
|
+
{}.tap do |hash|
|
244
|
+
value.each do |k, v|
|
245
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
246
|
+
end
|
247
|
+
end
|
248
|
+
else # model
|
249
|
+
temp_model = UltracartClient.const_get(type).new
|
250
|
+
temp_model.build_from_hash(value)
|
251
|
+
end
|
252
|
+
end
|
253
|
+
|
254
|
+
# Returns the string representation of the object
|
255
|
+
# @return [String] String presentation of the object
|
256
|
+
def to_s
|
257
|
+
to_hash.to_s
|
258
|
+
end
|
259
|
+
|
260
|
+
# to_body is an alias to to_hash (backward compatibility)
|
261
|
+
# @return [Hash] Returns the object in the form of hash
|
262
|
+
def to_body
|
263
|
+
to_hash
|
264
|
+
end
|
265
|
+
|
266
|
+
# Returns the object in the form of hash
|
267
|
+
# @return [Hash] Returns the object in the form of hash
|
268
|
+
def to_hash
|
269
|
+
hash = {}
|
270
|
+
self.class.attribute_map.each_pair do |attr, param|
|
271
|
+
value = self.send(attr)
|
272
|
+
next if value.nil?
|
273
|
+
hash[param] = _to_hash(value)
|
274
|
+
end
|
275
|
+
hash
|
276
|
+
end
|
277
|
+
|
278
|
+
# Outputs non-array value in the form of hash
|
279
|
+
# For object, use to_hash. Otherwise, just return the value
|
280
|
+
# @param [Object] value Any valid value
|
281
|
+
# @return [Hash] Returns the value in the form of hash
|
282
|
+
def _to_hash(value)
|
283
|
+
if value.is_a?(Array)
|
284
|
+
value.compact.map { |v| _to_hash(v) }
|
285
|
+
elsif value.is_a?(Hash)
|
286
|
+
{}.tap do |hash|
|
287
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
288
|
+
end
|
289
|
+
elsif value.respond_to? :to_hash
|
290
|
+
value.to_hash
|
291
|
+
else
|
292
|
+
value
|
293
|
+
end
|
294
|
+
end
|
295
|
+
|
296
|
+
end
|
297
|
+
end
|