Reputation: 51
I'm trying to send a HTTP GET request to a Google API that requires a parameter with the name "end-date" (with a hypen, not underscore). However, the following error gets thrown:
unexpected keyword_end, expecting '}'
end-date: '2013-07-24'
Here's the code that I'm trying to use:
request = Typhoeus::Request.new(
'https://www.googleapis.com/analytics/v1/reports',
method: :get,
params: {
end-date: '2013-07-24',
start-date: '2013-07-01',
access_token: access_token
}
)
Any way to make params: accept the hyphenated names? Thanks!
Upvotes: 1
Views: 1606
Reputation: 114237
You have to use the "old" hash notation for those keys:
params: {
:'end-date' => '2013-07-24',
:'start-date' => '2013-07-01',
access_token: access_token
}
Upvotes: 1