ultracart_api 3.10.85 → 3.10.87
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +14 -4
- data/docs/Coupon.md +4 -0
- data/docs/CouponMoreLoyaltyCashback.md +8 -0
- data/docs/CouponMoreLoyaltyPoints.md +8 -0
- data/docs/CouponPercentMoreLoyaltyCashback.md +8 -0
- data/docs/CouponPercentMoreLoyaltyPoints.md +8 -0
- data/docs/Order.md +1 -0
- data/docs/OrderPointOfSale.md +10 -0
- data/docs/PointOfSaleLocation.md +16 -0
- data/docs/PointOfSaleReader.md +16 -0
- data/docs/PointOfSaleRegister.md +11 -0
- data/lib/ultracart_api/models/coupon.rb +37 -1
- data/lib/ultracart_api/models/coupon_more_loyalty_cashback.rb +185 -0
- data/lib/ultracart_api/models/coupon_more_loyalty_points.rb +185 -0
- data/lib/ultracart_api/models/coupon_percent_more_loyalty_cashback.rb +185 -0
- data/lib/ultracart_api/models/coupon_percent_more_loyalty_points.rb +185 -0
- data/lib/ultracart_api/models/order.rb +10 -1
- data/lib/ultracart_api/models/order_point_of_sale.rb +202 -0
- data/lib/ultracart_api/models/point_of_sale_location.rb +265 -0
- data/lib/ultracart_api/models/point_of_sale_reader.rb +299 -0
- data/lib/ultracart_api/models/point_of_sale_register.rb +215 -0
- data/lib/ultracart_api/version.rb +1 -1
- data/lib/ultracart_api.rb +8 -0
- metadata +18 -2
@@ -0,0 +1,265 @@
|
|
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 PointOfSaleLocation
|
17
|
+
# Address line 2
|
18
|
+
attr_accessor :adddress2
|
19
|
+
|
20
|
+
# Address line 1
|
21
|
+
attr_accessor :address1
|
22
|
+
|
23
|
+
# City
|
24
|
+
attr_accessor :city
|
25
|
+
|
26
|
+
# Country
|
27
|
+
attr_accessor :country
|
28
|
+
|
29
|
+
# The distribution center code where inventory is reduced from for this sale.
|
30
|
+
attr_accessor :distribution_center_code
|
31
|
+
|
32
|
+
# Merchant ID that owns this location
|
33
|
+
attr_accessor :merchant_id
|
34
|
+
|
35
|
+
# Object identifier of the point of sale location.
|
36
|
+
attr_accessor :pos_location_oid
|
37
|
+
|
38
|
+
# Postal code
|
39
|
+
attr_accessor :postal_code
|
40
|
+
|
41
|
+
# State/province
|
42
|
+
attr_accessor :state_province
|
43
|
+
|
44
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
45
|
+
def self.attribute_map
|
46
|
+
{
|
47
|
+
:'adddress2' => :'adddress2',
|
48
|
+
:'address1' => :'address1',
|
49
|
+
:'city' => :'city',
|
50
|
+
:'country' => :'country',
|
51
|
+
:'distribution_center_code' => :'distribution_center_code',
|
52
|
+
:'merchant_id' => :'merchant_id',
|
53
|
+
:'pos_location_oid' => :'pos_location_oid',
|
54
|
+
:'postal_code' => :'postal_code',
|
55
|
+
:'state_province' => :'state_province'
|
56
|
+
}
|
57
|
+
end
|
58
|
+
|
59
|
+
# Attribute type mapping.
|
60
|
+
def self.swagger_types
|
61
|
+
{
|
62
|
+
:'adddress2' => :'String',
|
63
|
+
:'address1' => :'String',
|
64
|
+
:'city' => :'String',
|
65
|
+
:'country' => :'String',
|
66
|
+
:'distribution_center_code' => :'String',
|
67
|
+
:'merchant_id' => :'String',
|
68
|
+
:'pos_location_oid' => :'Integer',
|
69
|
+
:'postal_code' => :'String',
|
70
|
+
:'state_province' => :'String'
|
71
|
+
}
|
72
|
+
end
|
73
|
+
|
74
|
+
# Initializes the object
|
75
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
76
|
+
def initialize(attributes = {})
|
77
|
+
return unless attributes.is_a?(Hash)
|
78
|
+
|
79
|
+
# convert string to symbol for hash key
|
80
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
81
|
+
|
82
|
+
if attributes.has_key?(:'adddress2')
|
83
|
+
self.adddress2 = attributes[:'adddress2']
|
84
|
+
end
|
85
|
+
|
86
|
+
if attributes.has_key?(:'address1')
|
87
|
+
self.address1 = attributes[:'address1']
|
88
|
+
end
|
89
|
+
|
90
|
+
if attributes.has_key?(:'city')
|
91
|
+
self.city = attributes[:'city']
|
92
|
+
end
|
93
|
+
|
94
|
+
if attributes.has_key?(:'country')
|
95
|
+
self.country = attributes[:'country']
|
96
|
+
end
|
97
|
+
|
98
|
+
if attributes.has_key?(:'distribution_center_code')
|
99
|
+
self.distribution_center_code = attributes[:'distribution_center_code']
|
100
|
+
end
|
101
|
+
|
102
|
+
if attributes.has_key?(:'merchant_id')
|
103
|
+
self.merchant_id = attributes[:'merchant_id']
|
104
|
+
end
|
105
|
+
|
106
|
+
if attributes.has_key?(:'pos_location_oid')
|
107
|
+
self.pos_location_oid = attributes[:'pos_location_oid']
|
108
|
+
end
|
109
|
+
|
110
|
+
if attributes.has_key?(:'postal_code')
|
111
|
+
self.postal_code = attributes[:'postal_code']
|
112
|
+
end
|
113
|
+
|
114
|
+
if attributes.has_key?(:'state_province')
|
115
|
+
self.state_province = attributes[:'state_province']
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
120
|
+
# @return Array for valid properties with the reasons
|
121
|
+
def list_invalid_properties
|
122
|
+
invalid_properties = Array.new
|
123
|
+
invalid_properties
|
124
|
+
end
|
125
|
+
|
126
|
+
# Check to see if the all the properties in the model are valid
|
127
|
+
# @return true if the model is valid
|
128
|
+
def valid?
|
129
|
+
true
|
130
|
+
end
|
131
|
+
|
132
|
+
# Checks equality by comparing each attribute.
|
133
|
+
# @param [Object] Object to be compared
|
134
|
+
def ==(o)
|
135
|
+
return true if self.equal?(o)
|
136
|
+
self.class == o.class &&
|
137
|
+
adddress2 == o.adddress2 &&
|
138
|
+
address1 == o.address1 &&
|
139
|
+
city == o.city &&
|
140
|
+
country == o.country &&
|
141
|
+
distribution_center_code == o.distribution_center_code &&
|
142
|
+
merchant_id == o.merchant_id &&
|
143
|
+
pos_location_oid == o.pos_location_oid &&
|
144
|
+
postal_code == o.postal_code &&
|
145
|
+
state_province == o.state_province
|
146
|
+
end
|
147
|
+
|
148
|
+
# @see the `==` method
|
149
|
+
# @param [Object] Object to be compared
|
150
|
+
def eql?(o)
|
151
|
+
self == o
|
152
|
+
end
|
153
|
+
|
154
|
+
# Calculates hash code according to all attributes.
|
155
|
+
# @return [Fixnum] Hash code
|
156
|
+
def hash
|
157
|
+
[adddress2, address1, city, country, distribution_center_code, merchant_id, pos_location_oid, postal_code, state_province].hash
|
158
|
+
end
|
159
|
+
|
160
|
+
# Builds the object from hash
|
161
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
162
|
+
# @return [Object] Returns the model itself
|
163
|
+
def build_from_hash(attributes)
|
164
|
+
return nil unless attributes.is_a?(Hash)
|
165
|
+
self.class.swagger_types.each_pair do |key, type|
|
166
|
+
if type =~ /\AArray<(.*)>/i
|
167
|
+
# check to ensure the input is an array given that the attribute
|
168
|
+
# is documented as an array but the input is not
|
169
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
170
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
171
|
+
end
|
172
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
173
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
174
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
175
|
+
end
|
176
|
+
|
177
|
+
self
|
178
|
+
end
|
179
|
+
|
180
|
+
# Deserializes the data based on type
|
181
|
+
# @param string type Data type
|
182
|
+
# @param string value Value to be deserialized
|
183
|
+
# @return [Object] Deserialized data
|
184
|
+
def _deserialize(type, value)
|
185
|
+
case type.to_sym
|
186
|
+
when :DateTime
|
187
|
+
DateTime.parse(value)
|
188
|
+
when :Date
|
189
|
+
Date.parse(value)
|
190
|
+
when :String
|
191
|
+
value.to_s
|
192
|
+
when :Integer
|
193
|
+
value.to_i
|
194
|
+
when :Float
|
195
|
+
value.to_f
|
196
|
+
when :BOOLEAN
|
197
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
198
|
+
true
|
199
|
+
else
|
200
|
+
false
|
201
|
+
end
|
202
|
+
when :Object
|
203
|
+
# generic object (usually a Hash), return directly
|
204
|
+
value
|
205
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
206
|
+
inner_type = Regexp.last_match[:inner_type]
|
207
|
+
value.map { |v| _deserialize(inner_type, v) }
|
208
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
209
|
+
k_type = Regexp.last_match[:k_type]
|
210
|
+
v_type = Regexp.last_match[:v_type]
|
211
|
+
{}.tap do |hash|
|
212
|
+
value.each do |k, v|
|
213
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
214
|
+
end
|
215
|
+
end
|
216
|
+
else # model
|
217
|
+
temp_model = UltracartClient.const_get(type).new
|
218
|
+
temp_model.build_from_hash(value)
|
219
|
+
end
|
220
|
+
end
|
221
|
+
|
222
|
+
# Returns the string representation of the object
|
223
|
+
# @return [String] String presentation of the object
|
224
|
+
def to_s
|
225
|
+
to_hash.to_s
|
226
|
+
end
|
227
|
+
|
228
|
+
# to_body is an alias to to_hash (backward compatibility)
|
229
|
+
# @return [Hash] Returns the object in the form of hash
|
230
|
+
def to_body
|
231
|
+
to_hash
|
232
|
+
end
|
233
|
+
|
234
|
+
# Returns the object in the form of hash
|
235
|
+
# @return [Hash] Returns the object in the form of hash
|
236
|
+
def to_hash
|
237
|
+
hash = {}
|
238
|
+
self.class.attribute_map.each_pair do |attr, param|
|
239
|
+
value = self.send(attr)
|
240
|
+
next if value.nil?
|
241
|
+
hash[param] = _to_hash(value)
|
242
|
+
end
|
243
|
+
hash
|
244
|
+
end
|
245
|
+
|
246
|
+
# Outputs non-array value in the form of hash
|
247
|
+
# For object, use to_hash. Otherwise, just return the value
|
248
|
+
# @param [Object] value Any valid value
|
249
|
+
# @return [Hash] Returns the value in the form of hash
|
250
|
+
def _to_hash(value)
|
251
|
+
if value.is_a?(Array)
|
252
|
+
value.compact.map { |v| _to_hash(v) }
|
253
|
+
elsif value.is_a?(Hash)
|
254
|
+
{}.tap do |hash|
|
255
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
256
|
+
end
|
257
|
+
elsif value.respond_to? :to_hash
|
258
|
+
value.to_hash
|
259
|
+
else
|
260
|
+
value
|
261
|
+
end
|
262
|
+
end
|
263
|
+
|
264
|
+
end
|
265
|
+
end
|
@@ -0,0 +1,299 @@
|
|
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 PointOfSaleReader
|
17
|
+
# The device type of the reader.
|
18
|
+
attr_accessor :device_type
|
19
|
+
|
20
|
+
# The label of the reader.
|
21
|
+
attr_accessor :label
|
22
|
+
|
23
|
+
# The merchant id that owns this point of sale reader.
|
24
|
+
attr_accessor :merchant_id
|
25
|
+
|
26
|
+
# The payment provider for the card reader.
|
27
|
+
attr_accessor :payment_provider
|
28
|
+
|
29
|
+
# Object identifier of the point of sale reader.
|
30
|
+
attr_accessor :pos_reader_id
|
31
|
+
|
32
|
+
# Object identifier of the point of sale register this reader is assigned to.
|
33
|
+
attr_accessor :pos_register_oid
|
34
|
+
|
35
|
+
# The serial number of the reader.
|
36
|
+
attr_accessor :serial_number
|
37
|
+
|
38
|
+
# If the payment provider is Stripe, this is the Stripe account id
|
39
|
+
attr_accessor :stripe_account_id
|
40
|
+
|
41
|
+
# If the payment provide is Stripe, this is the Stripe terminal reader id
|
42
|
+
attr_accessor :stripe_reader_id
|
43
|
+
|
44
|
+
class EnumAttributeValidator
|
45
|
+
attr_reader :datatype
|
46
|
+
attr_reader :allowable_values
|
47
|
+
|
48
|
+
def initialize(datatype, allowable_values)
|
49
|
+
@allowable_values = allowable_values.map do |value|
|
50
|
+
case datatype.to_s
|
51
|
+
when /Integer/i
|
52
|
+
value.to_i
|
53
|
+
when /Float/i
|
54
|
+
value.to_f
|
55
|
+
else
|
56
|
+
value
|
57
|
+
end
|
58
|
+
end
|
59
|
+
end
|
60
|
+
|
61
|
+
def valid?(value)
|
62
|
+
!value || allowable_values.include?(value)
|
63
|
+
end
|
64
|
+
end
|
65
|
+
|
66
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
67
|
+
def self.attribute_map
|
68
|
+
{
|
69
|
+
:'device_type' => :'device_type',
|
70
|
+
:'label' => :'label',
|
71
|
+
:'merchant_id' => :'merchant_id',
|
72
|
+
:'payment_provider' => :'payment_provider',
|
73
|
+
:'pos_reader_id' => :'pos_reader_id',
|
74
|
+
:'pos_register_oid' => :'pos_register_oid',
|
75
|
+
:'serial_number' => :'serial_number',
|
76
|
+
:'stripe_account_id' => :'stripe_account_id',
|
77
|
+
:'stripe_reader_id' => :'stripe_reader_id'
|
78
|
+
}
|
79
|
+
end
|
80
|
+
|
81
|
+
# Attribute type mapping.
|
82
|
+
def self.swagger_types
|
83
|
+
{
|
84
|
+
:'device_type' => :'String',
|
85
|
+
:'label' => :'String',
|
86
|
+
:'merchant_id' => :'String',
|
87
|
+
:'payment_provider' => :'String',
|
88
|
+
:'pos_reader_id' => :'Integer',
|
89
|
+
:'pos_register_oid' => :'Integer',
|
90
|
+
:'serial_number' => :'String',
|
91
|
+
:'stripe_account_id' => :'String',
|
92
|
+
:'stripe_reader_id' => :'String'
|
93
|
+
}
|
94
|
+
end
|
95
|
+
|
96
|
+
# Initializes the object
|
97
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
98
|
+
def initialize(attributes = {})
|
99
|
+
return unless attributes.is_a?(Hash)
|
100
|
+
|
101
|
+
# convert string to symbol for hash key
|
102
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
103
|
+
|
104
|
+
if attributes.has_key?(:'device_type')
|
105
|
+
self.device_type = attributes[:'device_type']
|
106
|
+
end
|
107
|
+
|
108
|
+
if attributes.has_key?(:'label')
|
109
|
+
self.label = attributes[:'label']
|
110
|
+
end
|
111
|
+
|
112
|
+
if attributes.has_key?(:'merchant_id')
|
113
|
+
self.merchant_id = attributes[:'merchant_id']
|
114
|
+
end
|
115
|
+
|
116
|
+
if attributes.has_key?(:'payment_provider')
|
117
|
+
self.payment_provider = attributes[:'payment_provider']
|
118
|
+
end
|
119
|
+
|
120
|
+
if attributes.has_key?(:'pos_reader_id')
|
121
|
+
self.pos_reader_id = attributes[:'pos_reader_id']
|
122
|
+
end
|
123
|
+
|
124
|
+
if attributes.has_key?(:'pos_register_oid')
|
125
|
+
self.pos_register_oid = attributes[:'pos_register_oid']
|
126
|
+
end
|
127
|
+
|
128
|
+
if attributes.has_key?(:'serial_number')
|
129
|
+
self.serial_number = attributes[:'serial_number']
|
130
|
+
end
|
131
|
+
|
132
|
+
if attributes.has_key?(:'stripe_account_id')
|
133
|
+
self.stripe_account_id = attributes[:'stripe_account_id']
|
134
|
+
end
|
135
|
+
|
136
|
+
if attributes.has_key?(:'stripe_reader_id')
|
137
|
+
self.stripe_reader_id = attributes[:'stripe_reader_id']
|
138
|
+
end
|
139
|
+
end
|
140
|
+
|
141
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
142
|
+
# @return Array for valid properties with the reasons
|
143
|
+
def list_invalid_properties
|
144
|
+
invalid_properties = Array.new
|
145
|
+
invalid_properties
|
146
|
+
end
|
147
|
+
|
148
|
+
# Check to see if the all the properties in the model are valid
|
149
|
+
# @return true if the model is valid
|
150
|
+
def valid?
|
151
|
+
payment_provider_validator = EnumAttributeValidator.new('String', ['stripe'])
|
152
|
+
return false unless payment_provider_validator.valid?(@payment_provider)
|
153
|
+
true
|
154
|
+
end
|
155
|
+
|
156
|
+
# Custom attribute writer method checking allowed values (enum).
|
157
|
+
# @param [Object] payment_provider Object to be assigned
|
158
|
+
def payment_provider=(payment_provider)
|
159
|
+
validator = EnumAttributeValidator.new('String', ['stripe'])
|
160
|
+
unless validator.valid?(payment_provider)
|
161
|
+
fail ArgumentError, 'invalid value for "payment_provider", must be one of #{validator.allowable_values}.'
|
162
|
+
end
|
163
|
+
@payment_provider = payment_provider
|
164
|
+
end
|
165
|
+
|
166
|
+
# Checks equality by comparing each attribute.
|
167
|
+
# @param [Object] Object to be compared
|
168
|
+
def ==(o)
|
169
|
+
return true if self.equal?(o)
|
170
|
+
self.class == o.class &&
|
171
|
+
device_type == o.device_type &&
|
172
|
+
label == o.label &&
|
173
|
+
merchant_id == o.merchant_id &&
|
174
|
+
payment_provider == o.payment_provider &&
|
175
|
+
pos_reader_id == o.pos_reader_id &&
|
176
|
+
pos_register_oid == o.pos_register_oid &&
|
177
|
+
serial_number == o.serial_number &&
|
178
|
+
stripe_account_id == o.stripe_account_id &&
|
179
|
+
stripe_reader_id == o.stripe_reader_id
|
180
|
+
end
|
181
|
+
|
182
|
+
# @see the `==` method
|
183
|
+
# @param [Object] Object to be compared
|
184
|
+
def eql?(o)
|
185
|
+
self == o
|
186
|
+
end
|
187
|
+
|
188
|
+
# Calculates hash code according to all attributes.
|
189
|
+
# @return [Fixnum] Hash code
|
190
|
+
def hash
|
191
|
+
[device_type, label, merchant_id, payment_provider, pos_reader_id, pos_register_oid, serial_number, stripe_account_id, stripe_reader_id].hash
|
192
|
+
end
|
193
|
+
|
194
|
+
# Builds the object from hash
|
195
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
196
|
+
# @return [Object] Returns the model itself
|
197
|
+
def build_from_hash(attributes)
|
198
|
+
return nil unless attributes.is_a?(Hash)
|
199
|
+
self.class.swagger_types.each_pair do |key, type|
|
200
|
+
if type =~ /\AArray<(.*)>/i
|
201
|
+
# check to ensure the input is an array given that the attribute
|
202
|
+
# is documented as an array but the input is not
|
203
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
204
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
205
|
+
end
|
206
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
207
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
208
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
209
|
+
end
|
210
|
+
|
211
|
+
self
|
212
|
+
end
|
213
|
+
|
214
|
+
# Deserializes the data based on type
|
215
|
+
# @param string type Data type
|
216
|
+
# @param string value Value to be deserialized
|
217
|
+
# @return [Object] Deserialized data
|
218
|
+
def _deserialize(type, value)
|
219
|
+
case type.to_sym
|
220
|
+
when :DateTime
|
221
|
+
DateTime.parse(value)
|
222
|
+
when :Date
|
223
|
+
Date.parse(value)
|
224
|
+
when :String
|
225
|
+
value.to_s
|
226
|
+
when :Integer
|
227
|
+
value.to_i
|
228
|
+
when :Float
|
229
|
+
value.to_f
|
230
|
+
when :BOOLEAN
|
231
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
232
|
+
true
|
233
|
+
else
|
234
|
+
false
|
235
|
+
end
|
236
|
+
when :Object
|
237
|
+
# generic object (usually a Hash), return directly
|
238
|
+
value
|
239
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
240
|
+
inner_type = Regexp.last_match[:inner_type]
|
241
|
+
value.map { |v| _deserialize(inner_type, v) }
|
242
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
243
|
+
k_type = Regexp.last_match[:k_type]
|
244
|
+
v_type = Regexp.last_match[:v_type]
|
245
|
+
{}.tap do |hash|
|
246
|
+
value.each do |k, v|
|
247
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
248
|
+
end
|
249
|
+
end
|
250
|
+
else # model
|
251
|
+
temp_model = UltracartClient.const_get(type).new
|
252
|
+
temp_model.build_from_hash(value)
|
253
|
+
end
|
254
|
+
end
|
255
|
+
|
256
|
+
# Returns the string representation of the object
|
257
|
+
# @return [String] String presentation of the object
|
258
|
+
def to_s
|
259
|
+
to_hash.to_s
|
260
|
+
end
|
261
|
+
|
262
|
+
# to_body is an alias to to_hash (backward compatibility)
|
263
|
+
# @return [Hash] Returns the object in the form of hash
|
264
|
+
def to_body
|
265
|
+
to_hash
|
266
|
+
end
|
267
|
+
|
268
|
+
# Returns the object in the form of hash
|
269
|
+
# @return [Hash] Returns the object in the form of hash
|
270
|
+
def to_hash
|
271
|
+
hash = {}
|
272
|
+
self.class.attribute_map.each_pair do |attr, param|
|
273
|
+
value = self.send(attr)
|
274
|
+
next if value.nil?
|
275
|
+
hash[param] = _to_hash(value)
|
276
|
+
end
|
277
|
+
hash
|
278
|
+
end
|
279
|
+
|
280
|
+
# Outputs non-array value in the form of hash
|
281
|
+
# For object, use to_hash. Otherwise, just return the value
|
282
|
+
# @param [Object] value Any valid value
|
283
|
+
# @return [Hash] Returns the value in the form of hash
|
284
|
+
def _to_hash(value)
|
285
|
+
if value.is_a?(Array)
|
286
|
+
value.compact.map { |v| _to_hash(v) }
|
287
|
+
elsif value.is_a?(Hash)
|
288
|
+
{}.tap do |hash|
|
289
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
290
|
+
end
|
291
|
+
elsif value.respond_to? :to_hash
|
292
|
+
value.to_hash
|
293
|
+
else
|
294
|
+
value
|
295
|
+
end
|
296
|
+
end
|
297
|
+
|
298
|
+
end
|
299
|
+
end
|