Class: Repull::ListingSegment

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

Overview

One Atlas DNA segment (e.g. ‘upscale-modern-2br`) with share + ADR aggregates across the scoped comp set or market.

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

Initializes the object

Parameters:

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

    Model attributes in the form of hash



94
95
96
97
98
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
# File 'lib/repull/models/listing_segment.rb', line 94

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

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

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

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

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

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

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

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

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

Instance Attribute Details

#avg_adr_in_segmentObject

Returns the value of attribute avg_adr_in_segment.



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

def avg_adr_in_segment
  @avg_adr_in_segment
end

#bedroomsObject

Decomposed bedroom count. ‘0` indicates studio.



36
37
38
# File 'lib/repull/models/listing_segment.rb', line 36

def bedrooms
  @bedrooms
end

#currencyObject

Returns the value of attribute currency.



28
29
30
# File 'lib/repull/models/listing_segment.rb', line 28

def currency
  @currency
end

#design_styleObject

Decomposed style token (e.g. ‘modern`, `mid-century`).



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

def design_style
  @design_style
end

#my_listing_matchObject

True when the source listing’s ‘ai_segment` matches this segment.



39
40
41
# File 'lib/repull/models/listing_segment.rb', line 39

def my_listing_match
  @my_listing_match
end

#nameObject

Returns the value of attribute name.



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

def name
  @name
end

#quality_tierObject

Returns the value of attribute quality_tier.



30
31
32
# File 'lib/repull/models/listing_segment.rb', line 30

def quality_tier
  @quality_tier
end

#sample_sizeObject

Returns the value of attribute sample_size.



24
25
26
# File 'lib/repull/models/listing_segment.rb', line 24

def sample_size
  @sample_size
end

#share_pctObject

Percent of analyzed comps in the scope that fall in this segment.



22
23
24
# File 'lib/repull/models/listing_segment.rb', line 22

def share_pct
  @share_pct
end

Class Method Details

.acceptable_attribute_mapObject

Returns attribute mapping this model knows about



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

def self.acceptable_attribute_map
  attribute_map
end

.acceptable_attributesObject

Returns all the JSON keys this model knows about



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

def self.acceptable_attributes
  acceptable_attribute_map.values
end

.attribute_mapObject

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



42
43
44
45
46
47
48
49
50
51
52
53
54
# File 'lib/repull/models/listing_segment.rb', line 42

def self.attribute_map
  {
    :'name' => :'name',
    :'share_pct' => :'sharePct',
    :'sample_size' => :'sampleSize',
    :'avg_adr_in_segment' => :'avgAdrInSegment',
    :'currency' => :'currency',
    :'quality_tier' => :'qualityTier',
    :'design_style' => :'designStyle',
    :'bedrooms' => :'bedrooms',
    :'my_listing_match' => :'myListingMatch'
  }
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



191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
# File 'lib/repull/models/listing_segment.rb', line 191

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



82
83
84
85
86
87
88
89
90
# File 'lib/repull/models/listing_segment.rb', line 82

def self.openapi_nullable
  Set.new([
    :'avg_adr_in_segment',
    :'currency',
    :'quality_tier',
    :'design_style',
    :'bedrooms',
  ])
end

.openapi_typesObject

Attribute type mapping.



67
68
69
70
71
72
73
74
75
76
77
78
79
# File 'lib/repull/models/listing_segment.rb', line 67

def self.openapi_types
  {
    :'name' => :'String',
    :'share_pct' => :'Float',
    :'sample_size' => :'Integer',
    :'avg_adr_in_segment' => :'Float',
    :'currency' => :'String',
    :'quality_tier' => :'String',
    :'design_style' => :'String',
    :'bedrooms' => :'Integer',
    :'my_listing_match' => :'Boolean'
  }
end

Instance Method Details

#==(o) ⇒ Object

Checks equality by comparing each attribute.

Parameters:

  • Object (Object)

    to be compared



162
163
164
165
166
167
168
169
170
171
172
173
174
# File 'lib/repull/models/listing_segment.rb', line 162

def ==(o)
  return true if self.equal?(o)
  self.class == o.class &&
      name == o.name &&
      share_pct == o.share_pct &&
      sample_size == o.sample_size &&
      avg_adr_in_segment == o.avg_adr_in_segment &&
      currency == o.currency &&
      quality_tier == o.quality_tier &&
      design_style == o.design_style &&
      bedrooms == o.bedrooms &&
      my_listing_match == o.my_listing_match
end

#eql?(o) ⇒ Boolean

Parameters:

  • Object (Object)

    to be compared

Returns:

  • (Boolean)

See Also:

  • `==` method


178
179
180
# File 'lib/repull/models/listing_segment.rb', line 178

def eql?(o)
  self == o
end

#hashInteger

Calculates hash code according to all attributes.

Returns:

  • (Integer)

    Hash code



184
185
186
# File 'lib/repull/models/listing_segment.rb', line 184

def hash
  [name, share_pct, sample_size, avg_adr_in_segment, currency, quality_tier, design_style, bedrooms, my_listing_match].hash
end

#list_invalid_propertiesObject

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

Returns:

  • Array for valid properties with the reasons



147
148
149
150
151
# File 'lib/repull/models/listing_segment.rb', line 147

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



213
214
215
216
217
218
219
220
221
222
223
224
225
# File 'lib/repull/models/listing_segment.rb', line 213

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



155
156
157
158
# File 'lib/repull/models/listing_segment.rb', line 155

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