Class: Indeed::Client

Inherits:
Object
  • Object
show all
Defined in:
lib/indeed-ruby.rb

Constant Summary collapse

API_ROOT =
'http://api.indeed.com/ads'
DEFAULT_FORMAT =
'json'
API_SEARCH =
{
    :end_point => "#{API_ROOT}/apisearch",
    :required_fields => [:userip, :useragent, [:q, :l]],
}
API_JOBS =
{
    :end_point => "#{API_ROOT}/apigetjobs",
    :required_fields => [:jobkeys],
}

Instance Method Summary collapse

Constructor Details

#initialize(publisher, version = "2") ⇒ Client

Returns a new instance of Client.



23
24
25
26
# File 'lib/indeed-ruby.rb', line 23

def initialize(publisher, version = "2")
    @publisher = publisher
    @version = version
end

Instance Method Details

#jobs(params) ⇒ Object



32
33
34
35
36
# File 'lib/indeed-ruby.rb', line 32

def jobs(params)
    valid_args = valid_args(API_JOBS[:required_fields], params)
    valid_args[:jobkeys] = valid_args[:jobkeys].join(',')
    process_request(API_JOBS[:end_point], valid_args)
end

#search(params) ⇒ Object



28
29
30
# File 'lib/indeed-ruby.rb', line 28

def search(params)
    process_request(API_SEARCH[:end_point], valid_args(API_SEARCH[:required_fields], params))
end