【问题标题】:What's wrong with my LinkedIn API call syntax?我的 LinkedIn API 调用语法有什么问题?
【发布时间】:2015-04-04 12:59:56
【问题描述】:

我使用omniauth 来访问配置文件,虽然我已经设置了linkedin gem 并使用了omniauth 的访问令牌,以便我可以单独拉取以访问不同的图片大小。

这是我的代码:

  client = LinkedIn::Client.new
  client.authorize_from_access(auth.extra.access_token.token, auth.extra.access_token.secret)
  linkedinpicture = client.profile.picture-urls::(original)

这不起作用,它返回一个错误

undefined local variable or method 'urls'

但同时我知道 API 调用者正在工作,因为如果我访问用户标题 (client.profile.headline) 而不是他们的图片网址,那么它工作正常。是我需要正确格式化的语法吗?我猜它不喜欢 '-' 字符。

这是我引用的 LinkedIn 文档:https://developer.linkedin.com/docs/fields/basic-profile

任何想法都会很棒。

【问题讨论】:

  • 你应该检查提供 LinkedIn 模块的 gem

标签: ruby-on-rails linkedin omniauth


【解决方案1】:

代替:

linkedinpicture = client.profile.picture-urls::(original)

试试:

linkedinpicture = client.picture_urls(:id => 'id_of_connection')

查看https://github.com/hexgnu/linkedin/blob/c0ec6a6960f21fcd428916c53b3c229907a7af79/lib/linked_in/api/people.rb#L56-L70获取相关的gem代码。

【讨论】:

    猜你喜欢
    • 2016-10-05
    • 2016-05-03
    • 1970-01-01
    • 2021-08-02
    • 2011-02-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多