Open wyefei opened 10 years ago
Hey @wyefei,
Gee, it's been a while since you've posted this. Sorry about that, and thanks for sharing!
@adrianbautista kindly transferred this repo over to Greenhouse, so we'll be maintaining this gem from now on.
I can confirm this is an issue. It's not possible to call GreenhouseIo::Client#jobs
with only an options hash, since it would set the id
default parameter instead of the options
parameter.
def jobs(id = nil, options = {})
get_from_harvest_api "/jobs#{path_id(id)}", options
end
However, if you pass in nil
for the id
, it should work as expected.
gh_client.offices nil, per_page: 1
I do agree it's not very intuitive and the docs don't point this out. Perhaps a better solution, similar to the Job Board code, is to create a new set of methods for retrieving single objects, and then remove the id
param from the current list methods, like so:
def offices(options = {})
get_from_harvest_api "/offices", options
end
def office(id, options = {})
get_from_harvest_api "/offices", options
end
What do you think, @wyefei?
gh_client.offices(id, page: 1, per_page: 2)
works butgh_client.offices(page: 1, per_page: 2)
failed with error:/Users/yefeiwang/.rvm/rubies/ruby-2.1.2/lib/ruby/2.1.0/uri/common.rb:176:in
split': bad URI(is not URI?): /candidates/{:page=>1, :per_page=>200} (URI::InvalidURIError)`