careerbuilder / ruby-cb-api

Ruby wrapper around the CareerBuilder.com APIs
Apache License 2.0
14 stars 18 forks source link

Documentation is off #273

Open L33tH4x0r opened 7 years ago

L33tH4x0r commented 7 years ago

Hello!

I was looking at your documentation and tried to do a search with the example you gave, but it seems that it's not working quite right. Mainly this code Cb.job.search({ location: 'Atlanta' }).results.model.jobs.each do |job| puts "Job Details: #{job.company_name} - #{job.title}" end Running this gives me NoMethodError: undefined method search for Cb::Clients::Job:Class

I like what it looks like this gem can offer, but I am unable to use your gem without having to retrofit a solution. Any suggestions for getting up and running?

tkling commented 7 years ago

Hey @L33tH4x0r, I'll take a stab at updating our readme over the next day or two, sorry for this hiccup! We've changed this gem a million times since the readme was originally put together, and in our rush of updates we rarely went back to update any info to reflect the changes :(

L33tH4x0r commented 7 years ago

Ah ok no worries! I'll keep an eye on it, looks good otherwise

frankolson commented 7 years ago

I am having trouble with initializing a client for job searching as well, @tkling could you possibly answer his question in a comment on this issue? This way we can still work while the documentation is being updated.

tkling commented 7 years ago

@frankolson You bet! Unfortunately it looks like we've removed the older dev-key-powered way of doing job searches in favor of our newer internal auth paradigm - using oauth tokens. The unfortunate part about that is we don't really have a process set up by which public non-partners can request client credentials to use CB oauth infrastructure.

Just for reference, here's what it looks like when you do have the ability to request oauth tokens:

# No initialization/configuration of the gem is needed 
Cb::Clients::JobSearch.get keywords: 'ruby', oauth_token: oauth_bearer_token_string
# => {"total_pages"=>39,
# "total_count"=>967,
# "first_item_index"=>1,
# "last_item_index"=>25,
# "data"=>
#  {"results"=>
#    [{"distance"=>"",
#      "location"=>"US-NY-New York",
#      "hostsite"=>"US",
#      "job_branding_icons"=>"",
#      "id"=>"J5L5HJ61FMFCTYL2XPH",
#      "job_title"=>"Sr. Software Engineer - Ruby, Rails",
# ...

While potentially helpful to the few corporate partners out in the wild that can use CB oauth credentials, the above info is not very helpful for those out in the world that have legacy dev keys and need to make job searches using our APIs. With that in mind, I'm going to whip up a quick PR to add a way to do dev-key powered searches using this gem. That path is officially deprecated in favor of using the oauth-powered infra, but it doesn't feel right to me to have a public gem that can't do the "main" function of our public APIs - performing job searches.

@frankolson @L33tH4x0r I will cc you both on the PR when it opens so you can at least see the branch name if you'd like to use the legacy functionality before it hits master and gets published.