ultracart_api 3.10.47 → 3.10.48

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