ultracart_api 4.0.64.rc → 4.0.65.rc

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,350 @@
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 ItemDigitalItemPdfMeta
18
+ # Assembly allowed
19
+ attr_accessor :assembly_allowed
20
+
21
+ # Copy/Paste is allowed
22
+ attr_accessor :copy_allowed
23
+
24
+ # A custom footer for each pdf page
25
+ attr_accessor :custom_footer
26
+
27
+ # A custom header for each pdf page
28
+ attr_accessor :custom_header
29
+
30
+ # Degraded printing allowed
31
+ attr_accessor :degraded_printing_allowed
32
+
33
+ # Fillin is allowed
34
+ attr_accessor :fillin_allowed
35
+
36
+ # Modifying annotations is allowed
37
+ attr_accessor :modify_annotations_allowed
38
+
39
+ # Modifying contents is allowed
40
+ attr_accessor :modify_contents_allowed
41
+
42
+ # Printing is allowed
43
+ attr_accessor :printing_allowed
44
+
45
+ # Screen readers are allowed
46
+ attr_accessor :screen_readers_allowed
47
+
48
+ # PDF is tagged
49
+ attr_accessor :tagged
50
+
51
+ # Attribute mapping from ruby-style variable name to JSON key.
52
+ def self.attribute_map
53
+ {
54
+ :'assembly_allowed' => :'assembly_allowed',
55
+ :'copy_allowed' => :'copy_allowed',
56
+ :'custom_footer' => :'custom_footer',
57
+ :'custom_header' => :'custom_header',
58
+ :'degraded_printing_allowed' => :'degraded_printing_allowed',
59
+ :'fillin_allowed' => :'fillin_allowed',
60
+ :'modify_annotations_allowed' => :'modify_annotations_allowed',
61
+ :'modify_contents_allowed' => :'modify_contents_allowed',
62
+ :'printing_allowed' => :'printing_allowed',
63
+ :'screen_readers_allowed' => :'screen_readers_allowed',
64
+ :'tagged' => :'tagged'
65
+ }
66
+ end
67
+
68
+ # Returns all the JSON keys this model knows about
69
+ def self.acceptable_attributes
70
+ attribute_map.values
71
+ end
72
+
73
+ # Attribute type mapping.
74
+ def self.openapi_types
75
+ {
76
+ :'assembly_allowed' => :'Boolean',
77
+ :'copy_allowed' => :'Boolean',
78
+ :'custom_footer' => :'String',
79
+ :'custom_header' => :'String',
80
+ :'degraded_printing_allowed' => :'Boolean',
81
+ :'fillin_allowed' => :'Boolean',
82
+ :'modify_annotations_allowed' => :'Boolean',
83
+ :'modify_contents_allowed' => :'Boolean',
84
+ :'printing_allowed' => :'Boolean',
85
+ :'screen_readers_allowed' => :'Boolean',
86
+ :'tagged' => :'Boolean'
87
+ }
88
+ end
89
+
90
+ # List of attributes with nullable: true
91
+ def self.openapi_nullable
92
+ Set.new([
93
+ ])
94
+ end
95
+
96
+ # Initializes the object
97
+ # @param [Hash] attributes Model attributes in the form of hash
98
+ def initialize(attributes = {})
99
+ if (!attributes.is_a?(Hash))
100
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::ItemDigitalItemPdfMeta` initialize method"
101
+ end
102
+
103
+ # check to see if the attribute exists and convert string to symbol for hash key
104
+ attributes = attributes.each_with_object({}) { |(k, v), h|
105
+ if (!self.class.attribute_map.key?(k.to_sym))
106
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::ItemDigitalItemPdfMeta`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
107
+ end
108
+ h[k.to_sym] = v
109
+ }
110
+
111
+ if attributes.key?(:'assembly_allowed')
112
+ self.assembly_allowed = attributes[:'assembly_allowed']
113
+ end
114
+
115
+ if attributes.key?(:'copy_allowed')
116
+ self.copy_allowed = attributes[:'copy_allowed']
117
+ end
118
+
119
+ if attributes.key?(:'custom_footer')
120
+ self.custom_footer = attributes[:'custom_footer']
121
+ end
122
+
123
+ if attributes.key?(:'custom_header')
124
+ self.custom_header = attributes[:'custom_header']
125
+ end
126
+
127
+ if attributes.key?(:'degraded_printing_allowed')
128
+ self.degraded_printing_allowed = attributes[:'degraded_printing_allowed']
129
+ end
130
+
131
+ if attributes.key?(:'fillin_allowed')
132
+ self.fillin_allowed = attributes[:'fillin_allowed']
133
+ end
134
+
135
+ if attributes.key?(:'modify_annotations_allowed')
136
+ self.modify_annotations_allowed = attributes[:'modify_annotations_allowed']
137
+ end
138
+
139
+ if attributes.key?(:'modify_contents_allowed')
140
+ self.modify_contents_allowed = attributes[:'modify_contents_allowed']
141
+ end
142
+
143
+ if attributes.key?(:'printing_allowed')
144
+ self.printing_allowed = attributes[:'printing_allowed']
145
+ end
146
+
147
+ if attributes.key?(:'screen_readers_allowed')
148
+ self.screen_readers_allowed = attributes[:'screen_readers_allowed']
149
+ end
150
+
151
+ if attributes.key?(:'tagged')
152
+ self.tagged = attributes[:'tagged']
153
+ end
154
+ end
155
+
156
+ # Show invalid properties with the reasons. Usually used together with valid?
157
+ # @return Array for valid properties with the reasons
158
+ def list_invalid_properties
159
+ invalid_properties = Array.new
160
+ if !@custom_footer.nil? && @custom_footer.to_s.length > 8000
161
+ invalid_properties.push('invalid value for "custom_footer", the character length must be smaller than or equal to 8000.')
162
+ end
163
+
164
+ if !@custom_header.nil? && @custom_header.to_s.length > 8000
165
+ invalid_properties.push('invalid value for "custom_header", the character length must be smaller than or equal to 8000.')
166
+ end
167
+
168
+ invalid_properties
169
+ end
170
+
171
+ # Check to see if the all the properties in the model are valid
172
+ # @return true if the model is valid
173
+ def valid?
174
+ return false if !@custom_footer.nil? && @custom_footer.to_s.length > 8000
175
+ return false if !@custom_header.nil? && @custom_header.to_s.length > 8000
176
+ true
177
+ end
178
+
179
+ # Custom attribute writer method with validation
180
+ # @param [Object] custom_footer Value to be assigned
181
+ def custom_footer=(custom_footer)
182
+ if !custom_footer.nil? && custom_footer.to_s.length > 8000
183
+ fail ArgumentError, 'invalid value for "custom_footer", the character length must be smaller than or equal to 8000.'
184
+ end
185
+
186
+ @custom_footer = custom_footer
187
+ end
188
+
189
+ # Custom attribute writer method with validation
190
+ # @param [Object] custom_header Value to be assigned
191
+ def custom_header=(custom_header)
192
+ if !custom_header.nil? && custom_header.to_s.length > 8000
193
+ fail ArgumentError, 'invalid value for "custom_header", the character length must be smaller than or equal to 8000.'
194
+ end
195
+
196
+ @custom_header = custom_header
197
+ end
198
+
199
+ # Checks equality by comparing each attribute.
200
+ # @param [Object] Object to be compared
201
+ def ==(o)
202
+ return true if self.equal?(o)
203
+ self.class == o.class &&
204
+ assembly_allowed == o.assembly_allowed &&
205
+ copy_allowed == o.copy_allowed &&
206
+ custom_footer == o.custom_footer &&
207
+ custom_header == o.custom_header &&
208
+ degraded_printing_allowed == o.degraded_printing_allowed &&
209
+ fillin_allowed == o.fillin_allowed &&
210
+ modify_annotations_allowed == o.modify_annotations_allowed &&
211
+ modify_contents_allowed == o.modify_contents_allowed &&
212
+ printing_allowed == o.printing_allowed &&
213
+ screen_readers_allowed == o.screen_readers_allowed &&
214
+ tagged == o.tagged
215
+ end
216
+
217
+ # @see the `==` method
218
+ # @param [Object] Object to be compared
219
+ def eql?(o)
220
+ self == o
221
+ end
222
+
223
+ # Calculates hash code according to all attributes.
224
+ # @return [Integer] Hash code
225
+ def hash
226
+ [assembly_allowed, copy_allowed, custom_footer, custom_header, degraded_printing_allowed, fillin_allowed, modify_annotations_allowed, modify_contents_allowed, printing_allowed, screen_readers_allowed, tagged].hash
227
+ end
228
+
229
+ # Builds the object from hash
230
+ # @param [Hash] attributes Model attributes in the form of hash
231
+ # @return [Object] Returns the model itself
232
+ def self.build_from_hash(attributes)
233
+ new.build_from_hash(attributes)
234
+ end
235
+
236
+ # Builds the object from hash
237
+ # @param [Hash] attributes Model attributes in the form of hash
238
+ # @return [Object] Returns the model itself
239
+ def build_from_hash(attributes)
240
+ return nil unless attributes.is_a?(Hash)
241
+ attributes = attributes.transform_keys(&:to_sym)
242
+ self.class.openapi_types.each_pair do |key, type|
243
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
244
+ self.send("#{key}=", nil)
245
+ elsif type =~ /\AArray<(.*)>/i
246
+ # check to ensure the input is an array given that the attribute
247
+ # is documented as an array but the input is not
248
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
249
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
250
+ end
251
+ elsif !attributes[self.class.attribute_map[key]].nil?
252
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
253
+ end
254
+ end
255
+
256
+ self
257
+ end
258
+
259
+ # Deserializes the data based on type
260
+ # @param string type Data type
261
+ # @param string value Value to be deserialized
262
+ # @return [Object] Deserialized data
263
+ def _deserialize(type, value)
264
+ case type.to_sym
265
+ when :Time
266
+ Time.parse(value)
267
+ when :Date
268
+ Date.parse(value)
269
+ when :String
270
+ value.to_s
271
+ when :Integer
272
+ value.to_i
273
+ when :Float
274
+ value.to_f
275
+ when :Boolean
276
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
277
+ true
278
+ else
279
+ false
280
+ end
281
+ when :Object
282
+ # generic object (usually a Hash), return directly
283
+ value
284
+ when /\AArray<(?<inner_type>.+)>\z/
285
+ inner_type = Regexp.last_match[:inner_type]
286
+ value.map { |v| _deserialize(inner_type, v) }
287
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
288
+ k_type = Regexp.last_match[:k_type]
289
+ v_type = Regexp.last_match[:v_type]
290
+ {}.tap do |hash|
291
+ value.each do |k, v|
292
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
293
+ end
294
+ end
295
+ else # model
296
+ # models (e.g. Pet) or oneOf
297
+ klass = UltracartClient.const_get(type)
298
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
299
+ end
300
+ end
301
+
302
+ # Returns the string representation of the object
303
+ # @return [String] String presentation of the object
304
+ def to_s
305
+ to_hash.to_s
306
+ end
307
+
308
+ # to_body is an alias to to_hash (backward compatibility)
309
+ # @return [Hash] Returns the object in the form of hash
310
+ def to_body
311
+ to_hash
312
+ end
313
+
314
+ # Returns the object in the form of hash
315
+ # @return [Hash] Returns the object in the form of hash
316
+ def to_hash
317
+ hash = {}
318
+ self.class.attribute_map.each_pair do |attr, param|
319
+ value = self.send(attr)
320
+ if value.nil?
321
+ is_nullable = self.class.openapi_nullable.include?(attr)
322
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
323
+ end
324
+
325
+ hash[param] = _to_hash(value)
326
+ end
327
+ hash
328
+ end
329
+
330
+ # Outputs non-array value in the form of hash
331
+ # For object, use to_hash. Otherwise, just return the value
332
+ # @param [Object] value Any valid value
333
+ # @return [Hash] Returns the value in the form of hash
334
+ def _to_hash(value)
335
+ if value.is_a?(Array)
336
+ value.compact.map { |v| _to_hash(v) }
337
+ elsif value.is_a?(Hash)
338
+ {}.tap do |hash|
339
+ value.each { |k, v| hash[k] = _to_hash(v) }
340
+ end
341
+ elsif value.respond_to? :to_hash
342
+ value.to_hash
343
+ else
344
+ value
345
+ end
346
+ end
347
+
348
+ end
349
+
350
+ end
@@ -0,0 +1,256 @@
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 ItemDigitalItemResponse
18
+ attr_accessor :digital_item
19
+
20
+ attr_accessor :error
21
+
22
+ attr_accessor :metadata
23
+
24
+ # Indicates if API call was successful
25
+ attr_accessor :success
26
+
27
+ attr_accessor :warning
28
+
29
+ # Attribute mapping from ruby-style variable name to JSON key.
30
+ def self.attribute_map
31
+ {
32
+ :'digital_item' => :'digital_item',
33
+ :'error' => :'error',
34
+ :'metadata' => :'metadata',
35
+ :'success' => :'success',
36
+ :'warning' => :'warning'
37
+ }
38
+ end
39
+
40
+ # Returns all the JSON keys this model knows about
41
+ def self.acceptable_attributes
42
+ attribute_map.values
43
+ end
44
+
45
+ # Attribute type mapping.
46
+ def self.openapi_types
47
+ {
48
+ :'digital_item' => :'ItemDigitalItem',
49
+ :'error' => :'Error',
50
+ :'metadata' => :'ResponseMetadata',
51
+ :'success' => :'Boolean',
52
+ :'warning' => :'Warning'
53
+ }
54
+ end
55
+
56
+ # List of attributes with nullable: true
57
+ def self.openapi_nullable
58
+ Set.new([
59
+ ])
60
+ end
61
+
62
+ # Initializes the object
63
+ # @param [Hash] attributes Model attributes in the form of hash
64
+ def initialize(attributes = {})
65
+ if (!attributes.is_a?(Hash))
66
+ fail ArgumentError, "The input argument (attributes) must be a hash in `UltracartClient::ItemDigitalItemResponse` initialize method"
67
+ end
68
+
69
+ # check to see if the attribute exists and convert string to symbol for hash key
70
+ attributes = attributes.each_with_object({}) { |(k, v), h|
71
+ if (!self.class.attribute_map.key?(k.to_sym))
72
+ fail ArgumentError, "`#{k}` is not a valid attribute in `UltracartClient::ItemDigitalItemResponse`. Please check the name to make sure it's valid. List of attributes: " + self.class.attribute_map.keys.inspect
73
+ end
74
+ h[k.to_sym] = v
75
+ }
76
+
77
+ if attributes.key?(:'digital_item')
78
+ self.digital_item = attributes[:'digital_item']
79
+ end
80
+
81
+ if attributes.key?(:'error')
82
+ self.error = attributes[:'error']
83
+ end
84
+
85
+ if attributes.key?(:'metadata')
86
+ self.metadata = attributes[:'metadata']
87
+ end
88
+
89
+ if attributes.key?(:'success')
90
+ self.success = attributes[:'success']
91
+ end
92
+
93
+ if attributes.key?(:'warning')
94
+ self.warning = attributes[:'warning']
95
+ end
96
+ end
97
+
98
+ # Show invalid properties with the reasons. Usually used together with valid?
99
+ # @return Array for valid properties with the reasons
100
+ def list_invalid_properties
101
+ invalid_properties = Array.new
102
+ invalid_properties
103
+ end
104
+
105
+ # Check to see if the all the properties in the model are valid
106
+ # @return true if the model is valid
107
+ def valid?
108
+ true
109
+ end
110
+
111
+ # Checks equality by comparing each attribute.
112
+ # @param [Object] Object to be compared
113
+ def ==(o)
114
+ return true if self.equal?(o)
115
+ self.class == o.class &&
116
+ digital_item == o.digital_item &&
117
+ error == o.error &&
118
+ metadata == o.metadata &&
119
+ success == o.success &&
120
+ warning == o.warning
121
+ end
122
+
123
+ # @see the `==` method
124
+ # @param [Object] Object to be compared
125
+ def eql?(o)
126
+ self == o
127
+ end
128
+
129
+ # Calculates hash code according to all attributes.
130
+ # @return [Integer] Hash code
131
+ def hash
132
+ [digital_item, error, metadata, success, warning].hash
133
+ end
134
+
135
+ # Builds the object from hash
136
+ # @param [Hash] attributes Model attributes in the form of hash
137
+ # @return [Object] Returns the model itself
138
+ def self.build_from_hash(attributes)
139
+ new.build_from_hash(attributes)
140
+ end
141
+
142
+ # Builds the object from hash
143
+ # @param [Hash] attributes Model attributes in the form of hash
144
+ # @return [Object] Returns the model itself
145
+ def build_from_hash(attributes)
146
+ return nil unless attributes.is_a?(Hash)
147
+ attributes = attributes.transform_keys(&:to_sym)
148
+ self.class.openapi_types.each_pair do |key, type|
149
+ if attributes[self.class.attribute_map[key]].nil? && self.class.openapi_nullable.include?(key)
150
+ self.send("#{key}=", nil)
151
+ elsif type =~ /\AArray<(.*)>/i
152
+ # check to ensure the input is an array given that the attribute
153
+ # is documented as an array but the input is not
154
+ if attributes[self.class.attribute_map[key]].is_a?(Array)
155
+ self.send("#{key}=", attributes[self.class.attribute_map[key]].map { |v| _deserialize($1, v) })
156
+ end
157
+ elsif !attributes[self.class.attribute_map[key]].nil?
158
+ self.send("#{key}=", _deserialize(type, attributes[self.class.attribute_map[key]]))
159
+ end
160
+ end
161
+
162
+ self
163
+ end
164
+
165
+ # Deserializes the data based on type
166
+ # @param string type Data type
167
+ # @param string value Value to be deserialized
168
+ # @return [Object] Deserialized data
169
+ def _deserialize(type, value)
170
+ case type.to_sym
171
+ when :Time
172
+ Time.parse(value)
173
+ when :Date
174
+ Date.parse(value)
175
+ when :String
176
+ value.to_s
177
+ when :Integer
178
+ value.to_i
179
+ when :Float
180
+ value.to_f
181
+ when :Boolean
182
+ if value.to_s =~ /\A(true|t|yes|y|1)\z/i
183
+ true
184
+ else
185
+ false
186
+ end
187
+ when :Object
188
+ # generic object (usually a Hash), return directly
189
+ value
190
+ when /\AArray<(?<inner_type>.+)>\z/
191
+ inner_type = Regexp.last_match[:inner_type]
192
+ value.map { |v| _deserialize(inner_type, v) }
193
+ when /\AHash<(?<k_type>.+?), (?<v_type>.+)>\z/
194
+ k_type = Regexp.last_match[:k_type]
195
+ v_type = Regexp.last_match[:v_type]
196
+ {}.tap do |hash|
197
+ value.each do |k, v|
198
+ hash[_deserialize(k_type, k)] = _deserialize(v_type, v)
199
+ end
200
+ end
201
+ else # model
202
+ # models (e.g. Pet) or oneOf
203
+ klass = UltracartClient.const_get(type)
204
+ klass.respond_to?(:openapi_one_of) ? klass.build(value) : klass.build_from_hash(value)
205
+ end
206
+ end
207
+
208
+ # Returns the string representation of the object
209
+ # @return [String] String presentation of the object
210
+ def to_s
211
+ to_hash.to_s
212
+ end
213
+
214
+ # to_body is an alias to to_hash (backward compatibility)
215
+ # @return [Hash] Returns the object in the form of hash
216
+ def to_body
217
+ to_hash
218
+ end
219
+
220
+ # Returns the object in the form of hash
221
+ # @return [Hash] Returns the object in the form of hash
222
+ def to_hash
223
+ hash = {}
224
+ self.class.attribute_map.each_pair do |attr, param|
225
+ value = self.send(attr)
226
+ if value.nil?
227
+ is_nullable = self.class.openapi_nullable.include?(attr)
228
+ next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}"))
229
+ end
230
+
231
+ hash[param] = _to_hash(value)
232
+ end
233
+ hash
234
+ end
235
+
236
+ # Outputs non-array value in the form of hash
237
+ # For object, use to_hash. Otherwise, just return the value
238
+ # @param [Object] value Any valid value
239
+ # @return [Hash] Returns the value in the form of hash
240
+ def _to_hash(value)
241
+ if value.is_a?(Array)
242
+ value.compact.map { |v| _to_hash(v) }
243
+ elsif value.is_a?(Hash)
244
+ {}.tap do |hash|
245
+ value.each { |k, v| hash[k] = _to_hash(v) }
246
+ end
247
+ elsif value.respond_to? :to_hash
248
+ value.to_hash
249
+ else
250
+ value
251
+ end
252
+ end
253
+
254
+ end
255
+
256
+ end