Class: Repull::Review
- Inherits:
-
ApiModelBase
- Object
- ApiModelBase
- Repull::Review
- Defined in:
- lib/repull/models/review.rb
Overview
A guest or host review unified across channels. Returned by ‘GET /v1/reviews` and `GET /v1/reviews/#id`. Populated from main vanio’s unified ‘reviews` table after the per-channel backfill cron has run.
Instance Attribute Summary collapse
-
#categories ⇒ Object
Returns the value of attribute categories.
-
#expires_at ⇒ Object
When the review window closes (Airbnb has a 14-day window after checkout).
-
#external_id ⇒ Object
ID in the source channel (Airbnb review id, Booking review id, etc.).
-
#guest_avatar ⇒ Object
Returns the value of attribute guest_avatar.
-
#guest_id ⇒ Object
Returns the value of attribute guest_id.
-
#guest_name ⇒ Object
Returns the value of attribute guest_name.
-
#hidden ⇒ Object
Returns the value of attribute hidden.
-
#id ⇒ Object
Internal Repull review id — pass back to ‘/v1/reviews/#id`.
-
#is_reviewee_recommended ⇒ Object
Did the reviewer recommend the reviewee? Used for guest-side reviews.
-
#language ⇒ Object
Detected language (ISO 639-1) of the review body.
-
#listing_id ⇒ Object
Internal Repull listing id the review is attached to.
-
#platform ⇒ Object
Returns the value of attribute platform.
-
#private_feedback ⇒ Object
Private feedback the reviewer sent only to the host.
-
#public_review ⇒ Object
Public-facing review text shown on the listing page.
-
#rating ⇒ Object
Overall rating on the platform’s scale (typically 1..5).
-
#reservation_confirmation_code ⇒ Object
Channel-side confirmation code for the reservation being reviewed.
-
#reservation_id ⇒ Object
Returns the value of attribute reservation_id.
-
#response ⇒ Object
Returns the value of attribute response.
-
#reviewer_role ⇒ Object
Who wrote the review — ‘guest` (about the host/property) or `host` (about the guest).
-
#submitted_at ⇒ Object
Returns the value of attribute submitted_at.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Class Method Summary collapse
-
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about.
-
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about.
-
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
-
.build_from_hash(attributes) ⇒ Object
Builds the object from hash.
-
.openapi_nullable ⇒ Object
List of attributes with nullable: true.
-
.openapi_types ⇒ Object
Attribute type mapping.
Instance Method Summary collapse
-
#==(o) ⇒ Object
Checks equality by comparing each attribute.
- #eql?(o) ⇒ Boolean
-
#hash ⇒ Integer
Calculates hash code according to all attributes.
-
#initialize(attributes = {}) ⇒ Review
constructor
Initializes the object.
-
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons.
-
#to_hash ⇒ Hash
Returns the object in the form of hash.
-
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid.
Methods inherited from ApiModelBase
_deserialize, #_to_hash, #to_body, #to_s
Constructor Details
#initialize(attributes = {}) ⇒ Review
Initializes the object
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 |
# File 'lib/repull/models/review.rb', line 160 def initialize(attributes = {}) if (!attributes.is_a?(Hash)) fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::Review` initialize method" end # check to see if the attribute exists and convert string to symbol for hash key acceptable_attribute_map = self.class.acceptable_attribute_map attributes = attributes.each_with_object({}) { |(k, v), h| if (!acceptable_attribute_map.key?(k.to_sym)) fail ArgumentError, "`#{k}` is not a valid attribute in `Repull::Review`. Please check the name to make sure it's valid. List of attributes: " + acceptable_attribute_map.keys.inspect end h[k.to_sym] = v } if attributes.key?(:'id') self.id = attributes[:'id'] end if attributes.key?(:'external_id') self.external_id = attributes[:'external_id'] end if attributes.key?(:'platform') self.platform = attributes[:'platform'] end if attributes.key?(:'listing_id') self.listing_id = attributes[:'listing_id'] end if attributes.key?(:'reservation_id') self.reservation_id = attributes[:'reservation_id'] end if attributes.key?(:'reservation_confirmation_code') self.reservation_confirmation_code = attributes[:'reservation_confirmation_code'] end if attributes.key?(:'guest_id') self.guest_id = attributes[:'guest_id'] end if attributes.key?(:'guest_name') self.guest_name = attributes[:'guest_name'] end if attributes.key?(:'guest_avatar') self.guest_avatar = attributes[:'guest_avatar'] end if attributes.key?(:'reviewer_role') self.reviewer_role = attributes[:'reviewer_role'] end if attributes.key?(:'rating') self. = attributes[:'rating'] end if attributes.key?(:'categories') if (value = attributes[:'categories']).is_a?(Array) self.categories = value end end if attributes.key?(:'public_review') self.public_review = attributes[:'public_review'] end if attributes.key?(:'private_feedback') self.private_feedback = attributes[:'private_feedback'] end if attributes.key?(:'is_reviewee_recommended') self.is_reviewee_recommended = attributes[:'is_reviewee_recommended'] end if attributes.key?(:'response') self.response = attributes[:'response'] end if attributes.key?(:'submitted_at') self.submitted_at = attributes[:'submitted_at'] end if attributes.key?(:'updated_at') self.updated_at = attributes[:'updated_at'] end if attributes.key?(:'expires_at') self.expires_at = attributes[:'expires_at'] end if attributes.key?(:'hidden') self.hidden = attributes[:'hidden'] end if attributes.key?(:'language') self.language = attributes[:'language'] end end |
Instance Attribute Details
#categories ⇒ Object
Returns the value of attribute categories.
47 48 49 |
# File 'lib/repull/models/review.rb', line 47 def categories @categories end |
#expires_at ⇒ Object
When the review window closes (Airbnb has a 14-day window after checkout).
65 66 67 |
# File 'lib/repull/models/review.rb', line 65 def expires_at @expires_at end |
#external_id ⇒ Object
ID in the source channel (Airbnb review id, Booking review id, etc.).
23 24 25 |
# File 'lib/repull/models/review.rb', line 23 def external_id @external_id end |
#guest_avatar ⇒ Object
Returns the value of attribute guest_avatar.
39 40 41 |
# File 'lib/repull/models/review.rb', line 39 def guest_avatar @guest_avatar end |
#guest_id ⇒ Object
Returns the value of attribute guest_id.
35 36 37 |
# File 'lib/repull/models/review.rb', line 35 def guest_id @guest_id end |
#guest_name ⇒ Object
Returns the value of attribute guest_name.
37 38 39 |
# File 'lib/repull/models/review.rb', line 37 def guest_name @guest_name end |
#hidden ⇒ Object
Returns the value of attribute hidden.
67 68 69 |
# File 'lib/repull/models/review.rb', line 67 def hidden @hidden end |
#id ⇒ Object
Internal Repull review id — pass back to ‘/v1/reviews/#id`.
20 21 22 |
# File 'lib/repull/models/review.rb', line 20 def id @id end |
#is_reviewee_recommended ⇒ Object
Did the reviewer recommend the reviewee? Used for guest-side reviews.
56 57 58 |
# File 'lib/repull/models/review.rb', line 56 def is_reviewee_recommended @is_reviewee_recommended end |
#language ⇒ Object
Detected language (ISO 639-1) of the review body.
70 71 72 |
# File 'lib/repull/models/review.rb', line 70 def language @language end |
#listing_id ⇒ Object
Internal Repull listing id the review is attached to.
28 29 30 |
# File 'lib/repull/models/review.rb', line 28 def listing_id @listing_id end |
#platform ⇒ Object
Returns the value of attribute platform.
25 26 27 |
# File 'lib/repull/models/review.rb', line 25 def platform @platform end |
#private_feedback ⇒ Object
Private feedback the reviewer sent only to the host.
53 54 55 |
# File 'lib/repull/models/review.rb', line 53 def private_feedback @private_feedback end |
#public_review ⇒ Object
Public-facing review text shown on the listing page.
50 51 52 |
# File 'lib/repull/models/review.rb', line 50 def public_review @public_review end |
#rating ⇒ Object
Overall rating on the platform’s scale (typically 1..5). May be ‘null` for review types that lack a numeric overall score.
45 46 47 |
# File 'lib/repull/models/review.rb', line 45 def @rating end |
#reservation_confirmation_code ⇒ Object
Channel-side confirmation code for the reservation being reviewed.
33 34 35 |
# File 'lib/repull/models/review.rb', line 33 def reservation_confirmation_code @reservation_confirmation_code end |
#reservation_id ⇒ Object
Returns the value of attribute reservation_id.
30 31 32 |
# File 'lib/repull/models/review.rb', line 30 def reservation_id @reservation_id end |
#response ⇒ Object
Returns the value of attribute response.
58 59 60 |
# File 'lib/repull/models/review.rb', line 58 def response @response end |
#reviewer_role ⇒ Object
Who wrote the review — ‘guest` (about the host/property) or `host` (about the guest).
42 43 44 |
# File 'lib/repull/models/review.rb', line 42 def reviewer_role @reviewer_role end |
#submitted_at ⇒ Object
Returns the value of attribute submitted_at.
60 61 62 |
# File 'lib/repull/models/review.rb', line 60 def submitted_at @submitted_at end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
62 63 64 |
# File 'lib/repull/models/review.rb', line 62 def updated_at @updated_at end |
Class Method Details
.acceptable_attribute_map ⇒ Object
Returns attribute mapping this model knows about
100 101 102 |
# File 'lib/repull/models/review.rb', line 100 def self.acceptable_attribute_map attribute_map end |
.acceptable_attributes ⇒ Object
Returns all the JSON keys this model knows about
105 106 107 |
# File 'lib/repull/models/review.rb', line 105 def self.acceptable_attributes acceptable_attribute_map.values end |
.attribute_map ⇒ Object
Attribute mapping from ruby-style variable name to JSON key.
73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/repull/models/review.rb', line 73 def self.attribute_map { :'id' => :'id', :'external_id' => :'externalId', :'platform' => :'platform', :'listing_id' => :'listingId', :'reservation_id' => :'reservationId', :'reservation_confirmation_code' => :'reservationConfirmationCode', :'guest_id' => :'guestId', :'guest_name' => :'guestName', :'guest_avatar' => :'guestAvatar', :'reviewer_role' => :'reviewerRole', :'rating' => :'rating', :'categories' => :'categories', :'public_review' => :'publicReview', :'private_feedback' => :'privateFeedback', :'is_reviewee_recommended' => :'isRevieweeRecommended', :'response' => :'response', :'submitted_at' => :'submittedAt', :'updated_at' => :'updatedAt', :'expires_at' => :'expiresAt', :'hidden' => :'hidden', :'language' => :'language' } end |
.build_from_hash(attributes) ⇒ Object
Builds the object from hash
319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 |
# File 'lib/repull/models/review.rb', line 319 def self.build_from_hash(attributes) return nil unless attributes.is_a?(Hash) attributes = attributes.transform_keys(&:to_sym) transformed_hash = {} openapi_types.each_pair do |key, type| if attributes.key?(attribute_map[key]) && attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = nil elsif type =~ /\AArray<(.*)>/i # check to ensure the input is an array given that the attribute # is documented as an array but the input is not if attributes[attribute_map[key]].is_a?(Array) transformed_hash["#{key}"] = attributes[attribute_map[key]].map { |v| _deserialize($1, v) } end elsif !attributes[attribute_map[key]].nil? transformed_hash["#{key}"] = _deserialize(type, attributes[attribute_map[key]]) end end new(transformed_hash) end |
.openapi_nullable ⇒ Object
List of attributes with nullable: true
137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/repull/models/review.rb', line 137 def self.openapi_nullable Set.new([ :'platform', :'listing_id', :'reservation_id', :'reservation_confirmation_code', :'guest_id', :'guest_name', :'guest_avatar', :'rating', :'public_review', :'private_feedback', :'is_reviewee_recommended', :'response', :'submitted_at', :'updated_at', :'expires_at', :'language' ]) end |
.openapi_types ⇒ Object
Attribute type mapping.
110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 |
# File 'lib/repull/models/review.rb', line 110 def self.openapi_types { :'id' => :'String', :'external_id' => :'String', :'platform' => :'String', :'listing_id' => :'String', :'reservation_id' => :'String', :'reservation_confirmation_code' => :'String', :'guest_id' => :'String', :'guest_name' => :'String', :'guest_avatar' => :'String', :'reviewer_role' => :'String', :'rating' => :'Float', :'categories' => :'Array<ReviewCategory>', :'public_review' => :'String', :'private_feedback' => :'String', :'is_reviewee_recommended' => :'Boolean', :'response' => :'ReviewResponse', :'submitted_at' => :'Time', :'updated_at' => :'Time', :'expires_at' => :'Time', :'hidden' => :'Boolean', :'language' => :'String' } end |
Instance Method Details
#==(o) ⇒ Object
Checks equality by comparing each attribute.
278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 |
# File 'lib/repull/models/review.rb', line 278 def ==(o) return true if self.equal?(o) self.class == o.class && id == o.id && external_id == o.external_id && platform == o.platform && listing_id == o.listing_id && reservation_id == o.reservation_id && reservation_confirmation_code == o.reservation_confirmation_code && guest_id == o.guest_id && guest_name == o.guest_name && guest_avatar == o.guest_avatar && reviewer_role == o.reviewer_role && == o. && categories == o.categories && public_review == o.public_review && private_feedback == o.private_feedback && is_reviewee_recommended == o.is_reviewee_recommended && response == o.response && submitted_at == o.submitted_at && updated_at == o.updated_at && expires_at == o.expires_at && hidden == o.hidden && language == o.language end |
#eql?(o) ⇒ Boolean
306 307 308 |
# File 'lib/repull/models/review.rb', line 306 def eql?(o) self == o end |
#hash ⇒ Integer
Calculates hash code according to all attributes.
312 313 314 |
# File 'lib/repull/models/review.rb', line 312 def hash [id, external_id, platform, listing_id, reservation_id, reservation_confirmation_code, guest_id, guest_name, guest_avatar, reviewer_role, , categories, public_review, private_feedback, is_reviewee_recommended, response, submitted_at, updated_at, expires_at, hidden, language].hash end |
#list_invalid_properties ⇒ Object
Show invalid properties with the reasons. Usually used together with valid?
263 264 265 266 267 |
# File 'lib/repull/models/review.rb', line 263 def list_invalid_properties warn '[DEPRECATED] the `list_invalid_properties` method is obsolete' invalid_properties = Array.new invalid_properties end |
#to_hash ⇒ Hash
Returns the object in the form of hash
341 342 343 344 345 346 347 348 349 350 351 352 353 |
# File 'lib/repull/models/review.rb', line 341 def to_hash hash = {} self.class.attribute_map.each_pair do |attr, param| value = self.send(attr) if value.nil? is_nullable = self.class.openapi_nullable.include?(attr) next if !is_nullable || (is_nullable && !instance_variable_defined?(:"@#{attr}")) end hash[param] = _to_hash(value) end hash end |
#valid? ⇒ Boolean
Check to see if the all the properties in the model are valid
271 272 273 274 |
# File 'lib/repull/models/review.rb', line 271 def valid? warn '[DEPRECATED] the `valid?` method is obsolete' true end |