Class: PriceHubble::ValuationRequest

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

Overview

The PriceHubble valuation request for one or more properties.

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

#perform(**args) ⇒ Array<PriceHubble::Valuation>

Perform the property valuation request.

Parameters:

  • args (Hash{Symbol => Mixed})

    additional options

Returns:



53
54
55
# File 'lib/pricehubble/entity/valuation_request.rb', line 53

def perform(**args)
  client.property_value(self, **args) || []
end

#sanitize_attr_key_propertiesSymbol

For transportation the properties array name must be changed to reflect the actual API specification.

Returns:

  • (Symbol)

    the sanitized name of the properties array



37
38
39
# File 'lib/pricehubble/entity/valuation_request.rb', line 37

def sanitize_attr_key_properties
  :valuation_inputs
end

#sanitize_attr_propertiesArray<Hash{String => Mixed}>

For transportation the properties array must be sanitized to reflect the actual API specification.

Returns:

  • (Array<Hash{String => Mixed}>)

    the sanitized properties



45
46
47
# File 'lib/pricehubble/entity/valuation_request.rb', line 45

def sanitize_attr_properties
  properties.map { |prop| { property: prop.attributes(sanitize: true) } }
end