简体   繁体   中英

linkedIn gem - passing Accept-Language to get localized profile

I'm trying to understand how i can get localized profile from linkedIn.

i get my info like this:

  fields = ['first-name', 'last-name', 'headline', 'industry',   'num-connections','educations', 'num-recommenders','recommendations-received', 'summary', 'positions','picture-url']

  @profile = client.profile :fields => fields 

Everything works great, but i cannot find any doc on how to pass the locale.

From the linkedin api doc, i should pass an accpet-language in the header!

anyone tried this?

Regards

I tried overriding the default http-headers for the request helper of the gem, worked for me:

LinkedIn::Helpers::Request.const_set("DEFAULT_HEADERS",
      LinkedIn::Helpers::Request::DEFAULT_HEADERS.merge({
      'Accept-Language' => 'es-ES'
}))

Is ugly (redefining a constant) and throws a warning (it modifies a constant, so it becomes a global setting to all the requests using the linkedin gem) but it worked.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM