Class: Corelogic::API::PropertiesRepository

Inherits:
Object
  • Object
show all
Defined in:
lib/corelogic/api/properties_repository.rb

Constant Summary collapse

SEARCH_PATH =
'property'

Instance Method Summary collapse

Instance Method Details

#building(property_id) ⇒ Object



30
31
32
# File 'lib/corelogic/api/properties_repository.rb', line 30

def building(property_id)
  Property::Building.new(perform_response("property/#{property_id}/building"))
end

#last_market_sale(property_id) ⇒ Object



50
51
52
# File 'lib/corelogic/api/properties_repository.rb', line 50

def last_market_sale(property_id)
  Property::LastMarketSale.new(perform_response("property/#{property_id}/last-market-sale"))
end

#location(property_id) ⇒ Object



42
43
44
# File 'lib/corelogic/api/properties_repository.rb', line 42

def location(property_id)
  Property::Location.new(perform_response("property/#{property_id}/location"))
end

#owner_transfer(property_id) ⇒ Object



46
47
48
# File 'lib/corelogic/api/properties_repository.rb', line 46

def owner_transfer(property_id)
  Property::OwnerTransfer.new(perform_response("property/#{property_id}/owner-transfer"))
end

#ownership(property_id) ⇒ Object



26
27
28
# File 'lib/corelogic/api/properties_repository.rb', line 26

def ownership(property_id)
  Property::Ownership.new(perform_response("property/#{property_id}/ownership"))
end

#prior_sale(property_id) ⇒ Object



54
55
56
# File 'lib/corelogic/api/properties_repository.rb', line 54

def prior_sale(property_id)
  Property::PriorSale.new(perform_response("property/#{property_id}/prior-sale"))
end

#property_detail(property) ⇒ Object



58
59
60
61
62
63
64
65
66
67
68
69
70
71
# File 'lib/corelogic/api/properties_repository.rb', line 58

def property_detail(property)
  response = perform_response("property/#{property.id}/property-detail")

  property.assign_data!(response[:property])
  property.ownership = Property::Ownership.new(response[:ownership]) if response[:ownership]
  property.building = Property::Building.new(response[:building]) if response[:building]
  property.tax_assessment = Property::TaxAssessment.new(response[:taxAssessment]) if response[:taxAssessment]
  property.site = Property::Site.new(response[:site]) if response[:site]
  property.location = Property::Location.new(response[:location]) if response[:location]
  property.owner_transfer = Property::OwnerTransfer.new(response[:ownerTransfer]) if response[:ownerTransfer]
  property.last_market_sale = Property::LastMarketSale.new(response[:lastMarketSale]) if response[:lastMarketSale]
  property.prior_sale = Property::PriorSale.new(response[:priorSale]) if response[:priorSale]
  property
end

#search(options = {}) ⇒ Object



22
23
24
# File 'lib/corelogic/api/properties_repository.rb', line 22

def search(options = {})
  Corelogic::Collection.new(Corelogic::Property, perform_response(SEARCH_PATH, options))
end

#site(property_id) ⇒ Object



38
39
40
# File 'lib/corelogic/api/properties_repository.rb', line 38

def site(property_id)
  Property::Site.new(perform_response("property/#{property_id}/site"))
end

#tax_assessment(property_id) ⇒ Object



34
35
36
# File 'lib/corelogic/api/properties_repository.rb', line 34

def tax_assessment(property_id)
  Property::TaxAssessment.new(perform_response("property/#{property_id}/tax-assessment"))
end