1

我试图让我的用户向 Fitbit API 发出 GET 请求。目前用户拥有他们所有的令牌,但我正在努力创建一个客户端。

用户控制器.rb

def show
@user = User.find(params[:id])
if (@user.device != nil)
  p "PRINTING DEVICES"
  p @user.device
  @device = @user.device

  @client = Fitgem::Client.new(
    :consumer_key => 'b4aacb5c2c8c43e2a6873877cd2ad9b1',
    :consumer_secret => '88bd78fc86d84d6c9aa7b1c0b8d4511f',
    :token => @device.oauth_token,
    :secret => @device.oauth_token_secret
  )
end
end

我收到的错误是:

        /Users/Marcus/Sites/Rails/rails_projects/BattleOfTheBands/app/controllers/users_controller.rb:        16: syntax error, unexpected tASSOC, expecting ')'
    :consumer_key => 'b4b1',
                    ^
    /Users/Marcus/Sites/Rails/rails_projects/BattleOfTheBands/app/controllers/users_controller.rb:16: syntax error, unexpected ',', expecting keyword_end
    /Users/Marcus/Sites/Rails/rails_projects/BattleOfTheBands/app/controllers/users_controller.rb:17: syntax error, unexpected ',', expecting keyword_end
    /Users/Marcus/Sites/Rails/rails_projects/BattleOfTheBands/app/controllers/users_controller.rb:19: syntax error, unexpected tASSOC, expecting tCOLON2 or '[' or '.'
    :secret => @device.oauth_token_secret
              ^
    /Users/Marcus/Sites/Rails/rails_projects/BattleOfTheBands/app/controllers/users_controller.rb:21: syntax error, unexpected ')', expecting keyword_end
    /Users/Marcus/Sites/Rails/rails_projects/BattleOfTheBands/app/controllers/users_controller.rb:86: syntax error, unexpected $end, expecting keyword_end
4

0 回答 0