ultracart_api 4.1.152 → 4.1.153

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.
@@ -239,6 +239,83 @@ module UltracartClient
239
239
  return data, status_code, headers
240
240
  end
241
241
 
242
+ # Detach an image from a page
243
+ # Name exactly one of code or default. Removes the page's copy of the image; the source file in the page folder is left alone. Always needs sfvb_publish.
244
+ # @param storefront_oid [Integer]
245
+ # @param path [String] Page path, for example /catalog/dispensers/
246
+ # @param [Hash] opts the optional parameters
247
+ # @option opts [String] :code Image code to detach
248
+ # @option opts [Boolean] :default True to detach the default image
249
+ # @return [SfvbPageResponse]
250
+ def delete_sfvb_page_multimedia(storefront_oid, path, opts = {})
251
+ data, _status_code, _headers = delete_sfvb_page_multimedia_with_http_info(storefront_oid, path, opts)
252
+ data
253
+ end
254
+
255
+ # Detach an image from a page
256
+ # Name exactly one of code or default. Removes the page's copy of the image; the source file in the page folder is left alone. Always needs sfvb_publish.
257
+ # @param storefront_oid [Integer]
258
+ # @param path [String] Page path, for example /catalog/dispensers/
259
+ # @param [Hash] opts the optional parameters
260
+ # @option opts [String] :code Image code to detach
261
+ # @option opts [Boolean] :default True to detach the default image
262
+ # @return [Array<(SfvbPageResponse, Integer, Hash)>] SfvbPageResponse data, response status code and response headers
263
+ def delete_sfvb_page_multimedia_with_http_info(storefront_oid, path, opts = {})
264
+ if @api_client.config.debugging
265
+ @api_client.config.logger.debug 'Calling API: SfvbApi.delete_sfvb_page_multimedia ...'
266
+ end
267
+ # verify the required parameter 'storefront_oid' is set
268
+ if @api_client.config.client_side_validation && storefront_oid.nil?
269
+ fail ArgumentError, "Missing the required parameter 'storefront_oid' when calling SfvbApi.delete_sfvb_page_multimedia"
270
+ end
271
+ # verify the required parameter 'path' is set
272
+ if @api_client.config.client_side_validation && path.nil?
273
+ fail ArgumentError, "Missing the required parameter 'path' when calling SfvbApi.delete_sfvb_page_multimedia"
274
+ end
275
+ # resource path
276
+ local_var_path = '/sfvb/storefronts/{storefront_oid}/pages/multimedia'.sub('{' + 'storefront_oid' + '}', CGI.escape(storefront_oid.to_s))
277
+
278
+ # query parameters
279
+ query_params = opts[:query_params] || {}
280
+ query_params[:'path'] = path
281
+ query_params[:'code'] = opts[:'code'] if !opts[:'code'].nil?
282
+ query_params[:'default'] = opts[:'default'] if !opts[:'default'].nil?
283
+
284
+ # header parameters
285
+ header_params = opts[:header_params] || {}
286
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
287
+ # HTTP header 'Accept' (if needed)
288
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
289
+
290
+ # form parameters
291
+ form_params = opts[:form_params] || {}
292
+
293
+ # http body (model)
294
+ post_body = opts[:debug_body]
295
+
296
+ # return_type
297
+ return_type = opts[:debug_return_type] || 'SfvbPageResponse'
298
+
299
+ # auth_names
300
+ auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
301
+
302
+ new_options = opts.merge(
303
+ :operation => :"SfvbApi.delete_sfvb_page_multimedia",
304
+ :header_params => header_params,
305
+ :query_params => query_params,
306
+ :form_params => form_params,
307
+ :body => post_body,
308
+ :auth_names => auth_names,
309
+ :return_type => return_type
310
+ )
311
+
312
+ data, status_code, headers = @api_client.call_api(:DELETE, local_var_path, new_options)
313
+ if @api_client.config.debugging
314
+ @api_client.config.logger.debug "API called: SfvbApi#delete_sfvb_page_multimedia\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
315
+ end
316
+ return data, status_code, headers
317
+ end
318
+
242
319
  # Delete a preview session
243
320
  # Releases the session before its eight hour expiry. Without this the only way to free one is to wait, which is a poor answer for a tool that may open a dozen in an afternoon.
244
321
  # @param storefront_oid [Integer]
@@ -954,6 +1031,77 @@ module UltracartClient
954
1031
  return data, status_code, headers
955
1032
  end
956
1033
 
1034
+ # Read a page's attributes and images
1035
+ # What the pageattribute and pageimage elements render for this page. These are not in any file, which is why a page folder can be empty and its elements still render something. Attributes and image codes a template declares but nothing has set are included, so the response describes what the page can show rather than only what has been saved.
1036
+ # @param storefront_oid [Integer]
1037
+ # @param path [String] Page path, for example /catalog/dispensers/
1038
+ # @param [Hash] opts the optional parameters
1039
+ # @return [SfvbPageResponse]
1040
+ def get_sfvb_page(storefront_oid, path, opts = {})
1041
+ data, _status_code, _headers = get_sfvb_page_with_http_info(storefront_oid, path, opts)
1042
+ data
1043
+ end
1044
+
1045
+ # Read a page&#39;s attributes and images
1046
+ # What the pageattribute and pageimage elements render for this page. These are not in any file, which is why a page folder can be empty and its elements still render something. Attributes and image codes a template declares but nothing has set are included, so the response describes what the page can show rather than only what has been saved.
1047
+ # @param storefront_oid [Integer]
1048
+ # @param path [String] Page path, for example /catalog/dispensers/
1049
+ # @param [Hash] opts the optional parameters
1050
+ # @return [Array<(SfvbPageResponse, Integer, Hash)>] SfvbPageResponse data, response status code and response headers
1051
+ def get_sfvb_page_with_http_info(storefront_oid, path, opts = {})
1052
+ if @api_client.config.debugging
1053
+ @api_client.config.logger.debug 'Calling API: SfvbApi.get_sfvb_page ...'
1054
+ end
1055
+ # verify the required parameter 'storefront_oid' is set
1056
+ if @api_client.config.client_side_validation && storefront_oid.nil?
1057
+ fail ArgumentError, "Missing the required parameter 'storefront_oid' when calling SfvbApi.get_sfvb_page"
1058
+ end
1059
+ # verify the required parameter 'path' is set
1060
+ if @api_client.config.client_side_validation && path.nil?
1061
+ fail ArgumentError, "Missing the required parameter 'path' when calling SfvbApi.get_sfvb_page"
1062
+ end
1063
+ # resource path
1064
+ local_var_path = '/sfvb/storefronts/{storefront_oid}/pages'.sub('{' + 'storefront_oid' + '}', CGI.escape(storefront_oid.to_s))
1065
+
1066
+ # query parameters
1067
+ query_params = opts[:query_params] || {}
1068
+ query_params[:'path'] = path
1069
+
1070
+ # header parameters
1071
+ header_params = opts[:header_params] || {}
1072
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
1073
+ # HTTP header 'Accept' (if needed)
1074
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
1075
+
1076
+ # form parameters
1077
+ form_params = opts[:form_params] || {}
1078
+
1079
+ # http body (model)
1080
+ post_body = opts[:debug_body]
1081
+
1082
+ # return_type
1083
+ return_type = opts[:debug_return_type] || 'SfvbPageResponse'
1084
+
1085
+ # auth_names
1086
+ auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
1087
+
1088
+ new_options = opts.merge(
1089
+ :operation => :"SfvbApi.get_sfvb_page",
1090
+ :header_params => header_params,
1091
+ :query_params => query_params,
1092
+ :form_params => form_params,
1093
+ :body => post_body,
1094
+ :auth_names => auth_names,
1095
+ :return_type => return_type
1096
+ )
1097
+
1098
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1099
+ if @api_client.config.debugging
1100
+ @api_client.config.logger.debug "API called: SfvbApi#get_sfvb_page\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1101
+ end
1102
+ return data, status_code, headers
1103
+ end
1104
+
957
1105
  # URL that renders a preview session
958
1106
  # Refuses a session that does not exist, so a URL you receive is for a session that was really there. expires_in_seconds is the time actually remaining, not the configured lifetime. Needs a token that resolves to a user, because a preview session belongs to the person who created it.
959
1107
  # @param storefront_oid [Integer]
@@ -2059,6 +2207,170 @@ module UltracartClient
2059
2207
  return data, status_code, headers
2060
2208
  end
2061
2209
 
2210
+ # Change a page's attributes
2211
+ # A partial update. Only the attributes you name are changed. Every entry is checked before any is written. List, slider, item set, page collection and video list attributes are refused - edit those in the page editor. Always needs sfvb_publish, because a page's attributes are shared by every theme and there is no dormant copy to change instead.
2212
+ # @param storefront_oid [Integer]
2213
+ # @param path [String] Page path, for example /catalog/dispensers/
2214
+ # @param page_attribute_update_request [SfvbPageAttributeUpdateRequest] Attributes to change
2215
+ # @param [Hash] opts the optional parameters
2216
+ # @return [SfvbPageResponse]
2217
+ def put_sfvb_page_attributes(storefront_oid, path, page_attribute_update_request, opts = {})
2218
+ data, _status_code, _headers = put_sfvb_page_attributes_with_http_info(storefront_oid, path, page_attribute_update_request, opts)
2219
+ data
2220
+ end
2221
+
2222
+ # Change a page&#39;s attributes
2223
+ # A partial update. Only the attributes you name are changed. Every entry is checked before any is written. List, slider, item set, page collection and video list attributes are refused - edit those in the page editor. Always needs sfvb_publish, because a page&#39;s attributes are shared by every theme and there is no dormant copy to change instead.
2224
+ # @param storefront_oid [Integer]
2225
+ # @param path [String] Page path, for example /catalog/dispensers/
2226
+ # @param page_attribute_update_request [SfvbPageAttributeUpdateRequest] Attributes to change
2227
+ # @param [Hash] opts the optional parameters
2228
+ # @return [Array<(SfvbPageResponse, Integer, Hash)>] SfvbPageResponse data, response status code and response headers
2229
+ def put_sfvb_page_attributes_with_http_info(storefront_oid, path, page_attribute_update_request, opts = {})
2230
+ if @api_client.config.debugging
2231
+ @api_client.config.logger.debug 'Calling API: SfvbApi.put_sfvb_page_attributes ...'
2232
+ end
2233
+ # verify the required parameter 'storefront_oid' is set
2234
+ if @api_client.config.client_side_validation && storefront_oid.nil?
2235
+ fail ArgumentError, "Missing the required parameter 'storefront_oid' when calling SfvbApi.put_sfvb_page_attributes"
2236
+ end
2237
+ # verify the required parameter 'path' is set
2238
+ if @api_client.config.client_side_validation && path.nil?
2239
+ fail ArgumentError, "Missing the required parameter 'path' when calling SfvbApi.put_sfvb_page_attributes"
2240
+ end
2241
+ # verify the required parameter 'page_attribute_update_request' is set
2242
+ if @api_client.config.client_side_validation && page_attribute_update_request.nil?
2243
+ fail ArgumentError, "Missing the required parameter 'page_attribute_update_request' when calling SfvbApi.put_sfvb_page_attributes"
2244
+ end
2245
+ # resource path
2246
+ local_var_path = '/sfvb/storefronts/{storefront_oid}/pages/attributes'.sub('{' + 'storefront_oid' + '}', CGI.escape(storefront_oid.to_s))
2247
+
2248
+ # query parameters
2249
+ query_params = opts[:query_params] || {}
2250
+ query_params[:'path'] = path
2251
+
2252
+ # header parameters
2253
+ header_params = opts[:header_params] || {}
2254
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
2255
+ # HTTP header 'Accept' (if needed)
2256
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
2257
+ # HTTP header 'Content-Type'
2258
+ content_type = @api_client.select_header_content_type(['application/json'])
2259
+ if !content_type.nil?
2260
+ header_params['Content-Type'] = content_type
2261
+ end
2262
+
2263
+ # form parameters
2264
+ form_params = opts[:form_params] || {}
2265
+
2266
+ # http body (model)
2267
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(page_attribute_update_request)
2268
+
2269
+ # return_type
2270
+ return_type = opts[:debug_return_type] || 'SfvbPageResponse'
2271
+
2272
+ # auth_names
2273
+ auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
2274
+
2275
+ new_options = opts.merge(
2276
+ :operation => :"SfvbApi.put_sfvb_page_attributes",
2277
+ :header_params => header_params,
2278
+ :query_params => query_params,
2279
+ :form_params => form_params,
2280
+ :body => post_body,
2281
+ :auth_names => auth_names,
2282
+ :return_type => return_type
2283
+ )
2284
+
2285
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
2286
+ if @api_client.config.debugging
2287
+ @api_client.config.logger.debug "API called: SfvbApi#put_sfvb_page_attributes\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2288
+ end
2289
+ return data, status_code, headers
2290
+ end
2291
+
2292
+ # Attach an image to a page
2293
+ # Upload the image with files/upload to the page path followed by a filename first, then name that filename here as either the default image or an image code. The default image is what a pageimage element with no pageImageCode renders, and what a subgroup tile shows. Replaces whatever that slot held. Always needs sfvb_publish.
2294
+ # @param storefront_oid [Integer]
2295
+ # @param path [String] Page path, for example /catalog/dispensers/
2296
+ # @param page_multimedia_request [SfvbPageMultimediaRequest] Image to attach
2297
+ # @param [Hash] opts the optional parameters
2298
+ # @return [SfvbPageResponse]
2299
+ def put_sfvb_page_multimedia(storefront_oid, path, page_multimedia_request, opts = {})
2300
+ data, _status_code, _headers = put_sfvb_page_multimedia_with_http_info(storefront_oid, path, page_multimedia_request, opts)
2301
+ data
2302
+ end
2303
+
2304
+ # Attach an image to a page
2305
+ # Upload the image with files/upload to the page path followed by a filename first, then name that filename here as either the default image or an image code. The default image is what a pageimage element with no pageImageCode renders, and what a subgroup tile shows. Replaces whatever that slot held. Always needs sfvb_publish.
2306
+ # @param storefront_oid [Integer]
2307
+ # @param path [String] Page path, for example /catalog/dispensers/
2308
+ # @param page_multimedia_request [SfvbPageMultimediaRequest] Image to attach
2309
+ # @param [Hash] opts the optional parameters
2310
+ # @return [Array<(SfvbPageResponse, Integer, Hash)>] SfvbPageResponse data, response status code and response headers
2311
+ def put_sfvb_page_multimedia_with_http_info(storefront_oid, path, page_multimedia_request, opts = {})
2312
+ if @api_client.config.debugging
2313
+ @api_client.config.logger.debug 'Calling API: SfvbApi.put_sfvb_page_multimedia ...'
2314
+ end
2315
+ # verify the required parameter 'storefront_oid' is set
2316
+ if @api_client.config.client_side_validation && storefront_oid.nil?
2317
+ fail ArgumentError, "Missing the required parameter 'storefront_oid' when calling SfvbApi.put_sfvb_page_multimedia"
2318
+ end
2319
+ # verify the required parameter 'path' is set
2320
+ if @api_client.config.client_side_validation && path.nil?
2321
+ fail ArgumentError, "Missing the required parameter 'path' when calling SfvbApi.put_sfvb_page_multimedia"
2322
+ end
2323
+ # verify the required parameter 'page_multimedia_request' is set
2324
+ if @api_client.config.client_side_validation && page_multimedia_request.nil?
2325
+ fail ArgumentError, "Missing the required parameter 'page_multimedia_request' when calling SfvbApi.put_sfvb_page_multimedia"
2326
+ end
2327
+ # resource path
2328
+ local_var_path = '/sfvb/storefronts/{storefront_oid}/pages/multimedia'.sub('{' + 'storefront_oid' + '}', CGI.escape(storefront_oid.to_s))
2329
+
2330
+ # query parameters
2331
+ query_params = opts[:query_params] || {}
2332
+ query_params[:'path'] = path
2333
+
2334
+ # header parameters
2335
+ header_params = opts[:header_params] || {}
2336
+ header_params['X-UltraCart-Api-Version'] = @api_client.select_header_api_version()
2337
+ # HTTP header 'Accept' (if needed)
2338
+ header_params['Accept'] = @api_client.select_header_accept(['application/json'])
2339
+ # HTTP header 'Content-Type'
2340
+ content_type = @api_client.select_header_content_type(['application/json'])
2341
+ if !content_type.nil?
2342
+ header_params['Content-Type'] = content_type
2343
+ end
2344
+
2345
+ # form parameters
2346
+ form_params = opts[:form_params] || {}
2347
+
2348
+ # http body (model)
2349
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(page_multimedia_request)
2350
+
2351
+ # return_type
2352
+ return_type = opts[:debug_return_type] || 'SfvbPageResponse'
2353
+
2354
+ # auth_names
2355
+ auth_names = opts[:debug_auth_names] || ['ultraCartOauth', 'ultraCartSimpleApiKey']
2356
+
2357
+ new_options = opts.merge(
2358
+ :operation => :"SfvbApi.put_sfvb_page_multimedia",
2359
+ :header_params => header_params,
2360
+ :query_params => query_params,
2361
+ :form_params => form_params,
2362
+ :body => post_body,
2363
+ :auth_names => auth_names,
2364
+ :return_type => return_type
2365
+ )
2366
+
2367
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
2368
+ if @api_client.config.debugging
2369
+ @api_client.config.logger.debug "API called: SfvbApi#put_sfvb_page_multimedia\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2370
+ end
2371
+ return data, status_code, headers
2372
+ end
2373
+
2062
2374
  # Push containers into a preview session
2063
2375
  # Stores compiled containers against a session created by createSfvbPreviewSession. Replaces whatever the session held. The session must exist - this does not create one, so a deleted, expired or never issued id is a 404 rather than a new session. Nothing durable is written. Requires a token that resolves to a user, so use the device authorization flow.
2064
2376
  # @param storefront_oid [Integer]
@@ -0,0 +1,324 @@
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 SfvbPageAttribute
18
+ # True when the active theme marks this attribute as on its way out. Prefer not to build on it.
19
+ attr_accessor :deprecated
20
+
21
+ # Attribute name, as the template's uc page-attribute directive spells it. Compare case insensitively. This is the value pageAttributeName refers to.
22
+ attr_accessor :name
23
+
24
+ # What kind of attribute this is, taken from the template that declares it rather than from the stored row. orphan means no template declares it. reserved covers the page SEO fields.
25
+ attr_accessor :type
26
+
27
+ # True when no template references this name. Writing such a name is allowed, but if you did not mean to create one this is a misspelling and nothing on the page will show it.
28
+ attr_accessor :undeclared
29
+
30
+ # The other themes that declare this attribute, when the active theme does not.
31
+ attr_accessor :used_by
32
+
33
+ # True when a template in the active theme declares this attribute.
34
+ attr_accessor :used_by_current_theme
35
+
36
+ # The stored value. Empty when a template declares the attribute and nothing has set it.
37
+ attr_accessor :value
38
+
39
+ # True when this API will change the value. List, slider, item set, page collection and video list values are structured documents carrying their own translation references and derived data, so they are shown here but must be edited in the page editor.
40
+ attr_accessor :writable
41
+
42
+ class EnumAttributeValidator
43
+ attr_reader :datatype
44
+ attr_reader :allowable_values
45
+
46
+ def initialize(datatype, allowable_values)
47
+ @allowable_values = allowable_values.map do |value|
48
+ case datatype.to_s
49
+ when /Integer/i
50
+ value.to_i
51
+ when /Float/i
52
+ value.to_f
53
+ else
54
+ value
55
+ end
56
+ end
57
+ end
58
+
59
+ def valid?(value)
60
+ !value || allowable_values.include?(value)
61
+ end
62
+ end
63
+
64
+ # Attribute mapping from ruby-style variable name to JSON key.
65
+ def self.attribute_map
66
+ {
67
+ :'deprecated' => :'deprecated',
68
+ :'name' => :'name',
69
+ :'type' => :'type',
70
+ :'undeclared' => :'undeclared',
71
+ :'used_by' => :'used_by',
72
+ :'used_by_current_theme' => :'used_by_current_theme',
73
+ :'value' => :'value',
74
+ :'writable' => :'writable'
75
+ }
76
+ end
77
+
78
+ # Returns all the JSON keys this model knows about
79
+ def self.acceptable_attributes
80
+ attribute_map.values
81
+ end
82
+
83
+ # Attribute type mapping.
84
+ def self.openapi_types
85
+ {
86
+ :'deprecated' => :'Boolean',
87
+ :'name' => :'String',
88
+ :'type' => :'String',
89
+ :'undeclared' => :'Boolean',
90
+ :'used_by' => :'String',
91
+ :'used_by_current_theme' => :'Boolean',
92
+ :'value' => :'String',
93
+ :'writable' => :'Boolean'
94
+ }
95
+ end
96
+
97
+ # List of attributes with nullable: true
98
+ def self.openapi_nullable
99
+ Set.new([
100
+ ])
101
+ end
102
+
103
+ # Initializes the object
104
+ # @param [Hash] attributes Model attributes in the form of hash
105
+ def initialize(attributes = {})
106
+ if (!attributes.is_a?(Hash))
107
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbPageAttribute` initialize method"
108
+ end
109
+
110
+ # check to see if the attribute exists and convert string to symbol for hash key
111
+ attributes = attributes.each_with_object({}) { |(k, v), h|
112
+ if (!self.class.attribute_map.key?(k.to_sym))
113
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbPageAttribute`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
114
+ end
115
+ h[k.to_sym] = v
116
+ }
117
+
118
+ if attributes.key?(:'deprecated')
119
+ self.deprecated = attributes[:'deprecated']
120
+ end
121
+
122
+ if attributes.key?(:'name')
123
+ self.name = attributes[:'name']
124
+ end
125
+
126
+ if attributes.key?(:'type')
127
+ self.type = attributes[:'type']
128
+ end
129
+
130
+ if attributes.key?(:'undeclared')
131
+ self.undeclared = attributes[:'undeclared']
132
+ end
133
+
134
+ if attributes.key?(:'used_by')
135
+ self.used_by = attributes[:'used_by']
136
+ end
137
+
138
+ if attributes.key?(:'used_by_current_theme')
139
+ self.used_by_current_theme = attributes[:'used_by_current_theme']
140
+ end
141
+
142
+ if attributes.key?(:'value')
143
+ self.value = attributes[:'value']
144
+ end
145
+
146
+ if attributes.key?(:'writable')
147
+ self.writable = attributes[:'writable']
148
+ end
149
+ end
150
+
151
+ # Show invalid properties with the reasons. Usually used together with valid?
152
+ # @return Array for valid properties with the reasons
153
+ def list_invalid_properties
154
+ invalid_properties = Array.new
155
+ invalid_properties
156
+ end
157
+
158
+ # Check to see if the all the properties in the model are valid
159
+ # @return true if the model is valid
160
+ def valid?
161
+ type_validator = EnumAttributeValidator.new('String', ["string", "color", "rgba", "boolean", "integer", "html", "orphan", "multiline", "reserved", "itemset", "slider", "simplelist", "definitionlist", "pagecollection", "font", "videolist", "mailinglist"])
162
+ return false unless type_validator.valid?(@type)
163
+ true
164
+ end
165
+
166
+ # Custom attribute writer method checking allowed values (enum).
167
+ # @param [Object] type Object to be assigned
168
+ def type=(type)
169
+ validator = EnumAttributeValidator.new('String', ["string", "color", "rgba", "boolean", "integer", "html", "orphan", "multiline", "reserved", "itemset", "slider", "simplelist", "definitionlist", "pagecollection", "font", "videolist", "mailinglist"])
170
+ unless validator.valid?(type)
171
+ fail ArgumentError, "invalid value for \"type\", must be one of #{validator.allowable_values}."
172
+ end
173
+ @type = type
174
+ end
175
+
176
+ # Checks equality by comparing each attribute.
177
+ # @param [Object] Object to be compared
178
+ def ==(o)
179
+ return true if self.equal?(o)
180
+ self.class == o.class &&
181
+ deprecated == o.deprecated &&
182
+ name == o.name &&
183
+ type == o.type &&
184
+ undeclared == o.undeclared &&
185
+ used_by == o.used_by &&
186
+ used_by_current_theme == o.used_by_current_theme &&
187
+ value == o.value &&
188
+ writable == o.writable
189
+ end
190
+
191
+ # @see the `==` method
192
+ # @param [Object] Object to be compared
193
+ def eql?(o)
194
+ self == o
195
+ end
196
+
197
+ # Calculates hash code according to all attributes.
198
+ # @return [Integer] Hash code
199
+ def hash
200
+ [deprecated, name, type, undeclared, used_by, used_by_current_theme, value, writable].hash
201
+ end
202
+
203
+ # Builds the object from hash
204
+ # @param [Hash] attributes Model attributes in the form of hash
205
+ # @return [Object] Returns the model itself
206
+ def self.build_from_hash(attributes)
207
+ new.build_from_hash(attributes)
208
+ end
209
+
210
+ # Builds the object from hash
211
+ # @param [Hash] attributes Model attributes in the form of hash
212
+ # @return [Object] Returns the model itself
213
+ def build_from_hash(attributes)
214
+ return nil unless attributes.is_a?(Hash)
215
+ attributes = attributes.transform_keys(&:to_sym)
216
+ self.class.openapi_types.each_pair do |key, type|
217
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
218
+ self.send("#{key}=", nil)
219
+ elsif type =~ /\AArray<(.*)>/i
220
+ # check to ensure the input is an array given that the attribute
221
+ # is documented as an array but the input is not
222
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
223
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
224
+ end
225
+ elsif !attributes[self.class.attribute_map[key]].nil?
226
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
227
+ end
228
+ end
229
+
230
+ self
231
+ end
232
+
233
+ # Deserializes the data based on type
234
+ # @param string type Data type
235
+ # @param string value Value to be deserialized
236
+ # @return [Object] Deserialized data
237
+ def _deserialize(type, value)
238
+ case type.to_sym
239
+ when :Time
240
+ Time.parse(value)
241
+ when :Date
242
+ Date.parse(value)
243
+ when :String
244
+ value.to_s
245
+ when :Integer
246
+ value.to_i
247
+ when :Float
248
+ value.to_f
249
+ when :Boolean
250
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
251
+ true
252
+ else
253
+ false
254
+ end
255
+ when :Object
256
+ # generic object (usually a Hash), return directly
257
+ value
258
+ when /\AArray<(?<inner_type>.+)>\z/
259
+ inner_type = Regexp.last_match[:inner_type]
260
+ value.map { |v| _deserialize(inner_type, v) }
261
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
262
+ k_type = Regexp.last_match[:k_type]
263
+ v_type = Regexp.last_match[:v_type]
264
+ {}.tap do |hash|
265
+ value.each do |k, v|
266
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
267
+ end
268
+ end
269
+ else # model
270
+ # models (e.g. Pet) or oneOf
271
+ klass = UltracartClient.const_get(type)
272
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
273
+ end
274
+ end
275
+
276
+ # Returns the string representation of the object
277
+ # @return [String] String presentation of the object
278
+ def to_s
279
+ to_hash.to_s
280
+ end
281
+
282
+ # to_body is an alias to to_hash (backward compatibility)
283
+ # @return [Hash] Returns the object in the form of hash
284
+ def to_body
285
+ to_hash
286
+ end
287
+
288
+ # Returns the object in the form of hash
289
+ # @return [Hash] Returns the object in the form of hash
290
+ def to_hash
291
+ hash = {}
292
+ self.class.attribute_map.each_pair do |attr, param|
293
+ value = self.send(attr)
294
+ if value.nil?
295
+ is_nullable = self.class.openapi_nullable.include?(attr)
296
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
297
+ end
298
+
299
+ hash[param] = _to_hash(value)
300
+ end
301
+ hash
302
+ end
303
+
304
+ # Outputs non-array value in the form of hash
305
+ # For object, use to_hash. Otherwise, just return the value
306
+ # @param [Object] value Any valid value
307
+ # @return [Hash] Returns the value in the form of hash
308
+ def _to_hash(value)
309
+ if value.is_a?(Array)
310
+ value.compact.map { |v| _to_hash(v) }
311
+ elsif value.is_a?(Hash)
312
+ {}.tap do |hash|
313
+ value.each { |k, v| hash[k] = _to_hash(v) }
314
+ end
315
+ elsif value.respond_to? :to_hash
316
+ value.to_hash
317
+ else
318
+ value
319
+ end
320
+ end
321
+
322
+ end
323
+
324
+ end