Class: Repull::GuestProfile

Inherits:
ApiModelBase show all
Defined in:
lib/repull/models/guest_profile.rb

Overview

Full guest profile returned by ‘GET /v1/guests/#id`. Aggregates the base list-row fields plus contacts, flags, notes, risk metadata, and a reservations-summary rollup.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from ApiModelBase

_deserialize, #_to_hash, #to_body, #to_s

Constructor Details

#initialize(attributes = {}) ⇒ GuestProfile

Initializes the object

Parameters:

  • attributes (Hash) (defaults to: {})

    Model attributes in the form of hash



141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
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
# File 'lib/repull/models/guest_profile.rb', line 141

def initialize(attributes = {})
  if (!attributes.is_a?(Hash))
    fail ArgumentError, "The input argument (attributes) must be a hash in `Repull::GuestProfile` 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::GuestProfile`. 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?(:'display_name')
    self.display_name = attributes[:'display_name']
  end

  if attributes.key?(:'display_name_long')
    self.display_name_long = attributes[:'display_name_long']
  end

  if attributes.key?(:'avatar_url')
    self.avatar_url = attributes[:'avatar_url']
  end

  if attributes.key?(:'language')
    self.language = attributes[:'language']
  end

  if attributes.key?(:'country')
    self.country = attributes[:'country']
  end

  if attributes.key?(:'phone')
    self.phone = attributes[:'phone']
  end

  if attributes.key?(:'email')
    self.email = attributes[:'email']
  end

  if attributes.key?(:'total_reservations')
    self.total_reservations = attributes[:'total_reservations']
  end

  if attributes.key?(:'total_revenue')
    self.total_revenue = attributes[:'total_revenue']
  end

  if attributes.key?(:'currency')
    self.currency = attributes[:'currency']
  end

  if attributes.key?(:'is_blacklisted')
    self.is_blacklisted = attributes[:'is_blacklisted']
  end

  if attributes.key?(:'blacklisted_reason')
    self.blacklisted_reason = attributes[:'blacklisted_reason']
  end

  if attributes.key?(:'risk_level')
    self.risk_level = attributes[:'risk_level']
  end

  if attributes.key?(:'verification_level')
    self.verification_level = attributes[:'verification_level']
  end

  if attributes.key?(:'created_at')
    self.created_at = attributes[:'created_at']
  end

  if attributes.key?(:'contacts')
    if (value = attributes[:'contacts']).is_a?(Array)
      self.contacts = value
    end
  end

  if attributes.key?(:'flags')
    if (value = attributes[:'flags']).is_a?(Array)
      self.flags = value
    end
  end

  if attributes.key?(:'notes')
    if (value = attributes[:'notes']).is_a?(Array)
      self.notes = value
    end
  end

  if attributes.key?(:'reservations_summary')
    self.reservations_summary = attributes[:'reservations_summary']
  end
end

Instance Attribute Details

#avatar_urlObject

Returns the value of attribute avatar_url.



25
26
27
# File 'lib/repull/models/guest_profile.rb', line 25

def avatar_url
  @avatar_url
end

#blacklisted_reasonObject

Returns the value of attribute blacklisted_reason.



44
45
46
# File 'lib/repull/models/guest_profile.rb', line 44

def blacklisted_reason
  @blacklisted_reason
end

#contactsObject

Returns the value of attribute contacts.



53
54
55
# File 'lib/repull/models/guest_profile.rb', line 53

def contacts
  @contacts
end

#countryObject

Returns the value of attribute country.



29
30
31
# File 'lib/repull/models/guest_profile.rb', line 29

def country
  @country
end

#created_atObject

Returns the value of attribute created_at.



51
52
53
# File 'lib/repull/models/guest_profile.rb', line 51

def created_at
  @created_at
end

#currencyObject

Returns the value of attribute currency.



40
41
42
# File 'lib/repull/models/guest_profile.rb', line 40

def currency
  @currency
end

#display_nameObject

Returns the value of attribute display_name.



21
22
23
# File 'lib/repull/models/guest_profile.rb', line 21

def display_name
  @display_name
end

#display_name_longObject

Returns the value of attribute display_name_long.



23
24
25
# File 'lib/repull/models/guest_profile.rb', line 23

def display_name_long
  @display_name_long
end

#emailObject

Returns the value of attribute email.



33
34
35
# File 'lib/repull/models/guest_profile.rb', line 33

def email
  @email
end

#flagsObject

Returns the value of attribute flags.



55
56
57
# File 'lib/repull/models/guest_profile.rb', line 55

def flags
  @flags
end

#idObject

Returns the value of attribute id.



19
20
21
# File 'lib/repull/models/guest_profile.rb', line 19

def id
  @id
end

#is_blacklistedObject

Returns the value of attribute is_blacklisted.



42
43
44
# File 'lib/repull/models/guest_profile.rb', line 42

def is_blacklisted
  @is_blacklisted
end

#languageObject

Returns the value of attribute language.



27
28
29
# File 'lib/repull/models/guest_profile.rb', line 27

def language
  @language
end

#notesObject

Returns the value of attribute notes.



57
58
59
# File 'lib/repull/models/guest_profile.rb', line 57

def notes
  @notes
end

#phoneObject

Returns the value of attribute phone.



31
32
33
# File 'lib/repull/models/guest_profile.rb', line 31

def phone
  @phone
end

#reservations_summaryObject

Returns the value of attribute reservations_summary.



59
60
61
# File 'lib/repull/models/guest_profile.rb', line 59

def reservations_summary
  @reservations_summary
end

#risk_levelObject

Main-vanio risk score (e.g. ‘low`, `medium`, `high`).



47
48
49
# File 'lib/repull/models/guest_profile.rb', line 47

def risk_level
  @risk_level
end

#total_reservationsObject

Returns the value of attribute total_reservations.



35
36
37
# File 'lib/repull/models/guest_profile.rb', line 35

def total_reservations
  @total_reservations
end

#total_revenueObject

Decimal as string.



38
39
40
# File 'lib/repull/models/guest_profile.rb', line 38

def total_revenue
  @total_revenue
end

#verification_levelObject

Returns the value of attribute verification_level.



49
50
51
# File 'lib/repull/models/guest_profile.rb', line 49

def verification_level
  @verification_level
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



88
89
90
# File 'lib/repull/models/guest_profile.rb', line 88

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



93
94
95
# File 'lib/repull/models/guest_profile.rb', line 93

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

Attribute mapping from ruby-style variable name to JSON key.



62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/repull/models/guest_profile.rb', line 62

def self.attribute_map
  {
    :'id' => :'id',
    :'display_name' => :'displayName',
    :'display_name_long' => :'displayNameLong',
    :'avatar_url' => :'avatarUrl',
    :'language' => :'language',
    :'country' => :'country',
    :'phone' => :'phone',
    :'email' => :'email',
    :'total_reservations' => :'totalReservations',
    :'total_revenue' => :'totalRevenue',
    :'currency' => :'currency',
    :'is_blacklisted' => :'isBlacklisted',
    :'blacklisted_reason' => :'blacklistedReason',
    :'risk_level' => :'riskLevel',
    :'verification_level' => :'verificationLevel',
    :'created_at' => :'createdAt',
    :'contacts' => :'contacts',
    :'flags' => :'flags',
    :'notes' => :'notes',
    :'reservations_summary' => :'reservationsSummary'
  }
end

.build_from_hash(attributes) ⇒ Object

Builds the object from hash

Parameters:

  • attributes (Hash)

    Model attributes in the form of hash

Returns:

  • (Object)

    Returns the model itself



299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
# File 'lib/repull/models/guest_profile.rb', line 299

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_nullableObject

List of attributes with nullable: true



124
125
126
127
128
129
130
131
132
133
134
135
136
137
# File 'lib/repull/models/guest_profile.rb', line 124

def self.openapi_nullable
  Set.new([
    :'avatar_url',
    :'language',
    :'country',
    :'phone',
    :'email',
    :'currency',
    :'blacklisted_reason',
    :'risk_level',
    :'verification_level',
    :'created_at',
  ])
end

.openapi_typesObject

Attribute type mapping.



98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
# File 'lib/repull/models/guest_profile.rb', line 98

def self.openapi_types
  {
    :'id' => :'String',
    :'display_name' => :'String',
    :'display_name_long' => :'String',
    :'avatar_url' => :'String',
    :'language' => :'String',
    :'country' => :'String',
    :'phone' => :'String',
    :'email' => :'String',
    :'total_reservations' => :'Integer',
    :'total_revenue' => :'String',
    :'currency' => :'String',
    :'is_blacklisted' => :'Boolean',
    :'blacklisted_reason' => :'String',
    :'risk_level' => :'String',
    :'verification_level' => :'String',
    :'created_at' => :'Time',
    :'contacts' => :'Array<GuestContact>',
    :'flags' => :'Array<GuestFlag>',
    :'notes' => :'Array<GuestNote>',
    :'reservations_summary' => :'GuestReservationsSummary'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
# File 'lib/repull/models/guest_profile.rb', line 259

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      id == o.id &&
      display_name == o.display_name &&
      display_name_long == o.display_name_long &&
      avatar_url == o.avatar_url &&
      language == o.language &&
      country == o.country &&
      phone == o.phone &&
      email == o.email &&
      total_reservations == o.total_reservations &&
      total_revenue == o.total_revenue &&
      currency == o.currency &&
      is_blacklisted == o.is_blacklisted &&
      blacklisted_reason == o.blacklisted_reason &&
      risk_level == o.risk_level &&
      verification_level == o.verification_level &&
      created_at == o.created_at &&
      contacts == o.contacts &&
      flags == o.flags &&
      notes == o.notes &&
      reservations_summary == o.reservations_summary
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


286
287
288
# File 'lib/repull/models/guest_profile.rb', line 286

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



292
293
294
# File 'lib/repull/models/guest_profile.rb', line 292

def hash
  [id, display_name, display_name_long, avatar_url, language, country, phone, email, total_reservations, total_revenue, currency, is_blacklisted, blacklisted_reason, risk_level, verification_level, created_at, contacts, flags, notes, reservations_summary].hash
end

#list_invalid_propertiesObject

Show invalid properties with the reasons. Usually used together with valid?

Returns:

  • Array for valid properties with the reasons



244
245
246
247
248
# File 'lib/repull/models/guest_profile.rb', line 244

def list_invalid_properties
  warn '[DEPRECATED] the `list_invalid_properties` method is obsolete'
  invalid_properties = Array.new
  invalid_properties
end

#to_hashHash

Returns the object in the form of hash

Returns:

  • (Hash)

    Returns the object in the form of hash



321
322
323
324
325
326
327
328
329
330
331
332
333
# File 'lib/repull/models/guest_profile.rb', line 321

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

Returns:

  • (Boolean)

    true if the model is valid



252
253
254
255
# File 'lib/repull/models/guest_profile.rb', line 252

def valid?
  warn '[DEPRECATED] the `valid?` method is obsolete'
  true
end