ultracart_api 3.10.182 → 3.10.184
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +13 -4
- data/docs/ConversationAgentAuth.md +4 -0
- data/docs/CouponAmountOffItems.md +1 -0
- data/docs/CouponBuyOneGetOneLimit.md +1 -0
- data/docs/CouponDiscountItemWithItemPurchase.md +2 -0
- data/docs/CouponFreeItemWithItemPurchase.md +2 -0
- data/docs/CouponPercentOffItemsWithItemsPurchase.md +2 -0
- data/docs/EmailSmsOrder.md +11 -0
- data/docs/EmailSmsOrdersResponse.md +12 -0
- data/docs/EmailSmsStat.md +37 -0
- data/docs/EmailStatSmsSummaryRequest.md +9 -0
- data/docs/EmailStatSmsSummaryResponse.md +12 -0
- data/docs/PricingTier.md +1 -0
- data/docs/StorefrontApi.md +114 -0
- data/docs/Twilio.md +9 -0
- data/lib/ultracart_api/api/storefront_api.rb +133 -0
- data/lib/ultracart_api/models/conversation_agent_auth.rb +37 -1
- data/lib/ultracart_api/models/coupon_amount_off_items.rb +13 -1
- data/lib/ultracart_api/models/coupon_buy_one_get_one_limit.rb +13 -1
- data/lib/ultracart_api/models/coupon_discount_item_with_item_purchase.rb +28 -4
- data/lib/ultracart_api/models/coupon_free_item_with_item_purchase.rb +28 -4
- data/lib/ultracart_api/models/coupon_percent_off_items_with_items_purchase.rb +28 -4
- data/lib/ultracart_api/models/email_sms_order.rb +214 -0
- data/lib/ultracart_api/models/email_sms_orders_response.rb +223 -0
- data/lib/ultracart_api/models/email_sms_stat.rb +476 -0
- data/lib/ultracart_api/models/email_stat_sms_summary_request.rb +195 -0
- data/lib/ultracart_api/models/email_stat_sms_summary_response.rb +223 -0
- data/lib/ultracart_api/models/pricing_tier.rb +11 -1
- data/lib/ultracart_api/models/twilio.rb +85 -4
- data/lib/ultracart_api/version.rb +1 -1
- data/lib/ultracart_api.rb +5 -0
- metadata +12 -2
@@ -20,6 +20,9 @@ module UltracartClient
|
|
20
20
|
# The amount of shipping discount
|
21
21
|
attr_accessor :discount_amount
|
22
22
|
|
23
|
+
# An optional list of item tags which will receive a discount.
|
24
|
+
attr_accessor :item_tags
|
25
|
+
|
23
26
|
# A list of items which are eligible for the discount amount.
|
24
27
|
attr_accessor :items
|
25
28
|
|
@@ -31,6 +34,7 @@ module UltracartClient
|
|
31
34
|
{
|
32
35
|
:'currency_code' => :'currency_code',
|
33
36
|
:'discount_amount' => :'discount_amount',
|
37
|
+
:'item_tags' => :'item_tags',
|
34
38
|
:'items' => :'items',
|
35
39
|
:'limit' => :'limit'
|
36
40
|
}
|
@@ -41,6 +45,7 @@ module UltracartClient
|
|
41
45
|
{
|
42
46
|
:'currency_code' => :'String',
|
43
47
|
:'discount_amount' => :'Float',
|
48
|
+
:'item_tags' => :'Array<String>',
|
44
49
|
:'items' => :'Array<String>',
|
45
50
|
:'limit' => :'Integer'
|
46
51
|
}
|
@@ -62,6 +67,12 @@ module UltracartClient
|
|
62
67
|
self.discount_amount = attributes[:'discount_amount']
|
63
68
|
end
|
64
69
|
|
70
|
+
if attributes.has_key?(:'item_tags')
|
71
|
+
if (value = attributes[:'item_tags']).is_a?(Array)
|
72
|
+
self.item_tags = value
|
73
|
+
end
|
74
|
+
end
|
75
|
+
|
65
76
|
if attributes.has_key?(:'items')
|
66
77
|
if (value = attributes[:'items']).is_a?(Array)
|
67
78
|
self.items = value
|
@@ -108,6 +119,7 @@ module UltracartClient
|
|
108
119
|
self.class == o.class &&
|
109
120
|
currency_code == o.currency_code &&
|
110
121
|
discount_amount == o.discount_amount &&
|
122
|
+
item_tags == o.item_tags &&
|
111
123
|
items == o.items &&
|
112
124
|
limit == o.limit
|
113
125
|
end
|
@@ -121,7 +133,7 @@ module UltracartClient
|
|
121
133
|
# Calculates hash code according to all attributes.
|
122
134
|
# @return [Fixnum] Hash code
|
123
135
|
def hash
|
124
|
-
[currency_code, discount_amount, items, limit].hash
|
136
|
+
[currency_code, discount_amount, item_tags, items, limit].hash
|
125
137
|
end
|
126
138
|
|
127
139
|
# Builds the object from hash
|
@@ -14,6 +14,9 @@ require 'date'
|
|
14
14
|
|
15
15
|
module UltracartClient
|
16
16
|
class CouponBuyOneGetOneLimit
|
17
|
+
# An optional list of item tags which will receive a discount.
|
18
|
+
attr_accessor :item_tags
|
19
|
+
|
17
20
|
# An optional list of items of which one must be purchased to receive free quantity of the same item.
|
18
21
|
attr_accessor :items
|
19
22
|
|
@@ -23,6 +26,7 @@ module UltracartClient
|
|
23
26
|
# Attribute mapping from ruby-style variable name to JSON key.
|
24
27
|
def self.attribute_map
|
25
28
|
{
|
29
|
+
:'item_tags' => :'item_tags',
|
26
30
|
:'items' => :'items',
|
27
31
|
:'limit' => :'limit'
|
28
32
|
}
|
@@ -31,6 +35,7 @@ module UltracartClient
|
|
31
35
|
# Attribute type mapping.
|
32
36
|
def self.swagger_types
|
33
37
|
{
|
38
|
+
:'item_tags' => :'Array<String>',
|
34
39
|
:'items' => :'Array<String>',
|
35
40
|
:'limit' => :'Integer'
|
36
41
|
}
|
@@ -44,6 +49,12 @@ module UltracartClient
|
|
44
49
|
# convert string to symbol for hash key
|
45
50
|
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
46
51
|
|
52
|
+
if attributes.has_key?(:'item_tags')
|
53
|
+
if (value = attributes[:'item_tags']).is_a?(Array)
|
54
|
+
self.item_tags = value
|
55
|
+
end
|
56
|
+
end
|
57
|
+
|
47
58
|
if attributes.has_key?(:'items')
|
48
59
|
if (value = attributes[:'items']).is_a?(Array)
|
49
60
|
self.items = value
|
@@ -73,6 +84,7 @@ module UltracartClient
|
|
73
84
|
def ==(o)
|
74
85
|
return true if self.equal?(o)
|
75
86
|
self.class == o.class &&
|
87
|
+
item_tags == o.item_tags &&
|
76
88
|
items == o.items &&
|
77
89
|
limit == o.limit
|
78
90
|
end
|
@@ -86,7 +98,7 @@ module UltracartClient
|
|
86
98
|
# Calculates hash code according to all attributes.
|
87
99
|
# @return [Fixnum] Hash code
|
88
100
|
def hash
|
89
|
-
[items, limit].hash
|
101
|
+
[item_tags, items, limit].hash
|
90
102
|
end
|
91
103
|
|
92
104
|
# Builds the object from hash
|
@@ -20,6 +20,9 @@ module UltracartClient
|
|
20
20
|
# The item that will be sold at the discount_price when required_purchase_item is purchased.
|
21
21
|
attr_accessor :discount_item
|
22
22
|
|
23
|
+
# An optional list of item tags which will receive a discount of one of the required purchased items is purchased.
|
24
|
+
attr_accessor :discount_item_tags
|
25
|
+
|
23
26
|
# The price (unit cost) of the discounted item
|
24
27
|
attr_accessor :discount_price
|
25
28
|
|
@@ -29,14 +32,19 @@ module UltracartClient
|
|
29
32
|
# The item that must be purchased for the discount to be applied to the discount item.
|
30
33
|
attr_accessor :required_purchase_item
|
31
34
|
|
35
|
+
# An optional list of item tags which are required to be purchased.
|
36
|
+
attr_accessor :required_purchase_items_tags
|
37
|
+
|
32
38
|
# Attribute mapping from ruby-style variable name to JSON key.
|
33
39
|
def self.attribute_map
|
34
40
|
{
|
35
41
|
:'currency_code' => :'currency_code',
|
36
42
|
:'discount_item' => :'discount_item',
|
43
|
+
:'discount_item_tags' => :'discount_item_tags',
|
37
44
|
:'discount_price' => :'discount_price',
|
38
45
|
:'limit' => :'limit',
|
39
|
-
:'required_purchase_item' => :'required_purchase_item'
|
46
|
+
:'required_purchase_item' => :'required_purchase_item',
|
47
|
+
:'required_purchase_items_tags' => :'required_purchase_items_tags'
|
40
48
|
}
|
41
49
|
end
|
42
50
|
|
@@ -45,9 +53,11 @@ module UltracartClient
|
|
45
53
|
{
|
46
54
|
:'currency_code' => :'String',
|
47
55
|
:'discount_item' => :'String',
|
56
|
+
:'discount_item_tags' => :'Array<String>',
|
48
57
|
:'discount_price' => :'Float',
|
49
58
|
:'limit' => :'Integer',
|
50
|
-
:'required_purchase_item' => :'String'
|
59
|
+
:'required_purchase_item' => :'String',
|
60
|
+
:'required_purchase_items_tags' => :'Array<String>'
|
51
61
|
}
|
52
62
|
end
|
53
63
|
|
@@ -67,6 +77,12 @@ module UltracartClient
|
|
67
77
|
self.discount_item = attributes[:'discount_item']
|
68
78
|
end
|
69
79
|
|
80
|
+
if attributes.has_key?(:'discount_item_tags')
|
81
|
+
if (value = attributes[:'discount_item_tags']).is_a?(Array)
|
82
|
+
self.discount_item_tags = value
|
83
|
+
end
|
84
|
+
end
|
85
|
+
|
70
86
|
if attributes.has_key?(:'discount_price')
|
71
87
|
self.discount_price = attributes[:'discount_price']
|
72
88
|
end
|
@@ -78,6 +94,12 @@ module UltracartClient
|
|
78
94
|
if attributes.has_key?(:'required_purchase_item')
|
79
95
|
self.required_purchase_item = attributes[:'required_purchase_item']
|
80
96
|
end
|
97
|
+
|
98
|
+
if attributes.has_key?(:'required_purchase_items_tags')
|
99
|
+
if (value = attributes[:'required_purchase_items_tags']).is_a?(Array)
|
100
|
+
self.required_purchase_items_tags = value
|
101
|
+
end
|
102
|
+
end
|
81
103
|
end
|
82
104
|
|
83
105
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -115,9 +137,11 @@ module UltracartClient
|
|
115
137
|
self.class == o.class &&
|
116
138
|
currency_code == o.currency_code &&
|
117
139
|
discount_item == o.discount_item &&
|
140
|
+
discount_item_tags == o.discount_item_tags &&
|
118
141
|
discount_price == o.discount_price &&
|
119
142
|
limit == o.limit &&
|
120
|
-
required_purchase_item == o.required_purchase_item
|
143
|
+
required_purchase_item == o.required_purchase_item &&
|
144
|
+
required_purchase_items_tags == o.required_purchase_items_tags
|
121
145
|
end
|
122
146
|
|
123
147
|
# @see the `==` method
|
@@ -129,7 +153,7 @@ module UltracartClient
|
|
129
153
|
# Calculates hash code according to all attributes.
|
130
154
|
# @return [Fixnum] Hash code
|
131
155
|
def hash
|
132
|
-
[currency_code, discount_item, discount_price, limit, required_purchase_item].hash
|
156
|
+
[currency_code, discount_item, discount_item_tags, discount_price, limit, required_purchase_item, required_purchase_items_tags].hash
|
133
157
|
end
|
134
158
|
|
135
159
|
# Builds the object from hash
|
@@ -14,6 +14,9 @@ require 'date'
|
|
14
14
|
|
15
15
|
module UltracartClient
|
16
16
|
class CouponFreeItemWithItemPurchase
|
17
|
+
# An optional list of item tags which will receive a discount of one of the required purchased items is purchased.
|
18
|
+
attr_accessor :item_tags
|
19
|
+
|
17
20
|
# A list of free items which will receive a discount if one of the required purchase items is purchased.
|
18
21
|
attr_accessor :items
|
19
22
|
|
@@ -26,23 +29,30 @@ module UltracartClient
|
|
26
29
|
# Required items (at least one from the list) that must be purchased for coupon to be valid
|
27
30
|
attr_accessor :required_purchase_items
|
28
31
|
|
32
|
+
# An optional list of item tags which are required to be purchased.
|
33
|
+
attr_accessor :required_purchase_items_tags
|
34
|
+
|
29
35
|
# Attribute mapping from ruby-style variable name to JSON key.
|
30
36
|
def self.attribute_map
|
31
37
|
{
|
38
|
+
:'item_tags' => :'item_tags',
|
32
39
|
:'items' => :'items',
|
33
40
|
:'limit' => :'limit',
|
34
41
|
:'match_required_purchase_item_to_free_item' => :'match_required_purchase_item_to_free_item',
|
35
|
-
:'required_purchase_items' => :'required_purchase_items'
|
42
|
+
:'required_purchase_items' => :'required_purchase_items',
|
43
|
+
:'required_purchase_items_tags' => :'required_purchase_items_tags'
|
36
44
|
}
|
37
45
|
end
|
38
46
|
|
39
47
|
# Attribute type mapping.
|
40
48
|
def self.swagger_types
|
41
49
|
{
|
50
|
+
:'item_tags' => :'Array<String>',
|
42
51
|
:'items' => :'Array<String>',
|
43
52
|
:'limit' => :'Integer',
|
44
53
|
:'match_required_purchase_item_to_free_item' => :'BOOLEAN',
|
45
|
-
:'required_purchase_items' => :'Array<String>'
|
54
|
+
:'required_purchase_items' => :'Array<String>',
|
55
|
+
:'required_purchase_items_tags' => :'Array<String>'
|
46
56
|
}
|
47
57
|
end
|
48
58
|
|
@@ -54,6 +64,12 @@ module UltracartClient
|
|
54
64
|
# convert string to symbol for hash key
|
55
65
|
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
56
66
|
|
67
|
+
if attributes.has_key?(:'item_tags')
|
68
|
+
if (value = attributes[:'item_tags']).is_a?(Array)
|
69
|
+
self.item_tags = value
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
57
73
|
if attributes.has_key?(:'items')
|
58
74
|
if (value = attributes[:'items']).is_a?(Array)
|
59
75
|
self.items = value
|
@@ -73,6 +89,12 @@ module UltracartClient
|
|
73
89
|
self.required_purchase_items = value
|
74
90
|
end
|
75
91
|
end
|
92
|
+
|
93
|
+
if attributes.has_key?(:'required_purchase_items_tags')
|
94
|
+
if (value = attributes[:'required_purchase_items_tags']).is_a?(Array)
|
95
|
+
self.required_purchase_items_tags = value
|
96
|
+
end
|
97
|
+
end
|
76
98
|
end
|
77
99
|
|
78
100
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -93,10 +115,12 @@ module UltracartClient
|
|
93
115
|
def ==(o)
|
94
116
|
return true if self.equal?(o)
|
95
117
|
self.class == o.class &&
|
118
|
+
item_tags == o.item_tags &&
|
96
119
|
items == o.items &&
|
97
120
|
limit == o.limit &&
|
98
121
|
match_required_purchase_item_to_free_item == o.match_required_purchase_item_to_free_item &&
|
99
|
-
required_purchase_items == o.required_purchase_items
|
122
|
+
required_purchase_items == o.required_purchase_items &&
|
123
|
+
required_purchase_items_tags == o.required_purchase_items_tags
|
100
124
|
end
|
101
125
|
|
102
126
|
# @see the `==` method
|
@@ -108,7 +132,7 @@ module UltracartClient
|
|
108
132
|
# Calculates hash code according to all attributes.
|
109
133
|
# @return [Fixnum] Hash code
|
110
134
|
def hash
|
111
|
-
[items, limit, match_required_purchase_item_to_free_item, required_purchase_items].hash
|
135
|
+
[item_tags, items, limit, match_required_purchase_item_to_free_item, required_purchase_items, required_purchase_items_tags].hash
|
112
136
|
end
|
113
137
|
|
114
138
|
# Builds the object from hash
|
@@ -17,6 +17,9 @@ module UltracartClient
|
|
17
17
|
# The percentage of subtotal discount
|
18
18
|
attr_accessor :discount_percent
|
19
19
|
|
20
|
+
# An optional list of item tags which will receive a discount of one of the required purchased items is purchased.
|
21
|
+
attr_accessor :item_tags
|
22
|
+
|
20
23
|
# A list of items which will receive a discount if one of the required purchase items is purchased.
|
21
24
|
attr_accessor :items
|
22
25
|
|
@@ -26,13 +29,18 @@ module UltracartClient
|
|
26
29
|
# Required items (at least one from the list) that must be purchased for coupon to be valid
|
27
30
|
attr_accessor :required_purchase_items
|
28
31
|
|
32
|
+
# An optional list of item tags which are required to be purchased.
|
33
|
+
attr_accessor :required_purchase_items_tags
|
34
|
+
|
29
35
|
# Attribute mapping from ruby-style variable name to JSON key.
|
30
36
|
def self.attribute_map
|
31
37
|
{
|
32
38
|
:'discount_percent' => :'discount_percent',
|
39
|
+
:'item_tags' => :'item_tags',
|
33
40
|
:'items' => :'items',
|
34
41
|
:'limit' => :'limit',
|
35
|
-
:'required_purchase_items' => :'required_purchase_items'
|
42
|
+
:'required_purchase_items' => :'required_purchase_items',
|
43
|
+
:'required_purchase_items_tags' => :'required_purchase_items_tags'
|
36
44
|
}
|
37
45
|
end
|
38
46
|
|
@@ -40,9 +48,11 @@ module UltracartClient
|
|
40
48
|
def self.swagger_types
|
41
49
|
{
|
42
50
|
:'discount_percent' => :'Float',
|
51
|
+
:'item_tags' => :'Array<String>',
|
43
52
|
:'items' => :'Array<String>',
|
44
53
|
:'limit' => :'Integer',
|
45
|
-
:'required_purchase_items' => :'Array<String>'
|
54
|
+
:'required_purchase_items' => :'Array<String>',
|
55
|
+
:'required_purchase_items_tags' => :'Array<String>'
|
46
56
|
}
|
47
57
|
end
|
48
58
|
|
@@ -58,6 +68,12 @@ module UltracartClient
|
|
58
68
|
self.discount_percent = attributes[:'discount_percent']
|
59
69
|
end
|
60
70
|
|
71
|
+
if attributes.has_key?(:'item_tags')
|
72
|
+
if (value = attributes[:'item_tags']).is_a?(Array)
|
73
|
+
self.item_tags = value
|
74
|
+
end
|
75
|
+
end
|
76
|
+
|
61
77
|
if attributes.has_key?(:'items')
|
62
78
|
if (value = attributes[:'items']).is_a?(Array)
|
63
79
|
self.items = value
|
@@ -73,6 +89,12 @@ module UltracartClient
|
|
73
89
|
self.required_purchase_items = value
|
74
90
|
end
|
75
91
|
end
|
92
|
+
|
93
|
+
if attributes.has_key?(:'required_purchase_items_tags')
|
94
|
+
if (value = attributes[:'required_purchase_items_tags']).is_a?(Array)
|
95
|
+
self.required_purchase_items_tags = value
|
96
|
+
end
|
97
|
+
end
|
76
98
|
end
|
77
99
|
|
78
100
|
# Show invalid properties with the reasons. Usually used together with valid?
|
@@ -94,9 +116,11 @@ module UltracartClient
|
|
94
116
|
return true if self.equal?(o)
|
95
117
|
self.class == o.class &&
|
96
118
|
discount_percent == o.discount_percent &&
|
119
|
+
item_tags == o.item_tags &&
|
97
120
|
items == o.items &&
|
98
121
|
limit == o.limit &&
|
99
|
-
required_purchase_items == o.required_purchase_items
|
122
|
+
required_purchase_items == o.required_purchase_items &&
|
123
|
+
required_purchase_items_tags == o.required_purchase_items_tags
|
100
124
|
end
|
101
125
|
|
102
126
|
# @see the `==` method
|
@@ -108,7 +132,7 @@ module UltracartClient
|
|
108
132
|
# Calculates hash code according to all attributes.
|
109
133
|
# @return [Fixnum] Hash code
|
110
134
|
def hash
|
111
|
-
[discount_percent, items, limit, required_purchase_items].hash
|
135
|
+
[discount_percent, item_tags, items, limit, required_purchase_items, required_purchase_items_tags].hash
|
112
136
|
end
|
113
137
|
|
114
138
|
# Builds the object from hash
|
@@ -0,0 +1,214 @@
|
|
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 EmailSmsOrder
|
17
|
+
# email
|
18
|
+
attr_accessor :email
|
19
|
+
|
20
|
+
# order_dts
|
21
|
+
attr_accessor :order_dts
|
22
|
+
|
23
|
+
# order_id
|
24
|
+
attr_accessor :order_id
|
25
|
+
|
26
|
+
attr_accessor :total
|
27
|
+
|
28
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
29
|
+
def self.attribute_map
|
30
|
+
{
|
31
|
+
:'email' => :'email',
|
32
|
+
:'order_dts' => :'order_dts',
|
33
|
+
:'order_id' => :'order_id',
|
34
|
+
:'total' => :'total'
|
35
|
+
}
|
36
|
+
end
|
37
|
+
|
38
|
+
# Attribute type mapping.
|
39
|
+
def self.swagger_types
|
40
|
+
{
|
41
|
+
:'email' => :'String',
|
42
|
+
:'order_dts' => :'String',
|
43
|
+
:'order_id' => :'String',
|
44
|
+
:'total' => :'Currency'
|
45
|
+
}
|
46
|
+
end
|
47
|
+
|
48
|
+
# Initializes the object
|
49
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
50
|
+
def initialize(attributes = {})
|
51
|
+
return unless attributes.is_a?(Hash)
|
52
|
+
|
53
|
+
# convert string to symbol for hash key
|
54
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
55
|
+
|
56
|
+
if attributes.has_key?(:'email')
|
57
|
+
self.email = attributes[:'email']
|
58
|
+
end
|
59
|
+
|
60
|
+
if attributes.has_key?(:'order_dts')
|
61
|
+
self.order_dts = attributes[:'order_dts']
|
62
|
+
end
|
63
|
+
|
64
|
+
if attributes.has_key?(:'order_id')
|
65
|
+
self.order_id = attributes[:'order_id']
|
66
|
+
end
|
67
|
+
|
68
|
+
if attributes.has_key?(:'total')
|
69
|
+
self.total = attributes[:'total']
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
74
|
+
# @return Array for valid properties with the reasons
|
75
|
+
def list_invalid_properties
|
76
|
+
invalid_properties = Array.new
|
77
|
+
invalid_properties
|
78
|
+
end
|
79
|
+
|
80
|
+
# Check to see if the all the properties in the model are valid
|
81
|
+
# @return true if the model is valid
|
82
|
+
def valid?
|
83
|
+
true
|
84
|
+
end
|
85
|
+
|
86
|
+
# Checks equality by comparing each attribute.
|
87
|
+
# @param [Object] Object to be compared
|
88
|
+
def ==(o)
|
89
|
+
return true if self.equal?(o)
|
90
|
+
self.class == o.class &&
|
91
|
+
email == o.email &&
|
92
|
+
order_dts == o.order_dts &&
|
93
|
+
order_id == o.order_id &&
|
94
|
+
total == o.total
|
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 [Fixnum] Hash code
|
105
|
+
def hash
|
106
|
+
[email, order_dts, order_id, total].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 build_from_hash(attributes)
|
113
|
+
return nil unless attributes.is_a?(Hash)
|
114
|
+
self.class.swagger_types.each_pair do |key, type|
|
115
|
+
if type =~ /\AArray<(.*)>/i
|
116
|
+
# check to ensure the input is an array given that the attribute
|
117
|
+
# is documented as an array but the input is not
|
118
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
119
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
120
|
+
end
|
121
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
122
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
123
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
124
|
+
end
|
125
|
+
|
126
|
+
self
|
127
|
+
end
|
128
|
+
|
129
|
+
# Deserializes the data based on type
|
130
|
+
# @param string type Data type
|
131
|
+
# @param string value Value to be deserialized
|
132
|
+
# @return [Object] Deserialized data
|
133
|
+
def _deserialize(type, value)
|
134
|
+
case type.to_sym
|
135
|
+
when :DateTime
|
136
|
+
DateTime.parse(value)
|
137
|
+
when :Date
|
138
|
+
Date.parse(value)
|
139
|
+
when :String
|
140
|
+
value.to_s
|
141
|
+
when :Integer
|
142
|
+
value.to_i
|
143
|
+
when :Float
|
144
|
+
value.to_f
|
145
|
+
when :BOOLEAN
|
146
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
147
|
+
true
|
148
|
+
else
|
149
|
+
false
|
150
|
+
end
|
151
|
+
when :Object
|
152
|
+
# generic object (usually a Hash), return directly
|
153
|
+
value
|
154
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
155
|
+
inner_type = Regexp.last_match[:inner_type]
|
156
|
+
value.map { |v| _deserialize(inner_type, v) }
|
157
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
158
|
+
k_type = Regexp.last_match[:k_type]
|
159
|
+
v_type = Regexp.last_match[:v_type]
|
160
|
+
{}.tap do |hash|
|
161
|
+
value.each do |k, v|
|
162
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
163
|
+
end
|
164
|
+
end
|
165
|
+
else # model
|
166
|
+
temp_model = UltracartClient.const_get(type).new
|
167
|
+
temp_model.build_from_hash(value)
|
168
|
+
end
|
169
|
+
end
|
170
|
+
|
171
|
+
# Returns the string representation of the object
|
172
|
+
# @return [String] String presentation of the object
|
173
|
+
def to_s
|
174
|
+
to_hash.to_s
|
175
|
+
end
|
176
|
+
|
177
|
+
# to_body is an alias to to_hash (backward compatibility)
|
178
|
+
# @return [Hash] Returns the object in the form of hash
|
179
|
+
def to_body
|
180
|
+
to_hash
|
181
|
+
end
|
182
|
+
|
183
|
+
# Returns the object in the form of hash
|
184
|
+
# @return [Hash] Returns the object in the form of hash
|
185
|
+
def to_hash
|
186
|
+
hash = {}
|
187
|
+
self.class.attribute_map.each_pair do |attr, param|
|
188
|
+
value = self.send(attr)
|
189
|
+
next if value.nil?
|
190
|
+
hash[param] = _to_hash(value)
|
191
|
+
end
|
192
|
+
hash
|
193
|
+
end
|
194
|
+
|
195
|
+
# Outputs non-array value in the form of hash
|
196
|
+
# For object, use to_hash. Otherwise, just return the value
|
197
|
+
# @param [Object] value Any valid value
|
198
|
+
# @return [Hash] Returns the value in the form of hash
|
199
|
+
def _to_hash(value)
|
200
|
+
if value.is_a?(Array)
|
201
|
+
value.compact.map { |v| _to_hash(v) }
|
202
|
+
elsif value.is_a?(Hash)
|
203
|
+
{}.tap do |hash|
|
204
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
205
|
+
end
|
206
|
+
elsif value.respond_to? :to_hash
|
207
|
+
value.to_hash
|
208
|
+
else
|
209
|
+
value
|
210
|
+
end
|
211
|
+
end
|
212
|
+
|
213
|
+
end
|
214
|
+
end
|