我正在尝试让我的用户向Fitbit API发出GET请求。目前用户拥有所有令牌,但我很难创建客户端。
User_controller.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