mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
Allowed setting of params as k/v pairs.
This is needed for setting the request body for create/update calls.
This commit is contained in:
parent
4331d171ee
commit
847712e0ae
1 changed files with 7 additions and 1 deletions
|
@ -47,6 +47,7 @@ module Fog
|
|||
"Accept" => "application/json"
|
||||
}
|
||||
)
|
||||
params[:body] = encode_pairs(params[:options]) unless params[:options].nil?
|
||||
response = @connection.request(params)
|
||||
|
||||
raise_if_error!(response)
|
||||
|
@ -56,6 +57,11 @@ module Fog
|
|||
response
|
||||
end
|
||||
|
||||
def encode_pairs(params)
|
||||
params.keys.collect do |key|
|
||||
"#{key} #{params[key]}"
|
||||
end.join("\n")
|
||||
end
|
||||
|
||||
def raise_if_error!(response)
|
||||
case response.status
|
||||
|
|
Loading…
Add table
Reference in a new issue