Class: Repull::ListingContentUpdateRequest

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

Overview

Canonical PMS-owned listing content. Every field is optional — this is a partial update, only the fields you send are written; absent fields are left untouched. This is a LOCAL write only: it does NOT push to Airbnb/Booking.com. Distribution is a separate explicit publish step. photos are ingested by URL and attached to the listing in order (full-replace by default, or append via photosMode).

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 = {}) ⇒ ListingContentUpdateRequest

Initializes the object

Parameters:

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

    Model attributes in the form of hash



99
100
101
102
103
104
105
106
107
108
109
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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
# File 'lib/repull/models/listing_content_update_request.rb', line 99

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

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

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

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

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

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

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

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

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

  if attributes.key?(:'photos_mode')
    self.photos_mode = attributes[:'photos_mode']
  else
    self.photos_mode = 'replace'
  end
end

Instance Attribute Details

#addressObject

Returns the value of attribute address.



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

def address
  @address
end

#amenitiesObject

Returns the value of attribute amenities.



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

def amenities
  @amenities
end

#descriptionObject

Long-form listing description.



26
27
28
# File 'lib/repull/models/listing_content_update_request.rb', line 26

def description
  @description
end

#nameObject

Alias for title.



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

def name
  @name
end

#occupancyObject

Returns the value of attribute occupancy.



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

def occupancy
  @occupancy
end

#photosObject

Photo set — full replacement by default (pass photosMode: \"append\" to add after existing photos, or [] to clear; omit to leave untouched). Each entry is a hosted image URL (string) or a structured ref. URL-ingest only: the URL is persisted and attached to the listing in order — the OTA push downloads it at publish time. Binary/multipart upload is a follow-up. A non-empty array with no valid http(s) URL is reported in deferred (existing photos left untouched).



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

def photos
  @photos
end

#photos_modeObject

How photos is applied: replace (full replacement of the photo set) or append (add after the existing photos). Ignored when photos is absent.



43
44
45
# File 'lib/repull/models/listing_content_update_request.rb', line 43

def photos_mode
  @photos_mode
end

#policiesObject

Returns the value of attribute policies.



37
38
39
# File 'lib/repull/models/listing_content_update_request.rb', line 37

def policies
  @policies
end

#summaryObject

Short summary / tagline.



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

def summary
  @summary
end

#titleObject

Guest-facing title. Written to the listing name and the en description.



20
21
22
# File 'lib/repull/models/listing_content_update_request.rb', line 20

def title
  @title
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



62
63
64
# File 'lib/repull/models/listing_content_update_request.rb', line 62

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



67
68
69
# File 'lib/repull/models/listing_content_update_request.rb', line 67

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/repull/models/listing_content_update_request.rb', line 46

def self.attribute_map
  {
    :'title' => :'title',
    :'name' => :'name',
    :'description' => :'description',
    :'summary' => :'summary',
    :'amenities' => :'amenities',
    :'address' => :'address',
    :'occupancy' => :'occupancy',
    :'policies' => :'policies',
    :'photos' => :'photos',
    :'photos_mode' => :'photosMode'
  }
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



205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
# File 'lib/repull/models/listing_content_update_request.rb', line 205

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



88
89
90
91
92
93
94
95
# File 'lib/repull/models/listing_content_update_request.rb', line 88

def self.openapi_nullable
  Set.new([
    :'title',
    :'name',
    :'description',
    :'summary',
  ])
end

.openapi_typesObject

Attribute type mapping.



72
73
74
75
76
77
78
79
80
81
82
83
84
85
# File 'lib/repull/models/listing_content_update_request.rb', line 72

def self.openapi_types
  {
    :'title' => :'String',
    :'name' => :'String',
    :'description' => :'String',
    :'summary' => :'String',
    :'amenities' => :'ListingContentUpdateRequestAmenities',
    :'address' => :'ListingContentUpdateRequestAddress',
    :'occupancy' => :'ListingContentUpdateRequestOccupancy',
    :'policies' => :'ListingContentUpdateRequestPolicies',
    :'photos' => :'Array<ListingContentUpdateRequestPhotosInner>',
    :'photos_mode' => :'String'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



175
176
177
178
179
180
181
182
183
184
185
186
187
188
# File 'lib/repull/models/listing_content_update_request.rb', line 175

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      title == o.title &&
      name == o.name &&
      description == o.description &&
      summary == o.summary &&
      amenities == o.amenities &&
      address == o.address &&
      occupancy == o.occupancy &&
      policies == o.policies &&
      photos == o.photos &&
      photos_mode == o.photos_mode
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


192
193
194
# File 'lib/repull/models/listing_content_update_request.rb', line 192

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



198
199
200
# File 'lib/repull/models/listing_content_update_request.rb', line 198

def hash
  [title, name, description, summary, amenities, address, occupancy, policies, photos, photos_mode].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



160
161
162
163
164
# File 'lib/repull/models/listing_content_update_request.rb', line 160

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



227
228
229
230
231
232
233
234
235
236
237
238
239
# File 'lib/repull/models/listing_content_update_request.rb', line 227

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



168
169
170
171
# File 'lib/repull/models/listing_content_update_request.rb', line 168

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