Sha256: e096ee126243eb11c2f6db4d42c73ae3308ba47062e6431a405a3a59b51d325e

Contents?: true

Size: 784 Bytes

Versions: 7

Compression:

Stored size: 784 Bytes

Contents

#!/usr/bin/env ruby
# frozen_string_literal: true

require_relative 'config'

begin
  # Fetch the valuations for a single property (sale) for today (defaults).
  # This is the bare minimum variant, as a starting point.
  PriceHubble::ValuationRequest.new(
    property: {
      location: {
        address: {
          post_code: '22769',
          city: 'Hamburg',
          street: 'Stresemannstr.',
          house_number: '29'
        }
      },
      property_type: { code: :apartment },
      building_year: 2999,
      living_area: 200
    }
  ).perform!
rescue PriceHubble::EntityInvalid => e
  # => #<PriceHubble::EntityInvalid: buildingYear: ...>

  # The error message includes the detailed problem.
  pp e.message
  # => "buildingYear: Must be between 1850 and 2022."
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
pricehubble-1.3.0 doc/examples/property_valuations_errors.rb
pricehubble-1.2.5 doc/examples/property_valuations_errors.rb
pricehubble-1.2.4 doc/examples/property_valuations_errors.rb
pricehubble-1.2.3 doc/examples/property_valuations_errors.rb
pricehubble-1.2.2 doc/examples/property_valuations_errors.rb
pricehubble-1.2.1 doc/examples/property_valuations_errors.rb
pricehubble-1.2.0 doc/examples/property_valuations_errors.rb