ultracart_api 4.1.252 → 4.1.254

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.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +17 -2
  3. data/docs/SfvbApi.md +238 -12
  4. data/docs/SfvbApprovalParams.md +6 -0
  5. data/docs/SfvbFileContentResult.md +22 -0
  6. data/docs/SfvbFilesContentRequest.md +18 -0
  7. data/docs/SfvbFilesContentResponse.md +20 -0
  8. data/docs/SfvbMenusResponse.md +1 -1
  9. data/docs/SfvbPageListResponse.md +5 -1
  10. data/docs/SfvbPageMoveRequest.md +26 -0
  11. data/docs/SfvbPageMoveResponse.md +32 -0
  12. data/docs/SfvbPageResponse.md +6 -0
  13. data/docs/SfvbPageSettingsRequest.md +6 -0
  14. data/docs/SfvbPageSummary.md +4 -0
  15. data/docs/SfvbSearchFacet.md +26 -0
  16. data/docs/SfvbSearchFacetUpdate.md +24 -0
  17. data/docs/SfvbSearchFacetsRequest.md +22 -0
  18. data/docs/SfvbSearchFacetsResponse.md +30 -0
  19. data/lib/ultracart_api/api/sfvb_api.rb +326 -20
  20. data/lib/ultracart_api/models/sfvb_approval_create_request.rb +2 -2
  21. data/lib/ultracart_api/models/sfvb_approval_params.rb +31 -1
  22. data/lib/ultracart_api/models/sfvb_file_content_result.rb +238 -0
  23. data/lib/ultracart_api/models/sfvb_files_content_request.rb +222 -0
  24. data/lib/ultracart_api/models/sfvb_files_content_response.rb +234 -0
  25. data/lib/ultracart_api/models/sfvb_menus_response.rb +1 -1
  26. data/lib/ultracart_api/models/sfvb_page_list_response.rb +24 -4
  27. data/lib/ultracart_api/models/sfvb_page_move_request.rb +294 -0
  28. data/lib/ultracart_api/models/sfvb_page_move_response.rb +290 -0
  29. data/lib/ultracart_api/models/sfvb_page_response.rb +32 -1
  30. data/lib/ultracart_api/models/sfvb_page_settings_request.rb +65 -1
  31. data/lib/ultracart_api/models/sfvb_page_summary.rb +20 -1
  32. data/lib/ultracart_api/models/sfvb_search_facet.rb +260 -0
  33. data/lib/ultracart_api/models/sfvb_search_facet_update.rb +250 -0
  34. data/lib/ultracart_api/models/sfvb_search_facets_request.rb +244 -0
  35. data/lib/ultracart_api/models/sfvb_search_facets_response.rb +286 -0
  36. data/lib/ultracart_api/version.rb +1 -1
  37. data/lib/ultracart_api.rb +9 -0
  38. metadata +20 -2
@@ -21,6 +21,9 @@ module UltracartClient
21
21
  # Template that renders the blog posts under this page. Omitted when not set.
22
22
  attr_accessor :blog_post_template
23
23
 
24
+ # The page's id. It stays the same when the page is moved or renamed, where the path and the page folder's id do not. The page read accepts it in place of path.
25
+ attr_accessor :catalog_group_oid
26
+
24
27
  # The page description, the text a page template renders as the page's description. Omitted when empty.
25
28
  attr_accessor :description
26
29
 
@@ -45,6 +48,11 @@ module UltracartClient
45
48
  # The page path, normalized to begin and end with a slash.
46
49
  attr_accessor :path
47
50
 
51
+ attr_accessor :redirect
52
+
53
+ # Findings on that redirect that did not block it, such as a chain. Left out when there are none.
54
+ attr_accessor :redirect_warnings
55
+
48
56
  # Template that renders the item review pages under this page. Omitted when not set.
49
57
  attr_accessor :review_template
50
58
 
@@ -71,6 +79,7 @@ module UltracartClient
71
79
  {
72
80
  :'attributes' => :'attributes',
73
81
  :'blog_post_template' => :'blog_post_template',
82
+ :'catalog_group_oid' => :'catalog_group_oid',
74
83
  :'description' => :'description',
75
84
  :'exclude_from_sitemap' => :'exclude_from_sitemap',
76
85
  :'group_template' => :'group_template',
@@ -79,6 +88,8 @@ module UltracartClient
79
88
  :'multimedia' => :'multimedia',
80
89
  :'page_type' => :'page_type',
81
90
  :'path' => :'path',
91
+ :'redirect' => :'redirect',
92
+ :'redirect_warnings' => :'redirect_warnings',
82
93
  :'review_template' => :'review_template',
83
94
  :'sort_order' => :'sort_order',
84
95
  :'sort_order_child_groups' => :'sort_order_child_groups',
@@ -99,6 +110,7 @@ module UltracartClient
99
110
  {
100
111
  :'attributes' => :'Array<SfvbPageAttribute>',
101
112
  :'blog_post_template' => :'String',
113
+ :'catalog_group_oid' => :'Integer',
102
114
  :'description' => :'String',
103
115
  :'exclude_from_sitemap' => :'Boolean',
104
116
  :'group_template' => :'String',
@@ -107,6 +119,8 @@ module UltracartClient
107
119
  :'multimedia' => :'Array<SfvbPageMultimedia>',
108
120
  :'page_type' => :'String',
109
121
  :'path' => :'String',
122
+ :'redirect' => :'SfvbRedirect',
123
+ :'redirect_warnings' => :'Array<SfvbErrorDetail>',
110
124
  :'review_template' => :'String',
111
125
  :'sort_order' => :'Integer',
112
126
  :'sort_order_child_groups' => :'String',
@@ -148,6 +162,10 @@ module UltracartClient
148
162
  self.blog_post_template = attributes[:'blog_post_template']
149
163
  end
150
164
 
165
+ if attributes.key?(:'catalog_group_oid')
166
+ self.catalog_group_oid = attributes[:'catalog_group_oid']
167
+ end
168
+
151
169
  if attributes.key?(:'description')
152
170
  self.description = attributes[:'description']
153
171
  end
@@ -182,6 +200,16 @@ module UltracartClient
182
200
  self.path = attributes[:'path']
183
201
  end
184
202
 
203
+ if attributes.key?(:'redirect')
204
+ self.redirect = attributes[:'redirect']
205
+ end
206
+
207
+ if attributes.key?(:'redirect_warnings')
208
+ if (value = attributes[:'redirect_warnings']).is_a?(Array)
209
+ self.redirect_warnings = value
210
+ end
211
+ end
212
+
185
213
  if attributes.key?(:'review_template')
186
214
  self.review_template = attributes[:'review_template']
187
215
  end
@@ -231,6 +259,7 @@ module UltracartClient
231
259
  self.class == o.class &&
232
260
  attributes == o.attributes &&
233
261
  blog_post_template == o.blog_post_template &&
262
+ catalog_group_oid == o.catalog_group_oid &&
234
263
  description == o.description &&
235
264
  exclude_from_sitemap == o.exclude_from_sitemap &&
236
265
  group_template == o.group_template &&
@@ -239,6 +268,8 @@ module UltracartClient
239
268
  multimedia == o.multimedia &&
240
269
  page_type == o.page_type &&
241
270
  path == o.path &&
271
+ redirect == o.redirect &&
272
+ redirect_warnings == o.redirect_warnings &&
242
273
  review_template == o.review_template &&
243
274
  sort_order == o.sort_order &&
244
275
  sort_order_child_groups == o.sort_order_child_groups &&
@@ -257,7 +288,7 @@ module UltracartClient
257
288
  # Calculates hash code according to all attributes.
258
289
  # @return [Integer] Hash code
259
290
  def hash
260
- [attributes, blog_post_template, description, exclude_from_sitemap, group_template, item_template, items_per_page, multimedia, page_type, path, review_template, sort_order, sort_order_child_groups, sort_order_child_items, title, visible, visible_dts].hash
291
+ [attributes, blog_post_template, catalog_group_oid, description, exclude_from_sitemap, group_template, item_template, items_per_page, multimedia, page_type, path, redirect, redirect_warnings, review_template, sort_order, sort_order_child_groups, sort_order_child_items, title, visible, visible_dts].hash
261
292
  end
262
293
 
263
294
  # Builds the object from hash
@@ -36,6 +36,15 @@ module UltracartClient
36
36
  # S for a static page, D for a dynamic one.
37
37
  attr_accessor :page_type
38
38
 
39
+ # The note on that redirect rule. Up to 500 characters. A note naming the page is used when left out.
40
+ attr_accessor :redirect_note
41
+
42
+ # 301 to redirect the page's address to redirect_target in the same call (#1102). Only with visible false, on a page that is visible now. The page is hidden and the rule added together, or neither.
43
+ attr_accessor :redirect_old_url
44
+
45
+ # Where the hidden page's address redirects to, for example /lp/summer-sale/. Required with redirect_old_url, and checked like any redirect rule.
46
+ attr_accessor :redirect_target
47
+
39
48
  # Template that renders the item review pages under this page.
40
49
  attr_accessor :review_template
41
50
 
@@ -57,6 +66,28 @@ module UltracartClient
57
66
  # Keep the page hidden until this time (ISO 8601). Null or empty clears it.
58
67
  attr_accessor :visible_dts
59
68
 
69
+ class EnumAttributeValidator
70
+ attr_reader :datatype
71
+ attr_reader :allowable_values
72
+
73
+ def initialize(datatype, allowable_values)
74
+ @allowable_values = allowable_values.map do |value|
75
+ case datatype.to_s
76
+ when /Integer/i
77
+ value.to_i
78
+ when /Float/i
79
+ value.to_f
80
+ else
81
+ value
82
+ end
83
+ end
84
+ end
85
+
86
+ def valid?(value)
87
+ !value || allowable_values.include?(value)
88
+ end
89
+ end
90
+
60
91
  # Attribute mapping from ruby-style variable name to JSON key.
61
92
  def self.attribute_map
62
93
  {
@@ -67,6 +98,9 @@ module UltracartClient
67
98
  :'item_template' => :'item_template',
68
99
  :'items_per_page' => :'items_per_page',
69
100
  :'page_type' => :'page_type',
101
+ :'redirect_note' => :'redirect_note',
102
+ :'redirect_old_url' => :'redirect_old_url',
103
+ :'redirect_target' => :'redirect_target',
70
104
  :'review_template' => :'review_template',
71
105
  :'sort_order' => :'sort_order',
72
106
  :'sort_order_child_groups' => :'sort_order_child_groups',
@@ -92,6 +126,9 @@ module UltracartClient
92
126
  :'item_template' => :'String',
93
127
  :'items_per_page' => :'Integer',
94
128
  :'page_type' => :'String',
129
+ :'redirect_note' => :'String',
130
+ :'redirect_old_url' => :'String',
131
+ :'redirect_target' => :'String',
95
132
  :'review_template' => :'String',
96
133
  :'sort_order' => :'Integer',
97
134
  :'sort_order_child_groups' => :'String',
@@ -151,6 +188,18 @@ module UltracartClient
151
188
  self.page_type = attributes[:'page_type']
152
189
  end
153
190
 
191
+ if attributes.key?(:'redirect_note')
192
+ self.redirect_note = attributes[:'redirect_note']
193
+ end
194
+
195
+ if attributes.key?(:'redirect_old_url')
196
+ self.redirect_old_url = attributes[:'redirect_old_url']
197
+ end
198
+
199
+ if attributes.key?(:'redirect_target')
200
+ self.redirect_target = attributes[:'redirect_target']
201
+ end
202
+
154
203
  if attributes.key?(:'review_template')
155
204
  self.review_template = attributes[:'review_template']
156
205
  end
@@ -190,9 +239,21 @@ module UltracartClient
190
239
  # Check to see if the all the properties in the model are valid
191
240
  # @return true if the model is valid
192
241
  def valid?
242
+ redirect_old_url_validator = EnumAttributeValidator.new('String', ["301"])
243
+ return false unless redirect_old_url_validator.valid?(@redirect_old_url)
193
244
  true
194
245
  end
195
246
 
247
+ # Custom attribute writer method checking allowed values (enum).
248
+ # @param [Object] redirect_old_url Object to be assigned
249
+ def redirect_old_url=(redirect_old_url)
250
+ validator = EnumAttributeValidator.new('String', ["301"])
251
+ unless validator.valid?(redirect_old_url)
252
+ fail ArgumentError, "invalid value for \"redirect_old_url\", must be one of #{validator.allowable_values}."
253
+ end
254
+ @redirect_old_url = redirect_old_url
255
+ end
256
+
196
257
  # Checks equality by comparing each attribute.
197
258
  # @param [Object] Object to be compared
198
259
  def ==(o)
@@ -205,6 +266,9 @@ module UltracartClient
205
266
  item_template == o.item_template &&
206
267
  items_per_page == o.items_per_page &&
207
268
  page_type == o.page_type &&
269
+ redirect_note == o.redirect_note &&
270
+ redirect_old_url == o.redirect_old_url &&
271
+ redirect_target == o.redirect_target &&
208
272
  review_template == o.review_template &&
209
273
  sort_order == o.sort_order &&
210
274
  sort_order_child_groups == o.sort_order_child_groups &&
@@ -223,7 +287,7 @@ module UltracartClient
223
287
  # Calculates hash code according to all attributes.
224
288
  # @return [Integer] Hash code
225
289
  def hash
226
- [blog_post_template, description, exclude_from_sitemap, group_template, item_template, items_per_page, page_type, review_template, sort_order, sort_order_child_groups, sort_order_child_items, title, visible, visible_dts].hash
290
+ [blog_post_template, description, exclude_from_sitemap, group_template, item_template, items_per_page, page_type, redirect_note, redirect_old_url, redirect_target, review_template, sort_order, sort_order_child_groups, sort_order_child_items, title, visible, visible_dts].hash
227
291
  end
228
292
 
229
293
  # Builds the object from hash
@@ -15,9 +15,14 @@ require 'time'
15
15
 
16
16
  module UltracartClient
17
17
  class SfvbPageSummary
18
+ # The page's id. It stays the same when the page is moved or renamed, where the path and the page folder's id do not, and it is what a menu entry's catalog_group_oid names.
19
+ attr_accessor :catalog_group_oid
20
+
18
21
  # Number of pages directly under this one.
19
22
  attr_accessor :child_count
20
23
 
24
+ attr_accessor :detail
25
+
21
26
  # True when the page is left out of the sitemap and marked noindex.
22
27
  attr_accessor :exclude_from_sitemap
23
28
 
@@ -60,7 +65,9 @@ module UltracartClient
60
65
  # Attribute mapping from ruby-style variable name to JSON key.
61
66
  def self.attribute_map
62
67
  {
68
+ :'catalog_group_oid' => :'catalog_group_oid',
63
69
  :'child_count' => :'child_count',
70
+ :'detail' => :'detail',
64
71
  :'exclude_from_sitemap' => :'exclude_from_sitemap',
65
72
  :'group_template' => :'group_template',
66
73
  :'item_count' => :'item_count',
@@ -85,7 +92,9 @@ module UltracartClient
85
92
  # Attribute type mapping.
86
93
  def self.openapi_types
87
94
  {
95
+ :'catalog_group_oid' => :'Integer',
88
96
  :'child_count' => :'Integer',
97
+ :'detail' => :'SfvbPageResponse',
89
98
  :'exclude_from_sitemap' => :'Boolean',
90
99
  :'group_template' => :'String',
91
100
  :'item_count' => :'Integer',
@@ -123,10 +132,18 @@ module UltracartClient
123
132
  h[k.to_sym] = v
124
133
  }
125
134
 
135
+ if attributes.key?(:'catalog_group_oid')
136
+ self.catalog_group_oid = attributes[:'catalog_group_oid']
137
+ end
138
+
126
139
  if attributes.key?(:'child_count')
127
140
  self.child_count = attributes[:'child_count']
128
141
  end
129
142
 
143
+ if attributes.key?(:'detail')
144
+ self.detail = attributes[:'detail']
145
+ end
146
+
130
147
  if attributes.key?(:'exclude_from_sitemap')
131
148
  self.exclude_from_sitemap = attributes[:'exclude_from_sitemap']
132
149
  end
@@ -198,7 +215,9 @@ module UltracartClient
198
215
  def ==(o)
199
216
  return true if self.equal?(o)
200
217
  self.class == o.class &&
218
+ catalog_group_oid == o.catalog_group_oid &&
201
219
  child_count == o.child_count &&
220
+ detail == o.detail &&
202
221
  exclude_from_sitemap == o.exclude_from_sitemap &&
203
222
  group_template == o.group_template &&
204
223
  item_count == o.item_count &&
@@ -223,7 +242,7 @@ module UltracartClient
223
242
  # Calculates hash code according to all attributes.
224
243
  # @return [Integer] Hash code
225
244
  def hash
226
- [child_count, exclude_from_sitemap, group_template, item_count, item_template, page_type, parent_path, path, root, sort_order, title, uses_selectors, visible, visible_dts].hash
245
+ [catalog_group_oid, child_count, detail, exclude_from_sitemap, group_template, item_count, item_template, page_type, parent_path, path, root, sort_order, title, uses_selectors, visible, visible_dts].hash
227
246
  end
228
247
 
229
248
  # Builds the object from hash
@@ -0,0 +1,260 @@
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 SfvbSearchFacet
18
+ # True when the attribute values are comma separated lists, each value its own choice.
19
+ attr_accessor :csv
20
+
21
+ # The heading shoppers see for the facet.
22
+ attr_accessor :display_name
23
+
24
+ # True when the facet is offered to shoppers.
25
+ attr_accessor :enabled
26
+
27
+ # What the facet is, such as Cost or Attribute color. Fixed.
28
+ attr_accessor :label
29
+
30
+ # The facet key, such as facet_cost or facet_attrcolor. Fixed; this is how a change names the facet.
31
+ attr_accessor :name
32
+
33
+ # Attribute mapping from ruby-style variable name to JSON key.
34
+ def self.attribute_map
35
+ {
36
+ :'csv' => :'csv',
37
+ :'display_name' => :'display_name',
38
+ :'enabled' => :'enabled',
39
+ :'label' => :'label',
40
+ :'name' => :'name'
41
+ }
42
+ end
43
+
44
+ # Returns all the JSON keys this model knows about
45
+ def self.acceptable_attributes
46
+ attribute_map.values
47
+ end
48
+
49
+ # Attribute type mapping.
50
+ def self.openapi_types
51
+ {
52
+ :'csv' => :'Boolean',
53
+ :'display_name' => :'String',
54
+ :'enabled' => :'Boolean',
55
+ :'label' => :'String',
56
+ :'name' => :'String'
57
+ }
58
+ end
59
+
60
+ # List of attributes with nullable: true
61
+ def self.openapi_nullable
62
+ Set.new([
63
+ ])
64
+ end
65
+
66
+ # Initializes the object
67
+ # @param [Hash] attributes Model attributes in the form of hash
68
+ def initialize(attributes = {})
69
+ if (!attributes.is_a?(Hash))
70
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbSearchFacet` initialize method"
71
+ end
72
+
73
+ # check to see if the attribute exists and convert string to symbol for hash key
74
+ attributes = attributes.each_with_object({}) { |(k, v), h|
75
+ if (!self.class.attribute_map.key?(k.to_sym))
76
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbSearchFacet`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
77
+ end
78
+ h[k.to_sym] = v
79
+ }
80
+
81
+ if attributes.key?(:'csv')
82
+ self.csv = attributes[:'csv']
83
+ end
84
+
85
+ if attributes.key?(:'display_name')
86
+ self.display_name = attributes[:'display_name']
87
+ end
88
+
89
+ if attributes.key?(:'enabled')
90
+ self.enabled = attributes[:'enabled']
91
+ end
92
+
93
+ if attributes.key?(:'label')
94
+ self.label = attributes[:'label']
95
+ end
96
+
97
+ if attributes.key?(:'name')
98
+ self.name = attributes[:'name']
99
+ end
100
+ end
101
+
102
+ # Show invalid properties with the reasons. Usually used together with valid?
103
+ # @return Array for valid properties with the reasons
104
+ def list_invalid_properties
105
+ invalid_properties = Array.new
106
+ invalid_properties
107
+ end
108
+
109
+ # Check to see if the all the properties in the model are valid
110
+ # @return true if the model is valid
111
+ def valid?
112
+ true
113
+ end
114
+
115
+ # Checks equality by comparing each attribute.
116
+ # @param [Object] Object to be compared
117
+ def ==(o)
118
+ return true if self.equal?(o)
119
+ self.class == o.class &&
120
+ csv == o.csv &&
121
+ display_name == o.display_name &&
122
+ enabled == o.enabled &&
123
+ label == o.label &&
124
+ name == o.name
125
+ end
126
+
127
+ # @see the `==` method
128
+ # @param [Object] Object to be compared
129
+ def eql?(o)
130
+ self == o
131
+ end
132
+
133
+ # Calculates hash code according to all attributes.
134
+ # @return [Integer] Hash code
135
+ def hash
136
+ [csv, display_name, enabled, label, name].hash
137
+ end
138
+
139
+ # Builds the object from hash
140
+ # @param [Hash] attributes Model attributes in the form of hash
141
+ # @return [Object] Returns the model itself
142
+ def self.build_from_hash(attributes)
143
+ new.build_from_hash(attributes)
144
+ end
145
+
146
+ # Builds the object from hash
147
+ # @param [Hash] attributes Model attributes in the form of hash
148
+ # @return [Object] Returns the model itself
149
+ def build_from_hash(attributes)
150
+ return nil unless attributes.is_a?(Hash)
151
+ attributes = attributes.transform_keys(&:to_sym)
152
+ self.class.openapi_types.each_pair do |key, type|
153
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
154
+ self.send("#{key}=", nil)
155
+ elsif type =~ /\AArray<(.*)>/i
156
+ # check to ensure the input is an array given that the attribute
157
+ # is documented as an array but the input is not
158
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
159
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
160
+ end
161
+ elsif !attributes[self.class.attribute_map[key]].nil?
162
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
163
+ end
164
+ end
165
+
166
+ self
167
+ end
168
+
169
+ # Deserializes the data based on type
170
+ # @param string type Data type
171
+ # @param string value Value to be deserialized
172
+ # @return [Object] Deserialized data
173
+ def _deserialize(type, value)
174
+ case type.to_sym
175
+ when :Time
176
+ Time.parse(value)
177
+ when :Date
178
+ Date.parse(value)
179
+ when :String
180
+ value.to_s
181
+ when :Integer
182
+ value.to_i
183
+ when :Float
184
+ value.to_f
185
+ when :Boolean
186
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
187
+ true
188
+ else
189
+ false
190
+ end
191
+ when :Object
192
+ # generic object (usually a Hash), return directly
193
+ value
194
+ when /\AArray<(?<inner_type>.+)>\z/
195
+ inner_type = Regexp.last_match[:inner_type]
196
+ value.map { |v| _deserialize(inner_type, v) }
197
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
198
+ k_type = Regexp.last_match[:k_type]
199
+ v_type = Regexp.last_match[:v_type]
200
+ {}.tap do |hash|
201
+ value.each do |k, v|
202
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
203
+ end
204
+ end
205
+ else # model
206
+ # models (e.g. Pet) or oneOf
207
+ klass = UltracartClient.const_get(type)
208
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
209
+ end
210
+ end
211
+
212
+ # Returns the string representation of the object
213
+ # @return [String] String presentation of the object
214
+ def to_s
215
+ to_hash.to_s
216
+ end
217
+
218
+ # to_body is an alias to to_hash (backward compatibility)
219
+ # @return [Hash] Returns the object in the form of hash
220
+ def to_body
221
+ to_hash
222
+ end
223
+
224
+ # Returns the object in the form of hash
225
+ # @return [Hash] Returns the object in the form of hash
226
+ def to_hash
227
+ hash = {}
228
+ self.class.attribute_map.each_pair do |attr, param|
229
+ value = self.send(attr)
230
+ if value.nil?
231
+ is_nullable = self.class.openapi_nullable.include?(attr)
232
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
233
+ end
234
+
235
+ hash[param] = _to_hash(value)
236
+ end
237
+ hash
238
+ end
239
+
240
+ # Outputs non-array value in the form of hash
241
+ # For object, use to_hash. Otherwise, just return the value
242
+ # @param [Object] value Any valid value
243
+ # @return [Hash] Returns the value in the form of hash
244
+ def _to_hash(value)
245
+ if value.is_a?(Array)
246
+ value.compact.map { |v| _to_hash(v) }
247
+ elsif value.is_a?(Hash)
248
+ {}.tap do |hash|
249
+ value.each { |k, v| hash[k] = _to_hash(v) }
250
+ end
251
+ elsif value.respond_to? :to_hash
252
+ value.to_hash
253
+ else
254
+ value
255
+ end
256
+ end
257
+
258
+ end
259
+
260
+ end