ultracart_api 3.10.135 → 3.10.137

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