Class: IndeedAPI::Search

Inherits:
Object
  • Object
show all
Defined in:
lib/indeed_api/search.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_filterObject (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

#endObject (readonly)

Returns the value of attribute end.



5
6
7
# File 'lib/indeed_api/search.rb', line 5

def end
  @end
end

#highlightObject (readonly)

Returns the value of attribute highlight.



5
6
7
# File 'lib/indeed_api/search.rb', line 5

def highlight
  @highlight
end

#locationObject (readonly)

Returns the value of attribute location.



5
6
7
# File 'lib/indeed_api/search.rb', line 5

def location
  @location
end

#page_numberObject (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

#queryObject (readonly)

Returns the value of attribute query.



5
6
7
# File 'lib/indeed_api/search.rb', line 5

def query
  @query
end

#radiusObject (readonly)

Returns the value of attribute radius.



5
6
7
# File 'lib/indeed_api/search.rb', line 5

def radius
  @radius
end

#resultsObject (readonly)

Returns the value of attribute results.



5
6
7
# File 'lib/indeed_api/search.rb', line 5

def results
  @results
end

#startObject (readonly)

Returns the value of attribute start.



5
6
7
# File 'lib/indeed_api/search.rb', line 5

def start
  @start
end

#total_resultsObject (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