Class: PriceHubble::Valuation

Inherits:
BaseEntity show all
Defined in:
lib/pricehubble/entity/valuation.rb

Overview

The PriceHubble valuation result for a given property.

Instance Attribute Summary

Attributes inherited from BaseEntity

#_unmapped

Instance Method Summary collapse

Methods inherited from BaseEntity

inherited, #initialize

Methods included from Utils::Bangers

bangers

Methods included from EntityConcern::Persistence

#destroyed?, #mark_as_destroyed, #new_record?, #persisted?

Methods included from EntityConcern::Client

#client, client

Methods included from EntityConcern::Associations

has_many, has_one, inherited_setup_associations

Methods included from EntityConcern::Attributes

#assign_attributes, #attributes, inherited_setup_attributes, tracked_attr, typed_attr

Methods included from EntityConcern::Attributes::StringInquirer

typed_attr_string_inquirer

Methods included from EntityConcern::Attributes::Range

typed_attr_range

Methods included from EntityConcern::Attributes::Enum

typed_attr_enum

Methods included from EntityConcern::Attributes::DateArray

typed_attr_date_array

Constructor Details

This class inherits a constructor from PriceHubble::BaseEntity

Instance Method Details

#valueInteger?

A streamlined helper to get the value by the deal type. (sale price if deal type is sale or gross rent value if deal type is rent)

Returns:

  • (Integer, nil)

    the value of the property



32
33
34
35
36
# File 'lib/pricehubble/entity/valuation.rb', line 32

def value
  return sale_price if deal_type.sale?

  rent_gross
end

#value_rangeRange?

A streamlined helper to get the value range by the deal type. (sale price range if deal type is sale or gross rent range if deal type is rent)

Returns:

  • (Range, nil)

    the value range of the property



42
43
44
45
46
# File 'lib/pricehubble/entity/valuation.rb', line 42

def value_range
  return sale_price_range if deal_type.sale?

  rent_gross_range
end