Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/ionic-framework/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Ruby on rails cURL到Rails“-d”格式转换_Ruby On Rails_Ruby_Api_Curl_Ruby On Rails 4 - Fatal编程技术网

Ruby on rails cURL到Rails“-d”格式转换

Ruby on rails cURL到Rails“-d”格式转换,ruby-on-rails,ruby,api,curl,ruby-on-rails-4,Ruby On Rails,Ruby,Api,Curl,Ruby On Rails 4,您好,我正在使用StravaAPI和基于它构建的gem。我尝试执行的命令是: $ curl -G https://www.strava.com/api/v3/segments/explore \ -H "Authorization: Bearer 83ebeabdec09f6670863766f792ead24d61fe3f9" \ -d bounds=37.821362,-122.505373,37.842038,-122.465977 \ 如何格式化RubyonRails命令以发出请求。目

您好,我正在使用StravaAPI和基于它构建的gem。我尝试执行的命令是:

$ curl -G https://www.strava.com/api/v3/segments/explore \
-H "Authorization: Bearer 83ebeabdec09f6670863766f792ead24d61fe3f9" \
-d bounds=37.821362,-122.505373,37.842038,-122.465977 \
如何格式化RubyonRails命令以发出请求。目前:

@client.segment_explorer([37.821362,-122.505373,37.842038,-122.465977])
api gem的源代码如下所示:

    def segment_explorer(args = {}, options = {}, &block)
      # Fetches the connections for given object.
      api_call('segments/explore', args, 'get', options, &block)
    end

如何将-d作为经度传递到此方法以成功创建api调用?

您使用的是哪个gem?我进行了快速搜索,但在任何地方都找不到您引用的代码。但是,猜测一下,您可能希望尝试传递散列参数,其中它们的键与URL参数的名称相同

例如:

@client.segment_explorer({
    bounds: "37.821362,-122.505373,37.842038,-122.465977"
})
如果这不起作用,你能提供你正在使用的gem的链接吗