Class: ClassifiedsApi::SearchFilters
- Inherits:
-
Object
- Object
- ClassifiedsApi::SearchFilters
- Defined in:
- lib/classifieds_api/search_filters.rb
Instance Attribute Summary collapse
-
#additional_info ⇒ Object
readonly
Returns the value of attribute additional_info.
-
#category ⇒ Object
Returns the value of attribute category.
-
#distance ⇒ Object
Returns the value of attribute distance.
-
#include_sponsored_ads ⇒ Object
Returns the value of attribute include_sponsored_ads.
-
#location ⇒ Object
Returns the value of attribute location.
-
#offer_type ⇒ Object
Returns the value of attribute offer_type.
-
#price_maximum ⇒ Object
Returns the value of attribute price_maximum.
-
#price_minimum ⇒ Object
Returns the value of attribute price_minimum.
Instance Method Summary collapse
-
#initialize(params = {}) ⇒ SearchFilters
constructor
A new instance of SearchFilters.
- #print_filters ⇒ Object
Constructor Details
#initialize(params = {}) ⇒ SearchFilters
Returns a new instance of SearchFilters.
7 8 9 10 11 12 13 14 15 |
# File 'lib/classifieds_api/search_filters.rb', line 7 def initialize(params={}) self.category = params[:category] || 'all' self.location = params[:location] self.distance = params[:distance] || 50 self.offer_type = params[:offer_type] || 'all' self.price_minimum = params[:price_minimum] || 0 self.price_maximum = params[:price_maximum] || 10000000 self.include_sponsored_ads = params[:include_sponsored_ads] || false end |
Instance Attribute Details
#additional_info ⇒ Object (readonly)
Returns the value of attribute additional_info.
4 5 6 |
# File 'lib/classifieds_api/search_filters.rb', line 4 def additional_info @additional_info end |
#category ⇒ Object
Returns the value of attribute category.
4 5 6 |
# File 'lib/classifieds_api/search_filters.rb', line 4 def category @category end |
#distance ⇒ Object
Returns the value of attribute distance.
4 5 6 |
# File 'lib/classifieds_api/search_filters.rb', line 4 def distance @distance end |
#include_sponsored_ads ⇒ Object
Returns the value of attribute include_sponsored_ads.
4 5 6 |
# File 'lib/classifieds_api/search_filters.rb', line 4 def include_sponsored_ads @include_sponsored_ads end |
#location ⇒ Object
Returns the value of attribute location.
4 5 6 |
# File 'lib/classifieds_api/search_filters.rb', line 4 def location @location end |
#offer_type ⇒ Object
Returns the value of attribute offer_type.
4 5 6 |
# File 'lib/classifieds_api/search_filters.rb', line 4 def offer_type @offer_type end |
#price_maximum ⇒ Object
Returns the value of attribute price_maximum.
4 5 6 |
# File 'lib/classifieds_api/search_filters.rb', line 4 def price_maximum @price_maximum end |
#price_minimum ⇒ Object
Returns the value of attribute price_minimum.
4 5 6 |
# File 'lib/classifieds_api/search_filters.rb', line 4 def price_minimum @price_minimum end |
Instance Method Details
#print_filters ⇒ Object
89 90 91 92 93 94 95 96 97 98 99 100 |
# File 'lib/classifieds_api/search_filters.rb', line 89 def print_filters puts '-------------------------------------------------------------------' puts 'Search Filters:' puts "Category: #{@category}" puts "Location: #{@location}" puts "Distance: #{@distance}" puts "Offer Type: #{@offer_type}" puts "Minimum Price: #{@price_minimum}" puts "Maximum Price: #{@price_maximum}" puts "Include Sponsored Ads: #{@include_sponsored_ads}" puts '-------------------------------------------------------------------' end |