Raghav
Raghav

Reputation: 207

linkedin people search api usage with Ruby on rails

I tried using the following code to perform a people search in LinkedIn with ruby on rails:

client.search(
  :fields => [{ :people => %w(id first-name last-name api-standard-profile-request)}],
  :first-name =>  params["first_name"]
)

When executed it gives the following error:

undefined local variable or method 'name' for #<JobsController:0x00000004888d68>

What is the problem?

Upvotes: 0

Views: 491

Answers (1)

user672118
user672118

Reputation:

The problem has to do with this line.

:first-name => params["first_name"]

In Ruby you can only have a minus sign in a symbol if the symbol is surrounded with quotes. So instead of writing the symbol as :first-name, we would have to write it as :'first-name'. So our new code would be...

client.search(
  :fields => [{ :people => %w(id first-name last-name api-standard-profile-request)}],
  :'first-name' =>  params["first_name"]
)

Upvotes: 1

Related Questions