ultracart_api 4.1.252 → 4.1.253

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.
@@ -0,0 +1,294 @@
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 SfvbPageMoveRequest
18
+ # True to run every check and report what would move, without moving anything or needing an approval.
19
+ attr_accessor :dry_run
20
+
21
+ # Where the page goes, for example /lp/summer-sale/ or /sale/spring/. Its parent page must exist, and nothing may be at this path yet.
22
+ attr_accessor :new_path
23
+
24
+ # The page to move, for example /lp/spring-sale/.
25
+ attr_accessor :path
26
+
27
+ # The note on that redirect rule. Up to 500 characters. A note naming the move is used when left out.
28
+ attr_accessor :redirect_note
29
+
30
+ # 301 to add one pattern redirect from the old path, sub-pages and items included, to the new one in the same call. Leave it out to add none, and the old addresses answer 404.
31
+ attr_accessor :redirect_old_url
32
+
33
+ class EnumAttributeValidator
34
+ attr_reader :datatype
35
+ attr_reader :allowable_values
36
+
37
+ def initialize(datatype, allowable_values)
38
+ @allowable_values = allowable_values.map do |value|
39
+ case datatype.to_s
40
+ when /Integer/i
41
+ value.to_i
42
+ when /Float/i
43
+ value.to_f
44
+ else
45
+ value
46
+ end
47
+ end
48
+ end
49
+
50
+ def valid?(value)
51
+ !value || allowable_values.include?(value)
52
+ end
53
+ end
54
+
55
+ # Attribute mapping from ruby-style variable name to JSON key.
56
+ def self.attribute_map
57
+ {
58
+ :'dry_run' => :'dry_run',
59
+ :'new_path' => :'new_path',
60
+ :'path' => :'path',
61
+ :'redirect_note' => :'redirect_note',
62
+ :'redirect_old_url' => :'redirect_old_url'
63
+ }
64
+ end
65
+
66
+ # Returns all the JSON keys this model knows about
67
+ def self.acceptable_attributes
68
+ attribute_map.values
69
+ end
70
+
71
+ # Attribute type mapping.
72
+ def self.openapi_types
73
+ {
74
+ :'dry_run' => :'Boolean',
75
+ :'new_path' => :'String',
76
+ :'path' => :'String',
77
+ :'redirect_note' => :'String',
78
+ :'redirect_old_url' => :'String'
79
+ }
80
+ end
81
+
82
+ # List of attributes with nullable: true
83
+ def self.openapi_nullable
84
+ Set.new([
85
+ ])
86
+ end
87
+
88
+ # Initializes the object
89
+ # @param [Hash] attributes Model attributes in the form of hash
90
+ def initialize(attributes = {})
91
+ if (!attributes.is_a?(Hash))
92
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbPageMoveRequest` initialize method"
93
+ end
94
+
95
+ # check to see if the attribute exists and convert string to symbol for hash key
96
+ attributes = attributes.each_with_object({}) { |(k, v), h|
97
+ if (!self.class.attribute_map.key?(k.to_sym))
98
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbPageMoveRequest`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
99
+ end
100
+ h[k.to_sym] = v
101
+ }
102
+
103
+ if attributes.key?(:'dry_run')
104
+ self.dry_run = attributes[:'dry_run']
105
+ end
106
+
107
+ if attributes.key?(:'new_path')
108
+ self.new_path = attributes[:'new_path']
109
+ end
110
+
111
+ if attributes.key?(:'path')
112
+ self.path = attributes[:'path']
113
+ end
114
+
115
+ if attributes.key?(:'redirect_note')
116
+ self.redirect_note = attributes[:'redirect_note']
117
+ end
118
+
119
+ if attributes.key?(:'redirect_old_url')
120
+ self.redirect_old_url = attributes[:'redirect_old_url']
121
+ end
122
+ end
123
+
124
+ # Show invalid properties with the reasons. Usually used together with valid?
125
+ # @return Array for valid properties with the reasons
126
+ def list_invalid_properties
127
+ invalid_properties = Array.new
128
+ invalid_properties
129
+ end
130
+
131
+ # Check to see if the all the properties in the model are valid
132
+ # @return true if the model is valid
133
+ def valid?
134
+ redirect_old_url_validator = EnumAttributeValidator.new('String', ["301"])
135
+ return false unless redirect_old_url_validator.valid?(@redirect_old_url)
136
+ true
137
+ end
138
+
139
+ # Custom attribute writer method checking allowed values (enum).
140
+ # @param [Object] redirect_old_url Object to be assigned
141
+ def redirect_old_url=(redirect_old_url)
142
+ validator = EnumAttributeValidator.new('String', ["301"])
143
+ unless validator.valid?(redirect_old_url)
144
+ fail ArgumentError, "invalid value for \"redirect_old_url\", must be one of #{validator.allowable_values}."
145
+ end
146
+ @redirect_old_url = redirect_old_url
147
+ end
148
+
149
+ # Checks equality by comparing each attribute.
150
+ # @param [Object] Object to be compared
151
+ def ==(o)
152
+ return true if self.equal?(o)
153
+ self.class == o.class &&
154
+ dry_run == o.dry_run &&
155
+ new_path == o.new_path &&
156
+ path == o.path &&
157
+ redirect_note == o.redirect_note &&
158
+ redirect_old_url == o.redirect_old_url
159
+ end
160
+
161
+ # @see the `==` method
162
+ # @param [Object] Object to be compared
163
+ def eql?(o)
164
+ self == o
165
+ end
166
+
167
+ # Calculates hash code according to all attributes.
168
+ # @return [Integer] Hash code
169
+ def hash
170
+ [dry_run, new_path, path, redirect_note, redirect_old_url].hash
171
+ end
172
+
173
+ # Builds the object from hash
174
+ # @param [Hash] attributes Model attributes in the form of hash
175
+ # @return [Object] Returns the model itself
176
+ def self.build_from_hash(attributes)
177
+ new.build_from_hash(attributes)
178
+ end
179
+
180
+ # Builds the object from hash
181
+ # @param [Hash] attributes Model attributes in the form of hash
182
+ # @return [Object] Returns the model itself
183
+ def build_from_hash(attributes)
184
+ return nil unless attributes.is_a?(Hash)
185
+ attributes = attributes.transform_keys(&:to_sym)
186
+ self.class.openapi_types.each_pair do |key, type|
187
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
188
+ self.send("#{key}=", nil)
189
+ elsif type =~ /\AArray<(.*)>/i
190
+ # check to ensure the input is an array given that the attribute
191
+ # is documented as an array but the input is not
192
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
193
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
194
+ end
195
+ elsif !attributes[self.class.attribute_map[key]].nil?
196
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
197
+ end
198
+ end
199
+
200
+ self
201
+ end
202
+
203
+ # Deserializes the data based on type
204
+ # @param string type Data type
205
+ # @param string value Value to be deserialized
206
+ # @return [Object] Deserialized data
207
+ def _deserialize(type, value)
208
+ case type.to_sym
209
+ when :Time
210
+ Time.parse(value)
211
+ when :Date
212
+ Date.parse(value)
213
+ when :String
214
+ value.to_s
215
+ when :Integer
216
+ value.to_i
217
+ when :Float
218
+ value.to_f
219
+ when :Boolean
220
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
221
+ true
222
+ else
223
+ false
224
+ end
225
+ when :Object
226
+ # generic object (usually a Hash), return directly
227
+ value
228
+ when /\AArray<(?<inner_type>.+)>\z/
229
+ inner_type = Regexp.last_match[:inner_type]
230
+ value.map { |v| _deserialize(inner_type, v) }
231
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
232
+ k_type = Regexp.last_match[:k_type]
233
+ v_type = Regexp.last_match[:v_type]
234
+ {}.tap do |hash|
235
+ value.each do |k, v|
236
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
237
+ end
238
+ end
239
+ else # model
240
+ # models (e.g. Pet) or oneOf
241
+ klass = UltracartClient.const_get(type)
242
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
243
+ end
244
+ end
245
+
246
+ # Returns the string representation of the object
247
+ # @return [String] String presentation of the object
248
+ def to_s
249
+ to_hash.to_s
250
+ end
251
+
252
+ # to_body is an alias to to_hash (backward compatibility)
253
+ # @return [Hash] Returns the object in the form of hash
254
+ def to_body
255
+ to_hash
256
+ end
257
+
258
+ # Returns the object in the form of hash
259
+ # @return [Hash] Returns the object in the form of hash
260
+ def to_hash
261
+ hash = {}
262
+ self.class.attribute_map.each_pair do |attr, param|
263
+ value = self.send(attr)
264
+ if value.nil?
265
+ is_nullable = self.class.openapi_nullable.include?(attr)
266
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
267
+ end
268
+
269
+ hash[param] = _to_hash(value)
270
+ end
271
+ hash
272
+ end
273
+
274
+ # Outputs non-array value in the form of hash
275
+ # For object, use to_hash. Otherwise, just return the value
276
+ # @param [Object] value Any valid value
277
+ # @return [Hash] Returns the value in the form of hash
278
+ def _to_hash(value)
279
+ if value.is_a?(Array)
280
+ value.compact.map { |v| _to_hash(v) }
281
+ elsif value.is_a?(Hash)
282
+ {}.tap do |hash|
283
+ value.each { |k, v| hash[k] = _to_hash(v) }
284
+ end
285
+ elsif value.respond_to? :to_hash
286
+ value.to_hash
287
+ else
288
+ value
289
+ end
290
+ end
291
+
292
+ end
293
+
294
+ end
@@ -0,0 +1,290 @@
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 SfvbPageMoveResponse
18
+ # True when nothing was moved.
19
+ attr_accessor :dry_run
20
+
21
+ # The page's path after the move.
22
+ attr_accessor :new_path
23
+
24
+ attr_accessor :page
25
+
26
+ # How many pages moved, the page itself included.
27
+ attr_accessor :pages_moved
28
+
29
+ # The page's path before the move.
30
+ attr_accessor :path
31
+
32
+ attr_accessor :redirect
33
+
34
+ # The pattern the old addresses redirect from, when a redirect was asked for.
35
+ attr_accessor :redirect_source
36
+
37
+ # Findings that did not block the move, such as a redirect chain.
38
+ attr_accessor :warnings
39
+
40
+ # Attribute mapping from ruby-style variable name to JSON key.
41
+ def self.attribute_map
42
+ {
43
+ :'dry_run' => :'dry_run',
44
+ :'new_path' => :'new_path',
45
+ :'page' => :'page',
46
+ :'pages_moved' => :'pages_moved',
47
+ :'path' => :'path',
48
+ :'redirect' => :'redirect',
49
+ :'redirect_source' => :'redirect_source',
50
+ :'warnings' => :'warnings'
51
+ }
52
+ end
53
+
54
+ # Returns all the JSON keys this model knows about
55
+ def self.acceptable_attributes
56
+ attribute_map.values
57
+ end
58
+
59
+ # Attribute type mapping.
60
+ def self.openapi_types
61
+ {
62
+ :'dry_run' => :'Boolean',
63
+ :'new_path' => :'String',
64
+ :'page' => :'SfvbPageResponse',
65
+ :'pages_moved' => :'Integer',
66
+ :'path' => :'String',
67
+ :'redirect' => :'SfvbRedirect',
68
+ :'redirect_source' => :'String',
69
+ :'warnings' => :'Array<SfvbErrorDetail>'
70
+ }
71
+ end
72
+
73
+ # List of attributes with nullable: true
74
+ def self.openapi_nullable
75
+ Set.new([
76
+ ])
77
+ end
78
+
79
+ # Initializes the object
80
+ # @param [Hash] attributes Model attributes in the form of hash
81
+ def initialize(attributes = {})
82
+ if (!attributes.is_a?(Hash))
83
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::SfvbPageMoveResponse` initialize method"
84
+ end
85
+
86
+ # check to see if the attribute exists and convert string to symbol for hash key
87
+ attributes = attributes.each_with_object({}) { |(k, v), h|
88
+ if (!self.class.attribute_map.key?(k.to_sym))
89
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::SfvbPageMoveResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
90
+ end
91
+ h[k.to_sym] = v
92
+ }
93
+
94
+ if attributes.key?(:'dry_run')
95
+ self.dry_run = attributes[:'dry_run']
96
+ end
97
+
98
+ if attributes.key?(:'new_path')
99
+ self.new_path = attributes[:'new_path']
100
+ end
101
+
102
+ if attributes.key?(:'page')
103
+ self.page = attributes[:'page']
104
+ end
105
+
106
+ if attributes.key?(:'pages_moved')
107
+ self.pages_moved = attributes[:'pages_moved']
108
+ end
109
+
110
+ if attributes.key?(:'path')
111
+ self.path = attributes[:'path']
112
+ end
113
+
114
+ if attributes.key?(:'redirect')
115
+ self.redirect = attributes[:'redirect']
116
+ end
117
+
118
+ if attributes.key?(:'redirect_source')
119
+ self.redirect_source = attributes[:'redirect_source']
120
+ end
121
+
122
+ if attributes.key?(:'warnings')
123
+ if (value = attributes[:'warnings']).is_a?(Array)
124
+ self.warnings = value
125
+ end
126
+ end
127
+ end
128
+
129
+ # Show invalid properties with the reasons. Usually used together with valid?
130
+ # @return Array for valid properties with the reasons
131
+ def list_invalid_properties
132
+ invalid_properties = Array.new
133
+ invalid_properties
134
+ end
135
+
136
+ # Check to see if the all the properties in the model are valid
137
+ # @return true if the model is valid
138
+ def valid?
139
+ true
140
+ end
141
+
142
+ # Checks equality by comparing each attribute.
143
+ # @param [Object] Object to be compared
144
+ def ==(o)
145
+ return true if self.equal?(o)
146
+ self.class == o.class &&
147
+ dry_run == o.dry_run &&
148
+ new_path == o.new_path &&
149
+ page == o.page &&
150
+ pages_moved == o.pages_moved &&
151
+ path == o.path &&
152
+ redirect == o.redirect &&
153
+ redirect_source == o.redirect_source &&
154
+ warnings == o.warnings
155
+ end
156
+
157
+ # @see the `==` method
158
+ # @param [Object] Object to be compared
159
+ def eql?(o)
160
+ self == o
161
+ end
162
+
163
+ # Calculates hash code according to all attributes.
164
+ # @return [Integer] Hash code
165
+ def hash
166
+ [dry_run, new_path, page, pages_moved, path, redirect, redirect_source, warnings].hash
167
+ end
168
+
169
+ # Builds the object from hash
170
+ # @param [Hash] attributes Model attributes in the form of hash
171
+ # @return [Object] Returns the model itself
172
+ def self.build_from_hash(attributes)
173
+ new.build_from_hash(attributes)
174
+ end
175
+
176
+ # Builds the object from hash
177
+ # @param [Hash] attributes Model attributes in the form of hash
178
+ # @return [Object] Returns the model itself
179
+ def build_from_hash(attributes)
180
+ return nil unless attributes.is_a?(Hash)
181
+ attributes = attributes.transform_keys(&:to_sym)
182
+ self.class.openapi_types.each_pair do |key, type|
183
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
184
+ self.send("#{key}=", nil)
185
+ elsif type =~ /\AArray<(.*)>/i
186
+ # check to ensure the input is an array given that the attribute
187
+ # is documented as an array but the input is not
188
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
189
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
190
+ end
191
+ elsif !attributes[self.class.attribute_map[key]].nil?
192
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
193
+ end
194
+ end
195
+
196
+ self
197
+ end
198
+
199
+ # Deserializes the data based on type
200
+ # @param string type Data type
201
+ # @param string value Value to be deserialized
202
+ # @return [Object] Deserialized data
203
+ def _deserialize(type, value)
204
+ case type.to_sym
205
+ when :Time
206
+ Time.parse(value)
207
+ when :Date
208
+ Date.parse(value)
209
+ when :String
210
+ value.to_s
211
+ when :Integer
212
+ value.to_i
213
+ when :Float
214
+ value.to_f
215
+ when :Boolean
216
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
217
+ true
218
+ else
219
+ false
220
+ end
221
+ when :Object
222
+ # generic object (usually a Hash), return directly
223
+ value
224
+ when /\AArray<(?<inner_type>.+)>\z/
225
+ inner_type = Regexp.last_match[:inner_type]
226
+ value.map { |v| _deserialize(inner_type, v) }
227
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
228
+ k_type = Regexp.last_match[:k_type]
229
+ v_type = Regexp.last_match[:v_type]
230
+ {}.tap do |hash|
231
+ value.each do |k, v|
232
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
233
+ end
234
+ end
235
+ else # model
236
+ # models (e.g. Pet) or oneOf
237
+ klass = UltracartClient.const_get(type)
238
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
239
+ end
240
+ end
241
+
242
+ # Returns the string representation of the object
243
+ # @return [String] String presentation of the object
244
+ def to_s
245
+ to_hash.to_s
246
+ end
247
+
248
+ # to_body is an alias to to_hash (backward compatibility)
249
+ # @return [Hash] Returns the object in the form of hash
250
+ def to_body
251
+ to_hash
252
+ end
253
+
254
+ # Returns the object in the form of hash
255
+ # @return [Hash] Returns the object in the form of hash
256
+ def to_hash
257
+ hash = {}
258
+ self.class.attribute_map.each_pair do |attr, param|
259
+ value = self.send(attr)
260
+ if value.nil?
261
+ is_nullable = self.class.openapi_nullable.include?(attr)
262
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
263
+ end
264
+
265
+ hash[param] = _to_hash(value)
266
+ end
267
+ hash
268
+ end
269
+
270
+ # Outputs non-array value in the form of hash
271
+ # For object, use to_hash. Otherwise, just return the value
272
+ # @param [Object] value Any valid value
273
+ # @return [Hash] Returns the value in the form of hash
274
+ def _to_hash(value)
275
+ if value.is_a?(Array)
276
+ value.compact.map { |v| _to_hash(v) }
277
+ elsif value.is_a?(Hash)
278
+ {}.tap do |hash|
279
+ value.each { |k, v| hash[k] = _to_hash(v) }
280
+ end
281
+ elsif value.respond_to? :to_hash
282
+ value.to_hash
283
+ else
284
+ value
285
+ end
286
+ end
287
+
288
+ end
289
+
290
+ end
@@ -45,6 +45,11 @@ module UltracartClient
45
45
  # The page path, normalized to begin and end with a slash.
46
46
  attr_accessor :path
47
47
 
48
+ attr_accessor :redirect
49
+
50
+ # Findings on that redirect that did not block it, such as a chain. Left out when there are none.
51
+ attr_accessor :redirect_warnings
52
+
48
53
  # Template that renders the item review pages under this page. Omitted when not set.
49
54
  attr_accessor :review_template
50
55
 
@@ -79,6 +84,8 @@ module UltracartClient
79
84
  :'multimedia' => :'multimedia',
80
85
  :'page_type' => :'page_type',
81
86
  :'path' => :'path',
87
+ :'redirect' => :'redirect',
88
+ :'redirect_warnings' => :'redirect_warnings',
82
89
  :'review_template' => :'review_template',
83
90
  :'sort_order' => :'sort_order',
84
91
  :'sort_order_child_groups' => :'sort_order_child_groups',
@@ -107,6 +114,8 @@ module UltracartClient
107
114
  :'multimedia' => :'Array<SfvbPageMultimedia>',
108
115
  :'page_type' => :'String',
109
116
  :'path' => :'String',
117
+ :'redirect' => :'SfvbRedirect',
118
+ :'redirect_warnings' => :'Array<SfvbErrorDetail>',
110
119
  :'review_template' => :'String',
111
120
  :'sort_order' => :'Integer',
112
121
  :'sort_order_child_groups' => :'String',
@@ -182,6 +191,16 @@ module UltracartClient
182
191
  self.path = attributes[:'path']
183
192
  end
184
193
 
194
+ if attributes.key?(:'redirect')
195
+ self.redirect = attributes[:'redirect']
196
+ end
197
+
198
+ if attributes.key?(:'redirect_warnings')
199
+ if (value = attributes[:'redirect_warnings']).is_a?(Array)
200
+ self.redirect_warnings = value
201
+ end
202
+ end
203
+
185
204
  if attributes.key?(:'review_template')
186
205
  self.review_template = attributes[:'review_template']
187
206
  end
@@ -239,6 +258,8 @@ module UltracartClient
239
258
  multimedia == o.multimedia &&
240
259
  page_type == o.page_type &&
241
260
  path == o.path &&
261
+ redirect == o.redirect &&
262
+ redirect_warnings == o.redirect_warnings &&
242
263
  review_template == o.review_template &&
243
264
  sort_order == o.sort_order &&
244
265
  sort_order_child_groups == o.sort_order_child_groups &&
@@ -257,7 +278,7 @@ module UltracartClient
257
278
  # Calculates hash code according to all attributes.
258
279
  # @return [Integer] Hash code
259
280
  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
281
+ [attributes, blog_post_template, 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
282
  end
262
283
 
263
284
  # Builds the object from hash