Class: YouGotListed::Complexes

Inherits:
Resource
  • Object
show all
Defined in:
lib/you_got_listed/complexes.rb

Defined Under Namespace

Classes: SearchResponse

Instance Attribute Summary

Attributes inherited from Resource

#client

Instance Method Summary collapse

Methods inherited from Resource

#initialize, #process_get, #process_post

Constructor Details

This class inherits a constructor from YouGotListed::Resource

Instance Method Details

#find_by_id(complex_id) ⇒ Object



13
14
15
16
# File 'lib/you_got_listed/complexes.rb', line 13

def find_by_id(complex_id)
  response = SearchResponse.new(self.client.perform_request(:get, '/complexes/search.php', {:complex_id => complex_id}), self.client, 20)
  (response.success? && response.property_complexes.size > 0) ? response.property_complexes.first : nil
end

#search(params = {}) ⇒ Object



4
5
6
7
8
9
10
11
# File 'lib/you_got_listed/complexes.rb', line 4

def search(params = {})
  params[:page_count] ||= 20
  params[:page_index] ||= 1
  params[:sort_name] ||= "Name"
  params[:sort_dir] ||= "asc"
  params[:detail_level] ||= 2
  SearchResponse.new(self.client.perform_request(:get, '/complexes/search.php', params), self.client, params[:page_count])
end