ultracart_api 3.4.8 → 3.4.12
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 +11 -4
- data/docs/EmailWebhookEditorValuesResponse.md +14 -0
- data/docs/PaymentsConfiguration.md +4 -4
- data/docs/PaymentsConfigurationAffirm.md +7 -7
- data/docs/PaymentsConfigurationAmazon.md +7 -7
- data/docs/PaymentsConfigurationCOD.md +5 -5
- data/docs/PaymentsConfigurationCash.md +1 -1
- data/docs/PaymentsConfigurationCheck.md +12 -13
- data/docs/PaymentsConfigurationCreditCard.md +11 -8
- data/docs/PaymentsConfigurationCreditCardType.md +17 -0
- data/docs/PaymentsConfigurationEcheck.md +3 -3
- data/docs/PaymentsConfigurationLoanHero.md +4 -4
- data/docs/PaymentsConfigurationMoneyOrder.md +3 -1
- data/docs/PaymentsConfigurationPayPal.md +28 -28
- data/docs/PaymentsConfigurationPurchaseOrder.md +3 -3
- data/docs/PaymentsConfigurationQuoteRequest.md +2 -2
- data/docs/PaymentsConfigurationRestrictions.md +14 -12
- data/docs/PaymentsConfigurationRestrictionsTheme.md +10 -0
- data/docs/PaymentsConfigurationSezzle.md +8 -7
- data/docs/PaymentsConfigurationTestMethod.md +18 -0
- data/docs/PaymentsConfigurationWePay.md +26 -26
- data/docs/PaymentsConfigurationWireTransfer.md +10 -10
- data/docs/StorefrontApi.md +52 -0
- data/lib/ultracart_api.rb +4 -0
- data/lib/ultracart_api/api/storefront_api.rb +59 -0
- data/lib/ultracart_api/models/email_webhook_editor_values_response.rb +243 -0
- data/lib/ultracart_api/models/payments_configuration.rb +41 -40
- data/lib/ultracart_api/models/payments_configuration_affirm.rb +81 -40
- data/lib/ultracart_api/models/payments_configuration_amazon.rb +51 -44
- data/lib/ultracart_api/models/payments_configuration_cash.rb +4 -3
- data/lib/ultracart_api/models/payments_configuration_check.rb +73 -68
- data/lib/ultracart_api/models/payments_configuration_cod.rb +39 -34
- data/lib/ultracart_api/models/payments_configuration_credit_card.rb +78 -34
- data/lib/ultracart_api/models/payments_configuration_credit_card_type.rb +309 -0
- data/lib/ultracart_api/models/payments_configuration_echeck.rb +22 -19
- data/lib/ultracart_api/models/payments_configuration_loan_hero.rb +23 -19
- data/lib/ultracart_api/models/payments_configuration_money_order.rb +25 -4
- data/lib/ultracart_api/models/payments_configuration_pay_pal.rb +270 -172
- data/lib/ultracart_api/models/payments_configuration_purchase_order.rb +19 -16
- data/lib/ultracart_api/models/payments_configuration_quote_request.rb +12 -10
- data/lib/ultracart_api/models/payments_configuration_restrictions.rb +75 -41
- data/lib/ultracart_api/models/payments_configuration_restrictions_theme.rb +202 -0
- data/lib/ultracart_api/models/payments_configuration_sezzle.rb +99 -46
- data/lib/ultracart_api/models/payments_configuration_test_method.rb +319 -0
- data/lib/ultracart_api/models/payments_configuration_we_pay.rb +186 -160
- data/lib/ultracart_api/models/payments_configuration_wire_transfer.rb +71 -61
- data/lib/ultracart_api/version.rb +1 -1
- metadata +10 -2
@@ -14,20 +14,23 @@ require 'date'
|
|
14
14
|
|
15
15
|
module UltracartClient
|
16
16
|
class PaymentsConfigurationPurchaseOrder
|
17
|
+
# Master flag indicating this merchant accepts purchase orders
|
17
18
|
attr_accessor :accept_purchase_orders
|
18
19
|
|
19
|
-
|
20
|
+
# If true, only approved customers may pay with a purchase order
|
21
|
+
attr_accessor :approved_customers_only
|
20
22
|
|
21
|
-
|
23
|
+
# If true, customers may not use duplicate PO numbers for any order
|
24
|
+
attr_accessor :prevent_duplicate_number
|
22
25
|
|
23
26
|
attr_accessor :restrictions
|
24
27
|
|
25
28
|
# Attribute mapping from ruby-style variable name to JSON key.
|
26
29
|
def self.attribute_map
|
27
30
|
{
|
28
|
-
:'accept_purchase_orders' => :'
|
29
|
-
:'
|
30
|
-
:'
|
31
|
+
:'accept_purchase_orders' => :'accept_purchase_orders',
|
32
|
+
:'approved_customers_only' => :'approved_customers_only',
|
33
|
+
:'prevent_duplicate_number' => :'prevent_duplicate_number',
|
31
34
|
:'restrictions' => :'restrictions'
|
32
35
|
}
|
33
36
|
end
|
@@ -36,8 +39,8 @@ module UltracartClient
|
|
36
39
|
def self.swagger_types
|
37
40
|
{
|
38
41
|
:'accept_purchase_orders' => :'BOOLEAN',
|
39
|
-
:'
|
40
|
-
:'
|
42
|
+
:'approved_customers_only' => :'BOOLEAN',
|
43
|
+
:'prevent_duplicate_number' => :'BOOLEAN',
|
41
44
|
:'restrictions' => :'PaymentsConfigurationRestrictions'
|
42
45
|
}
|
43
46
|
end
|
@@ -50,16 +53,16 @@ module UltracartClient
|
|
50
53
|
# convert string to symbol for hash key
|
51
54
|
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
52
55
|
|
53
|
-
if attributes.has_key?(:'
|
54
|
-
self.accept_purchase_orders = attributes[:'
|
56
|
+
if attributes.has_key?(:'accept_purchase_orders')
|
57
|
+
self.accept_purchase_orders = attributes[:'accept_purchase_orders']
|
55
58
|
end
|
56
59
|
|
57
|
-
if attributes.has_key?(:'
|
58
|
-
self.
|
60
|
+
if attributes.has_key?(:'approved_customers_only')
|
61
|
+
self.approved_customers_only = attributes[:'approved_customers_only']
|
59
62
|
end
|
60
63
|
|
61
|
-
if attributes.has_key?(:'
|
62
|
-
self.
|
64
|
+
if attributes.has_key?(:'prevent_duplicate_number')
|
65
|
+
self.prevent_duplicate_number = attributes[:'prevent_duplicate_number']
|
63
66
|
end
|
64
67
|
|
65
68
|
if attributes.has_key?(:'restrictions')
|
@@ -86,8 +89,8 @@ module UltracartClient
|
|
86
89
|
return true if self.equal?(o)
|
87
90
|
self.class == o.class &&
|
88
91
|
accept_purchase_orders == o.accept_purchase_orders &&
|
89
|
-
|
90
|
-
|
92
|
+
approved_customers_only == o.approved_customers_only &&
|
93
|
+
prevent_duplicate_number == o.prevent_duplicate_number &&
|
91
94
|
restrictions == o.restrictions
|
92
95
|
end
|
93
96
|
|
@@ -100,7 +103,7 @@ module UltracartClient
|
|
100
103
|
# Calculates hash code according to all attributes.
|
101
104
|
# @return [Fixnum] Hash code
|
102
105
|
def hash
|
103
|
-
[accept_purchase_orders,
|
106
|
+
[accept_purchase_orders, approved_customers_only, prevent_duplicate_number, restrictions].hash
|
104
107
|
end
|
105
108
|
|
106
109
|
# Builds the object from hash
|
@@ -14,17 +14,19 @@ require 'date'
|
|
14
14
|
|
15
15
|
module UltracartClient
|
16
16
|
class PaymentsConfigurationQuoteRequest
|
17
|
+
# Master flag indicating this merchant accepts quote requests
|
17
18
|
attr_accessor :accept_quote_requests
|
18
19
|
|
19
|
-
|
20
|
+
# If true, only approved customers may use quote requests
|
21
|
+
attr_accessor :approved_customers_only
|
20
22
|
|
21
23
|
attr_accessor :restrictions
|
22
24
|
|
23
25
|
# Attribute mapping from ruby-style variable name to JSON key.
|
24
26
|
def self.attribute_map
|
25
27
|
{
|
26
|
-
:'accept_quote_requests' => :'
|
27
|
-
:'
|
28
|
+
:'accept_quote_requests' => :'accept_quote_requests',
|
29
|
+
:'approved_customers_only' => :'approved_customers_only',
|
28
30
|
:'restrictions' => :'restrictions'
|
29
31
|
}
|
30
32
|
end
|
@@ -33,7 +35,7 @@ module UltracartClient
|
|
33
35
|
def self.swagger_types
|
34
36
|
{
|
35
37
|
:'accept_quote_requests' => :'BOOLEAN',
|
36
|
-
:'
|
38
|
+
:'approved_customers_only' => :'BOOLEAN',
|
37
39
|
:'restrictions' => :'PaymentsConfigurationRestrictions'
|
38
40
|
}
|
39
41
|
end
|
@@ -46,12 +48,12 @@ module UltracartClient
|
|
46
48
|
# convert string to symbol for hash key
|
47
49
|
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
48
50
|
|
49
|
-
if attributes.has_key?(:'
|
50
|
-
self.accept_quote_requests = attributes[:'
|
51
|
+
if attributes.has_key?(:'accept_quote_requests')
|
52
|
+
self.accept_quote_requests = attributes[:'accept_quote_requests']
|
51
53
|
end
|
52
54
|
|
53
|
-
if attributes.has_key?(:'
|
54
|
-
self.
|
55
|
+
if attributes.has_key?(:'approved_customers_only')
|
56
|
+
self.approved_customers_only = attributes[:'approved_customers_only']
|
55
57
|
end
|
56
58
|
|
57
59
|
if attributes.has_key?(:'restrictions')
|
@@ -78,7 +80,7 @@ module UltracartClient
|
|
78
80
|
return true if self.equal?(o)
|
79
81
|
self.class == o.class &&
|
80
82
|
accept_quote_requests == o.accept_quote_requests &&
|
81
|
-
|
83
|
+
approved_customers_only == o.approved_customers_only &&
|
82
84
|
restrictions == o.restrictions
|
83
85
|
end
|
84
86
|
|
@@ -91,7 +93,7 @@ module UltracartClient
|
|
91
93
|
# Calculates hash code according to all attributes.
|
92
94
|
# @return [Fixnum] Hash code
|
93
95
|
def hash
|
94
|
-
[accept_quote_requests,
|
96
|
+
[accept_quote_requests, approved_customers_only, restrictions].hash
|
95
97
|
end
|
96
98
|
|
97
99
|
# Builds the object from hash
|
@@ -14,53 +14,72 @@ require 'date'
|
|
14
14
|
|
15
15
|
module UltracartClient
|
16
16
|
class PaymentsConfigurationRestrictions
|
17
|
+
attr_accessor :descriptions
|
18
|
+
|
19
|
+
# Maximum subtotal
|
17
20
|
attr_accessor :maximum_subtotal
|
18
21
|
|
22
|
+
# Minimum subtotal
|
19
23
|
attr_accessor :minimum_subtotal
|
20
24
|
|
25
|
+
# Payment method
|
21
26
|
attr_accessor :payment_method
|
22
27
|
|
28
|
+
# Alaska and Hawaii restriction
|
23
29
|
attr_accessor :restriction_alaska_hawaii
|
24
30
|
|
31
|
+
# APO/FPO restriction
|
25
32
|
attr_accessor :restriction_apo_fpo
|
26
33
|
|
34
|
+
# Canada restriction
|
27
35
|
attr_accessor :restriction_canada
|
28
36
|
|
37
|
+
# Continental US restriction
|
29
38
|
attr_accessor :restriction_continental_us
|
30
39
|
|
40
|
+
# Domestic only restriction
|
31
41
|
attr_accessor :restriction_domestic_only
|
32
42
|
|
43
|
+
# International only restriction
|
33
44
|
attr_accessor :restriction_international_only
|
34
45
|
|
46
|
+
# PO Box restriction
|
35
47
|
attr_accessor :restriction_po_box
|
36
48
|
|
49
|
+
# Puerto Rico restriction
|
37
50
|
attr_accessor :restriction_puerto_rico
|
38
51
|
|
52
|
+
# US Territories restriction
|
39
53
|
attr_accessor :restriction_us_territories
|
40
54
|
|
55
|
+
attr_accessor :themes
|
56
|
+
|
41
57
|
# Attribute mapping from ruby-style variable name to JSON key.
|
42
58
|
def self.attribute_map
|
43
59
|
{
|
44
|
-
:'
|
45
|
-
:'
|
46
|
-
:'
|
47
|
-
:'
|
48
|
-
:'
|
49
|
-
:'
|
50
|
-
:'
|
51
|
-
:'
|
52
|
-
:'
|
53
|
-
:'
|
54
|
-
:'
|
55
|
-
:'
|
60
|
+
:'descriptions' => :'descriptions',
|
61
|
+
:'maximum_subtotal' => :'maximum_subtotal',
|
62
|
+
:'minimum_subtotal' => :'minimum_subtotal',
|
63
|
+
:'payment_method' => :'payment_method',
|
64
|
+
:'restriction_alaska_hawaii' => :'restriction_alaska_hawaii',
|
65
|
+
:'restriction_apo_fpo' => :'restriction_apo_fpo',
|
66
|
+
:'restriction_canada' => :'restriction_canada',
|
67
|
+
:'restriction_continental_us' => :'restriction_continental_us',
|
68
|
+
:'restriction_domestic_only' => :'restriction_domestic_only',
|
69
|
+
:'restriction_international_only' => :'restriction_international_only',
|
70
|
+
:'restriction_po_box' => :'restriction_po_box',
|
71
|
+
:'restriction_puerto_rico' => :'restriction_puerto_rico',
|
72
|
+
:'restriction_us_territories' => :'restriction_us_territories',
|
73
|
+
:'themes' => :'themes'
|
56
74
|
}
|
57
75
|
end
|
58
76
|
|
59
77
|
# Attribute type mapping.
|
60
78
|
def self.swagger_types
|
61
79
|
{
|
62
|
-
:'
|
63
|
-
:'
|
80
|
+
:'descriptions' => :'Array<String>',
|
81
|
+
:'maximum_subtotal' => :'Float',
|
82
|
+
:'minimum_subtotal' => :'Float',
|
64
83
|
:'payment_method' => :'String',
|
65
84
|
:'restriction_alaska_hawaii' => :'String',
|
66
85
|
:'restriction_apo_fpo' => :'String',
|
@@ -70,7 +89,8 @@ module UltracartClient
|
|
70
89
|
:'restriction_international_only' => :'String',
|
71
90
|
:'restriction_po_box' => :'String',
|
72
91
|
:'restriction_puerto_rico' => :'String',
|
73
|
-
:'restriction_us_territories' => :'String'
|
92
|
+
:'restriction_us_territories' => :'String',
|
93
|
+
:'themes' => :'Array<PaymentsConfigurationRestrictionsTheme>'
|
74
94
|
}
|
75
95
|
end
|
76
96
|
|
@@ -82,52 +102,64 @@ module UltracartClient
|
|
82
102
|
# convert string to symbol for hash key
|
83
103
|
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
84
104
|
|
85
|
-
if attributes.has_key?(:'
|
86
|
-
|
105
|
+
if attributes.has_key?(:'descriptions')
|
106
|
+
if (value = attributes[:'descriptions']).is_a?(Array)
|
107
|
+
self.descriptions = value
|
108
|
+
end
|
109
|
+
end
|
110
|
+
|
111
|
+
if attributes.has_key?(:'maximum_subtotal')
|
112
|
+
self.maximum_subtotal = attributes[:'maximum_subtotal']
|
113
|
+
end
|
114
|
+
|
115
|
+
if attributes.has_key?(:'minimum_subtotal')
|
116
|
+
self.minimum_subtotal = attributes[:'minimum_subtotal']
|
87
117
|
end
|
88
118
|
|
89
|
-
if attributes.has_key?(:'
|
90
|
-
self.
|
119
|
+
if attributes.has_key?(:'payment_method')
|
120
|
+
self.payment_method = attributes[:'payment_method']
|
91
121
|
end
|
92
122
|
|
93
|
-
if attributes.has_key?(:'
|
94
|
-
self.
|
123
|
+
if attributes.has_key?(:'restriction_alaska_hawaii')
|
124
|
+
self.restriction_alaska_hawaii = attributes[:'restriction_alaska_hawaii']
|
95
125
|
end
|
96
126
|
|
97
|
-
if attributes.has_key?(:'
|
98
|
-
self.
|
127
|
+
if attributes.has_key?(:'restriction_apo_fpo')
|
128
|
+
self.restriction_apo_fpo = attributes[:'restriction_apo_fpo']
|
99
129
|
end
|
100
130
|
|
101
|
-
if attributes.has_key?(:'
|
102
|
-
self.
|
131
|
+
if attributes.has_key?(:'restriction_canada')
|
132
|
+
self.restriction_canada = attributes[:'restriction_canada']
|
103
133
|
end
|
104
134
|
|
105
|
-
if attributes.has_key?(:'
|
106
|
-
self.
|
135
|
+
if attributes.has_key?(:'restriction_continental_us')
|
136
|
+
self.restriction_continental_us = attributes[:'restriction_continental_us']
|
107
137
|
end
|
108
138
|
|
109
|
-
if attributes.has_key?(:'
|
110
|
-
self.
|
139
|
+
if attributes.has_key?(:'restriction_domestic_only')
|
140
|
+
self.restriction_domestic_only = attributes[:'restriction_domestic_only']
|
111
141
|
end
|
112
142
|
|
113
|
-
if attributes.has_key?(:'
|
114
|
-
self.
|
143
|
+
if attributes.has_key?(:'restriction_international_only')
|
144
|
+
self.restriction_international_only = attributes[:'restriction_international_only']
|
115
145
|
end
|
116
146
|
|
117
|
-
if attributes.has_key?(:'
|
118
|
-
self.
|
147
|
+
if attributes.has_key?(:'restriction_po_box')
|
148
|
+
self.restriction_po_box = attributes[:'restriction_po_box']
|
119
149
|
end
|
120
150
|
|
121
|
-
if attributes.has_key?(:'
|
122
|
-
self.
|
151
|
+
if attributes.has_key?(:'restriction_puerto_rico')
|
152
|
+
self.restriction_puerto_rico = attributes[:'restriction_puerto_rico']
|
123
153
|
end
|
124
154
|
|
125
|
-
if attributes.has_key?(:'
|
126
|
-
self.
|
155
|
+
if attributes.has_key?(:'restriction_us_territories')
|
156
|
+
self.restriction_us_territories = attributes[:'restriction_us_territories']
|
127
157
|
end
|
128
158
|
|
129
|
-
if attributes.has_key?(:'
|
130
|
-
|
159
|
+
if attributes.has_key?(:'themes')
|
160
|
+
if (value = attributes[:'themes']).is_a?(Array)
|
161
|
+
self.themes = value
|
162
|
+
end
|
131
163
|
end
|
132
164
|
end
|
133
165
|
|
@@ -149,6 +181,7 @@ module UltracartClient
|
|
149
181
|
def ==(o)
|
150
182
|
return true if self.equal?(o)
|
151
183
|
self.class == o.class &&
|
184
|
+
descriptions == o.descriptions &&
|
152
185
|
maximum_subtotal == o.maximum_subtotal &&
|
153
186
|
minimum_subtotal == o.minimum_subtotal &&
|
154
187
|
payment_method == o.payment_method &&
|
@@ -160,7 +193,8 @@ module UltracartClient
|
|
160
193
|
restriction_international_only == o.restriction_international_only &&
|
161
194
|
restriction_po_box == o.restriction_po_box &&
|
162
195
|
restriction_puerto_rico == o.restriction_puerto_rico &&
|
163
|
-
restriction_us_territories == o.restriction_us_territories
|
196
|
+
restriction_us_territories == o.restriction_us_territories &&
|
197
|
+
themes == o.themes
|
164
198
|
end
|
165
199
|
|
166
200
|
# @see the `==` method
|
@@ -172,7 +206,7 @@ module UltracartClient
|
|
172
206
|
# Calculates hash code according to all attributes.
|
173
207
|
# @return [Fixnum] Hash code
|
174
208
|
def hash
|
175
|
-
[maximum_subtotal, minimum_subtotal, payment_method, restriction_alaska_hawaii, restriction_apo_fpo, restriction_canada, restriction_continental_us, restriction_domestic_only, restriction_international_only, restriction_po_box, restriction_puerto_rico, restriction_us_territories].hash
|
209
|
+
[descriptions, maximum_subtotal, minimum_subtotal, payment_method, restriction_alaska_hawaii, restriction_apo_fpo, restriction_canada, restriction_continental_us, restriction_domestic_only, restriction_international_only, restriction_po_box, restriction_puerto_rico, restriction_us_territories, themes].hash
|
176
210
|
end
|
177
211
|
|
178
212
|
# Builds the object from hash
|
@@ -0,0 +1,202 @@
|
|
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 PaymentsConfigurationRestrictionsTheme
|
17
|
+
attr_accessor :code
|
18
|
+
|
19
|
+
attr_accessor :restriction
|
20
|
+
|
21
|
+
attr_accessor :store_front_host_name
|
22
|
+
|
23
|
+
# Attribute mapping from ruby-style variable name to JSON key.
|
24
|
+
def self.attribute_map
|
25
|
+
{
|
26
|
+
:'code' => :'code',
|
27
|
+
:'restriction' => :'restriction',
|
28
|
+
:'store_front_host_name' => :'storeFrontHostName'
|
29
|
+
}
|
30
|
+
end
|
31
|
+
|
32
|
+
# Attribute type mapping.
|
33
|
+
def self.swagger_types
|
34
|
+
{
|
35
|
+
:'code' => :'String',
|
36
|
+
:'restriction' => :'String',
|
37
|
+
:'store_front_host_name' => :'String'
|
38
|
+
}
|
39
|
+
end
|
40
|
+
|
41
|
+
# Initializes the object
|
42
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
43
|
+
def initialize(attributes = {})
|
44
|
+
return unless attributes.is_a?(Hash)
|
45
|
+
|
46
|
+
# convert string to symbol for hash key
|
47
|
+
attributes = attributes.each_with_object({}) { |(k, v), h| h[k.to_sym] = v }
|
48
|
+
|
49
|
+
if attributes.has_key?(:'code')
|
50
|
+
self.code = attributes[:'code']
|
51
|
+
end
|
52
|
+
|
53
|
+
if attributes.has_key?(:'restriction')
|
54
|
+
self.restriction = attributes[:'restriction']
|
55
|
+
end
|
56
|
+
|
57
|
+
if attributes.has_key?(:'storeFrontHostName')
|
58
|
+
self.store_front_host_name = attributes[:'storeFrontHostName']
|
59
|
+
end
|
60
|
+
end
|
61
|
+
|
62
|
+
# Show invalid properties with the reasons. Usually used together with valid?
|
63
|
+
# @return Array for valid properties with the reasons
|
64
|
+
def list_invalid_properties
|
65
|
+
invalid_properties = Array.new
|
66
|
+
invalid_properties
|
67
|
+
end
|
68
|
+
|
69
|
+
# Check to see if the all the properties in the model are valid
|
70
|
+
# @return true if the model is valid
|
71
|
+
def valid?
|
72
|
+
true
|
73
|
+
end
|
74
|
+
|
75
|
+
# Checks equality by comparing each attribute.
|
76
|
+
# @param [Object] Object to be compared
|
77
|
+
def ==(o)
|
78
|
+
return true if self.equal?(o)
|
79
|
+
self.class == o.class &&
|
80
|
+
code == o.code &&
|
81
|
+
restriction == o.restriction &&
|
82
|
+
store_front_host_name == o.store_front_host_name
|
83
|
+
end
|
84
|
+
|
85
|
+
# @see the `==` method
|
86
|
+
# @param [Object] Object to be compared
|
87
|
+
def eql?(o)
|
88
|
+
self == o
|
89
|
+
end
|
90
|
+
|
91
|
+
# Calculates hash code according to all attributes.
|
92
|
+
# @return [Fixnum] Hash code
|
93
|
+
def hash
|
94
|
+
[code, restriction, store_front_host_name].hash
|
95
|
+
end
|
96
|
+
|
97
|
+
# Builds the object from hash
|
98
|
+
# @param [Hash] attributes Model attributes in the form of hash
|
99
|
+
# @return [Object] Returns the model itself
|
100
|
+
def build_from_hash(attributes)
|
101
|
+
return nil unless attributes.is_a?(Hash)
|
102
|
+
self.class.swagger_types.each_pair do |key, type|
|
103
|
+
if type =~ /\AArray<(.*)>/i
|
104
|
+
# check to ensure the input is an array given that the attribute
|
105
|
+
# is documented as an array but the input is not
|
106
|
+
if attributes[self.class.attribute_map[key]].is_a?(Array)
|
107
|
+
self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
|
108
|
+
end
|
109
|
+
elsif !attributes[self.class.attribute_map[key]].nil?
|
110
|
+
self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
|
111
|
+
end # or else data not found in attributes(hash), not an issue as the data can be optional
|
112
|
+
end
|
113
|
+
|
114
|
+
self
|
115
|
+
end
|
116
|
+
|
117
|
+
# Deserializes the data based on type
|
118
|
+
# @param string type Data type
|
119
|
+
# @param string value Value to be deserialized
|
120
|
+
# @return [Object] Deserialized data
|
121
|
+
def _deserialize(type, value)
|
122
|
+
case type.to_sym
|
123
|
+
when :DateTime
|
124
|
+
DateTime.parse(value)
|
125
|
+
when :Date
|
126
|
+
Date.parse(value)
|
127
|
+
when :String
|
128
|
+
value.to_s
|
129
|
+
when :Integer
|
130
|
+
value.to_i
|
131
|
+
when :Float
|
132
|
+
value.to_f
|
133
|
+
when :BOOLEAN
|
134
|
+
if value.to_s =~ /\A(true|t|yes|y|1)\z/i
|
135
|
+
true
|
136
|
+
else
|
137
|
+
false
|
138
|
+
end
|
139
|
+
when :Object
|
140
|
+
# generic object (usually a Hash), return directly
|
141
|
+
value
|
142
|
+
when /\AArray<(?<inner_type>.+)>\z/
|
143
|
+
inner_type = Regexp.last_match[:inner_type]
|
144
|
+
value.map { |v| _deserialize(inner_type, v) }
|
145
|
+
when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
|
146
|
+
k_type = Regexp.last_match[:k_type]
|
147
|
+
v_type = Regexp.last_match[:v_type]
|
148
|
+
{}.tap do |hash|
|
149
|
+
value.each do |k, v|
|
150
|
+
hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
|
151
|
+
end
|
152
|
+
end
|
153
|
+
else # model
|
154
|
+
temp_model = UltracartClient.const_get(type).new
|
155
|
+
temp_model.build_from_hash(value)
|
156
|
+
end
|
157
|
+
end
|
158
|
+
|
159
|
+
# Returns the string representation of the object
|
160
|
+
# @return [String] String presentation of the object
|
161
|
+
def to_s
|
162
|
+
to_hash.to_s
|
163
|
+
end
|
164
|
+
|
165
|
+
# to_body is an alias to to_hash (backward compatibility)
|
166
|
+
# @return [Hash] Returns the object in the form of hash
|
167
|
+
def to_body
|
168
|
+
to_hash
|
169
|
+
end
|
170
|
+
|
171
|
+
# Returns the object in the form of hash
|
172
|
+
# @return [Hash] Returns the object in the form of hash
|
173
|
+
def to_hash
|
174
|
+
hash = {}
|
175
|
+
self.class.attribute_map.each_pair do |attr, param|
|
176
|
+
value = self.send(attr)
|
177
|
+
next if value.nil?
|
178
|
+
hash[param] = _to_hash(value)
|
179
|
+
end
|
180
|
+
hash
|
181
|
+
end
|
182
|
+
|
183
|
+
# Outputs non-array value in the form of hash
|
184
|
+
# For object, use to_hash. Otherwise, just return the value
|
185
|
+
# @param [Object] value Any valid value
|
186
|
+
# @return [Hash] Returns the value in the form of hash
|
187
|
+
def _to_hash(value)
|
188
|
+
if value.is_a?(Array)
|
189
|
+
value.compact.map { |v| _to_hash(v) }
|
190
|
+
elsif value.is_a?(Hash)
|
191
|
+
{}.tap do |hash|
|
192
|
+
value.each { |k, v| hash[k] = _to_hash(v) }
|
193
|
+
end
|
194
|
+
elsif value.respond_to? :to_hash
|
195
|
+
value.to_hash
|
196
|
+
else
|
197
|
+
value
|
198
|
+
end
|
199
|
+
end
|
200
|
+
|
201
|
+
end
|
202
|
+
end
|