Class: IndeedAPI::Search
- Inherits:
-
Object
- Object
- IndeedAPI::Search
- Defined in:
- lib/indeed_api/search.rb
Instance Attribute Summary collapse
-
#dupe_filter ⇒ Object
readonly
Returns the value of attribute dupe_filter.
-
#end ⇒ Object
readonly
Returns the value of attribute end.
-
#highlight ⇒ Object
readonly
Returns the value of attribute highlight.
-
#location ⇒ Object
readonly
Returns the value of attribute location.
-
#page_number ⇒ Object
readonly
Returns the value of attribute page_number.
-
#query ⇒ Object
readonly
Returns the value of attribute query.
-
#radius ⇒ Object
readonly
Returns the value of attribute radius.
-
#results ⇒ Object
readonly
Returns the value of attribute results.
-
#start ⇒ Object
readonly
Returns the value of attribute start.
-
#total_results ⇒ Object
readonly
Returns the value of attribute total_results.
Instance Method Summary collapse
-
#initialize(data = {}) ⇒ Search
constructor
A new instance of Search.
Constructor Details
#initialize(data = {}) ⇒ Search
Returns a new instance of Search.
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/indeed_api/search.rb', line 8 def initialize(data = {}) @query = data['query'] @location = data['location'] @dupe_filter = data['dupefilter'] == 'true' @highlight = data['highlight'] == 'true' @total_results = data['totalresults'].to_i @start = data['start'].to_i @end = data['end'].to_i @radius = data['radius'].to_i @page_number = data['pageNumber'].to_i # Load the actual results @results = [] if results = data['results'] if results = results['result'] if results.is_a?(Hash) @results << IndeedAPI::Job.new(results) else @results = results.map { |jd| IndeedAPI::Job.new(jd) } end end end end |
Instance Attribute Details
#dupe_filter ⇒ Object (readonly)
Returns the value of attribute dupe_filter.
5 6 7 |
# File 'lib/indeed_api/search.rb', line 5 def dupe_filter @dupe_filter end |
#end ⇒ Object (readonly)
Returns the value of attribute end.
5 6 7 |
# File 'lib/indeed_api/search.rb', line 5 def end @end end |
#highlight ⇒ Object (readonly)
Returns the value of attribute highlight.
5 6 7 |
# File 'lib/indeed_api/search.rb', line 5 def highlight @highlight end |
#location ⇒ Object (readonly)
Returns the value of attribute location.
5 6 7 |
# File 'lib/indeed_api/search.rb', line 5 def location @location end |
#page_number ⇒ Object (readonly)
Returns the value of attribute page_number.
5 6 7 |
# File 'lib/indeed_api/search.rb', line 5 def page_number @page_number end |
#query ⇒ Object (readonly)
Returns the value of attribute query.
5 6 7 |
# File 'lib/indeed_api/search.rb', line 5 def query @query end |
#radius ⇒ Object (readonly)
Returns the value of attribute radius.
5 6 7 |
# File 'lib/indeed_api/search.rb', line 5 def radius @radius end |
#results ⇒ Object (readonly)
Returns the value of attribute results.
5 6 7 |
# File 'lib/indeed_api/search.rb', line 5 def results @results end |
#start ⇒ Object (readonly)
Returns the value of attribute start.
5 6 7 |
# File 'lib/indeed_api/search.rb', line 5 def start @start end |
#total_results ⇒ Object (readonly)
Returns the value of attribute total_results.
5 6 7 |
# File 'lib/indeed_api/search.rb', line 5 def total_results @total_results end |