ultracart_api 4.0.153 → 4.0.154

Sign up to get free protection for your applications and to get access to all the features.
@@ -28,24 +28,34 @@ module UltracartClient
28
28
 
29
29
  attr_accessor :overall
30
30
 
31
+ # Rating Name 1
31
32
  attr_accessor :rating_name1
32
33
 
34
+ # Rating Name 10
33
35
  attr_accessor :rating_name10
34
36
 
37
+ # Rating Name 2
35
38
  attr_accessor :rating_name2
36
39
 
40
+ # Rating Name 3
37
41
  attr_accessor :rating_name3
38
42
 
43
+ # Rating Name 4
39
44
  attr_accessor :rating_name4
40
45
 
46
+ # Rating Name 5
41
47
  attr_accessor :rating_name5
42
48
 
49
+ # Rating Name 6
43
50
  attr_accessor :rating_name6
44
51
 
52
+ # Rating Name 7
45
53
  attr_accessor :rating_name7
46
54
 
55
+ # Rating Name 8
47
56
  attr_accessor :rating_name8
48
57
 
58
+ # Rating Name 9
49
59
  attr_accessor :rating_name9
50
60
 
51
61
  attr_accessor :rating_score1
@@ -72,25 +82,54 @@ module UltracartClient
72
82
 
73
83
  attr_accessor :recommend_to_friend
74
84
 
85
+ # Review
75
86
  attr_accessor :review
76
87
 
77
88
  attr_accessor :review_oid
78
89
 
90
+ # Nickname
79
91
  attr_accessor :reviewed_nickname
80
92
 
93
+ # Reviewer Email
81
94
  attr_accessor :reviewer_email
82
95
 
96
+ # Location
83
97
  attr_accessor :reviewer_location
84
98
 
99
+ # Status of the review
85
100
  attr_accessor :status
86
101
 
102
+ # Store Feedback
87
103
  attr_accessor :store_feedback
88
104
 
89
105
  # Date/time of review submission
90
106
  attr_accessor :submitted_dts
91
107
 
108
+ # Title
92
109
  attr_accessor :title
93
110
 
111
+ class EnumAttributeValidator
112
+ attr_reader :datatype
113
+ attr_reader :allowable_values
114
+
115
+ def initialize(datatype, allowable_values)
116
+ @allowable_values = allowable_values.map do |value|
117
+ case datatype.to_s
118
+ when /Integer/i
119
+ value.to_i
120
+ when /Float/i
121
+ value.to_f
122
+ else
123
+ value
124
+ end
125
+ end
126
+ end
127
+
128
+ def valid?(value)
129
+ !value || allowable_values.include?(value)
130
+ end
131
+ end
132
+
94
133
  # Attribute mapping from ruby-style variable name to JSON key.
95
134
  def self.attribute_map
96
135
  {
@@ -356,15 +395,267 @@ module UltracartClient
356
395
  # @return Array for valid properties with the reasons
357
396
  def list_invalid_properties
358
397
  invalid_properties = Array.new
398
+ if !@rating_name1.nil? && @rating_name1.to_s.length > 100
399
+ invalid_properties.push('invalid value for "rating_name1", the character length must be smaller than or equal to 100.')
400
+ end
401
+
402
+ if !@rating_name10.nil? && @rating_name10.to_s.length > 100
403
+ invalid_properties.push('invalid value for "rating_name10", the character length must be smaller than or equal to 100.')
404
+ end
405
+
406
+ if !@rating_name2.nil? && @rating_name2.to_s.length > 100
407
+ invalid_properties.push('invalid value for "rating_name2", the character length must be smaller than or equal to 100.')
408
+ end
409
+
410
+ if !@rating_name3.nil? && @rating_name3.to_s.length > 100
411
+ invalid_properties.push('invalid value for "rating_name3", the character length must be smaller than or equal to 100.')
412
+ end
413
+
414
+ if !@rating_name4.nil? && @rating_name4.to_s.length > 100
415
+ invalid_properties.push('invalid value for "rating_name4", the character length must be smaller than or equal to 100.')
416
+ end
417
+
418
+ if !@rating_name5.nil? && @rating_name5.to_s.length > 100
419
+ invalid_properties.push('invalid value for "rating_name5", the character length must be smaller than or equal to 100.')
420
+ end
421
+
422
+ if !@rating_name6.nil? && @rating_name6.to_s.length > 100
423
+ invalid_properties.push('invalid value for "rating_name6", the character length must be smaller than or equal to 100.')
424
+ end
425
+
426
+ if !@rating_name7.nil? && @rating_name7.to_s.length > 100
427
+ invalid_properties.push('invalid value for "rating_name7", the character length must be smaller than or equal to 100.')
428
+ end
429
+
430
+ if !@rating_name8.nil? && @rating_name8.to_s.length > 100
431
+ invalid_properties.push('invalid value for "rating_name8", the character length must be smaller than or equal to 100.')
432
+ end
433
+
434
+ if !@rating_name9.nil? && @rating_name9.to_s.length > 100
435
+ invalid_properties.push('invalid value for "rating_name9", the character length must be smaller than or equal to 100.')
436
+ end
437
+
438
+ if !@review.nil? && @review.to_s.length > 10000
439
+ invalid_properties.push('invalid value for "review", the character length must be smaller than or equal to 10000.')
440
+ end
441
+
442
+ if !@reviewed_nickname.nil? && @reviewed_nickname.to_s.length > 25
443
+ invalid_properties.push('invalid value for "reviewed_nickname", the character length must be smaller than or equal to 25.')
444
+ end
445
+
446
+ if !@reviewer_email.nil? && @reviewer_email.to_s.length > 100
447
+ invalid_properties.push('invalid value for "reviewer_email", the character length must be smaller than or equal to 100.')
448
+ end
449
+
450
+ if !@reviewer_location.nil? && @reviewer_location.to_s.length > 25
451
+ invalid_properties.push('invalid value for "reviewer_location", the character length must be smaller than or equal to 25.')
452
+ end
453
+
454
+ if !@store_feedback.nil? && @store_feedback.to_s.length > 10000
455
+ invalid_properties.push('invalid value for "store_feedback", the character length must be smaller than or equal to 10000.')
456
+ end
457
+
458
+ if !@title.nil? && @title.to_s.length > 250
459
+ invalid_properties.push('invalid value for "title", the character length must be smaller than or equal to 250.')
460
+ end
461
+
359
462
  invalid_properties
360
463
  end
361
464
 
362
465
  # Check to see if the all the properties in the model are valid
363
466
  # @return true if the model is valid
364
467
  def valid?
468
+ return false if !@rating_name1.nil? && @rating_name1.to_s.length > 100
469
+ return false if !@rating_name10.nil? && @rating_name10.to_s.length > 100
470
+ return false if !@rating_name2.nil? && @rating_name2.to_s.length > 100
471
+ return false if !@rating_name3.nil? && @rating_name3.to_s.length > 100
472
+ return false if !@rating_name4.nil? && @rating_name4.to_s.length > 100
473
+ return false if !@rating_name5.nil? && @rating_name5.to_s.length > 100
474
+ return false if !@rating_name6.nil? && @rating_name6.to_s.length > 100
475
+ return false if !@rating_name7.nil? && @rating_name7.to_s.length > 100
476
+ return false if !@rating_name8.nil? && @rating_name8.to_s.length > 100
477
+ return false if !@rating_name9.nil? && @rating_name9.to_s.length > 100
478
+ return false if !@review.nil? && @review.to_s.length > 10000
479
+ return false if !@reviewed_nickname.nil? && @reviewed_nickname.to_s.length > 25
480
+ return false if !@reviewer_email.nil? && @reviewer_email.to_s.length > 100
481
+ return false if !@reviewer_location.nil? && @reviewer_location.to_s.length > 25
482
+ status_validator = EnumAttributeValidator.new('String', ["approved", "unapproved", "rejected", "multimedia processing"])
483
+ return false unless status_validator.valid?(@status)
484
+ return false if !@store_feedback.nil? && @store_feedback.to_s.length > 10000
485
+ return false if !@title.nil? && @title.to_s.length > 250
365
486
  true
366
487
  end
367
488
 
489
+ # Custom attribute writer method with validation
490
+ # @param [Object] rating_name1 Value to be assigned
491
+ def rating_name1=(rating_name1)
492
+ if !rating_name1.nil? && rating_name1.to_s.length > 100
493
+ fail ArgumentError, 'invalid value for "rating_name1", the character length must be smaller than or equal to 100.'
494
+ end
495
+
496
+ @rating_name1 = rating_name1
497
+ end
498
+
499
+ # Custom attribute writer method with validation
500
+ # @param [Object] rating_name10 Value to be assigned
501
+ def rating_name10=(rating_name10)
502
+ if !rating_name10.nil? && rating_name10.to_s.length > 100
503
+ fail ArgumentError, 'invalid value for "rating_name10", the character length must be smaller than or equal to 100.'
504
+ end
505
+
506
+ @rating_name10 = rating_name10
507
+ end
508
+
509
+ # Custom attribute writer method with validation
510
+ # @param [Object] rating_name2 Value to be assigned
511
+ def rating_name2=(rating_name2)
512
+ if !rating_name2.nil? && rating_name2.to_s.length > 100
513
+ fail ArgumentError, 'invalid value for "rating_name2", the character length must be smaller than or equal to 100.'
514
+ end
515
+
516
+ @rating_name2 = rating_name2
517
+ end
518
+
519
+ # Custom attribute writer method with validation
520
+ # @param [Object] rating_name3 Value to be assigned
521
+ def rating_name3=(rating_name3)
522
+ if !rating_name3.nil? && rating_name3.to_s.length > 100
523
+ fail ArgumentError, 'invalid value for "rating_name3", the character length must be smaller than or equal to 100.'
524
+ end
525
+
526
+ @rating_name3 = rating_name3
527
+ end
528
+
529
+ # Custom attribute writer method with validation
530
+ # @param [Object] rating_name4 Value to be assigned
531
+ def rating_name4=(rating_name4)
532
+ if !rating_name4.nil? && rating_name4.to_s.length > 100
533
+ fail ArgumentError, 'invalid value for "rating_name4", the character length must be smaller than or equal to 100.'
534
+ end
535
+
536
+ @rating_name4 = rating_name4
537
+ end
538
+
539
+ # Custom attribute writer method with validation
540
+ # @param [Object] rating_name5 Value to be assigned
541
+ def rating_name5=(rating_name5)
542
+ if !rating_name5.nil? && rating_name5.to_s.length > 100
543
+ fail ArgumentError, 'invalid value for "rating_name5", the character length must be smaller than or equal to 100.'
544
+ end
545
+
546
+ @rating_name5 = rating_name5
547
+ end
548
+
549
+ # Custom attribute writer method with validation
550
+ # @param [Object] rating_name6 Value to be assigned
551
+ def rating_name6=(rating_name6)
552
+ if !rating_name6.nil? && rating_name6.to_s.length > 100
553
+ fail ArgumentError, 'invalid value for "rating_name6", the character length must be smaller than or equal to 100.'
554
+ end
555
+
556
+ @rating_name6 = rating_name6
557
+ end
558
+
559
+ # Custom attribute writer method with validation
560
+ # @param [Object] rating_name7 Value to be assigned
561
+ def rating_name7=(rating_name7)
562
+ if !rating_name7.nil? && rating_name7.to_s.length > 100
563
+ fail ArgumentError, 'invalid value for "rating_name7", the character length must be smaller than or equal to 100.'
564
+ end
565
+
566
+ @rating_name7 = rating_name7
567
+ end
568
+
569
+ # Custom attribute writer method with validation
570
+ # @param [Object] rating_name8 Value to be assigned
571
+ def rating_name8=(rating_name8)
572
+ if !rating_name8.nil? && rating_name8.to_s.length > 100
573
+ fail ArgumentError, 'invalid value for "rating_name8", the character length must be smaller than or equal to 100.'
574
+ end
575
+
576
+ @rating_name8 = rating_name8
577
+ end
578
+
579
+ # Custom attribute writer method with validation
580
+ # @param [Object] rating_name9 Value to be assigned
581
+ def rating_name9=(rating_name9)
582
+ if !rating_name9.nil? && rating_name9.to_s.length > 100
583
+ fail ArgumentError, 'invalid value for "rating_name9", the character length must be smaller than or equal to 100.'
584
+ end
585
+
586
+ @rating_name9 = rating_name9
587
+ end
588
+
589
+ # Custom attribute writer method with validation
590
+ # @param [Object] review Value to be assigned
591
+ def review=(review)
592
+ if !review.nil? && review.to_s.length > 10000
593
+ fail ArgumentError, 'invalid value for "review", the character length must be smaller than or equal to 10000.'
594
+ end
595
+
596
+ @review = review
597
+ end
598
+
599
+ # Custom attribute writer method with validation
600
+ # @param [Object] reviewed_nickname Value to be assigned
601
+ def reviewed_nickname=(reviewed_nickname)
602
+ if !reviewed_nickname.nil? && reviewed_nickname.to_s.length > 25
603
+ fail ArgumentError, 'invalid value for "reviewed_nickname", the character length must be smaller than or equal to 25.'
604
+ end
605
+
606
+ @reviewed_nickname = reviewed_nickname
607
+ end
608
+
609
+ # Custom attribute writer method with validation
610
+ # @param [Object] reviewer_email Value to be assigned
611
+ def reviewer_email=(reviewer_email)
612
+ if !reviewer_email.nil? && reviewer_email.to_s.length > 100
613
+ fail ArgumentError, 'invalid value for "reviewer_email", the character length must be smaller than or equal to 100.'
614
+ end
615
+
616
+ @reviewer_email = reviewer_email
617
+ end
618
+
619
+ # Custom attribute writer method with validation
620
+ # @param [Object] reviewer_location Value to be assigned
621
+ def reviewer_location=(reviewer_location)
622
+ if !reviewer_location.nil? && reviewer_location.to_s.length > 25
623
+ fail ArgumentError, 'invalid value for "reviewer_location", the character length must be smaller than or equal to 25.'
624
+ end
625
+
626
+ @reviewer_location = reviewer_location
627
+ end
628
+
629
+ # Custom attribute writer method checking allowed values (enum).
630
+ # @param [Object] status Object to be assigned
631
+ def status=(status)
632
+ validator = EnumAttributeValidator.new('String', ["approved", "unapproved", "rejected", "multimedia processing"])
633
+ unless validator.valid?(status)
634
+ fail ArgumentError, "invalid value for \"status\", must be one of #{validator.allowable_values}."
635
+ end
636
+ @status = status
637
+ end
638
+
639
+ # Custom attribute writer method with validation
640
+ # @param [Object] store_feedback Value to be assigned
641
+ def store_feedback=(store_feedback)
642
+ if !store_feedback.nil? && store_feedback.to_s.length > 10000
643
+ fail ArgumentError, 'invalid value for "store_feedback", the character length must be smaller than or equal to 10000.'
644
+ end
645
+
646
+ @store_feedback = store_feedback
647
+ end
648
+
649
+ # Custom attribute writer method with validation
650
+ # @param [Object] title Value to be assigned
651
+ def title=(title)
652
+ if !title.nil? && title.to_s.length > 250
653
+ fail ArgumentError, 'invalid value for "title", the character length must be smaller than or equal to 250.'
654
+ end
655
+
656
+ @title = title
657
+ end
658
+
368
659
  # Checks equality by comparing each attribute.
369
660
  # @param [Object] Object to be compared
370
661
  def ==(o)
@@ -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 ItemReviewResponse
18
+ attr_accessor :error
19
+
20
+ attr_accessor :metadata
21
+
22
+ attr_accessor :review
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
+ :'error' => :'error',
33
+ :'metadata' => :'metadata',
34
+ :'review' => :'review',
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
+ :'error' => :'Error',
49
+ :'metadata' => :'ResponseMetadata',
50
+ :'review' => :'ItemReview',
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::ItemReviewResponse` 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::ItemReviewResponse`. 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?(:'error')
78
+ self.error = attributes[:'error']
79
+ end
80
+
81
+ if attributes.key?(:'metadata')
82
+ self.metadata = attributes[:'metadata']
83
+ end
84
+
85
+ if attributes.key?(:'review')
86
+ self.review = attributes[:'review']
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
+ error == o.error &&
117
+ metadata == o.metadata &&
118
+ review == o.review &&
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
+ [error, metadata, review, 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