Class: YouGotListed::Complexes::SearchResponse
- Defined in:
- lib/you_got_listed/complexes.rb
Instance Attribute Summary collapse
-
#client ⇒ Object
Returns the value of attribute client.
-
#limit ⇒ Object
Returns the value of attribute limit.
Attributes inherited from Response
Instance Method Summary collapse
-
#initialize(response, client, limit = 20, raise_error = false) ⇒ SearchResponse
constructor
A new instance of SearchResponse.
- #paginator ⇒ Object
- #property_complexes ⇒ Object
Methods inherited from Response
Constructor Details
#initialize(response, client, limit = 20, raise_error = false) ⇒ SearchResponse
Returns a new instance of SearchResponse.
22 23 24 25 26 |
# File 'lib/you_got_listed/complexes.rb', line 22 def initialize(response, client, limit = 20, raise_error = false) super(response, raise_error) self.limit = limit self.client = client end |
Dynamic Method Handling
This class handles dynamic methods through the method_missing method in the class YouGotListed::Response
Instance Attribute Details
#client ⇒ Object
Returns the value of attribute client.
20 21 22 |
# File 'lib/you_got_listed/complexes.rb', line 20 def client @client end |
#limit ⇒ Object
Returns the value of attribute limit.
20 21 22 |
# File 'lib/you_got_listed/complexes.rb', line 20 def limit @limit end |
Instance Method Details
#paginator ⇒ Object
44 45 46 47 48 49 50 51 |
# File 'lib/you_got_listed/complexes.rb', line 44 def paginator @paginator_cache ||= WillPaginate::Collection.create( (self.ygl_response.page_index ? self.ygl_response.page_index : 1), self.limit, (self.ygl_response.total ? self.ygl_response.total : properties.size)) do |pager| pager.replace property_complexes end end |
#property_complexes ⇒ Object
28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 |
# File 'lib/you_got_listed/complexes.rb', line 28 def property_complexes @cached_property_complexes ||= begin props = [] if self.success? && !self.ygl_response.complexes.blank? if self.ygl_response.complexes.complex.is_a?(Array) self.ygl_response.complexes.complex.each do |complex| props << YouGotListed::Complex.new(complex, self.client) end else props << YouGotListed::Complex.new(self.ygl_response.complexes.complex, self.client) end end props end end |