mirror of
https://github.com/fog/fog.git
synced 2022-11-09 13:51:43 -05:00
[core] coerce service credentials
This commit is contained in:
parent
cea6fd3edf
commit
4f466e2672
1 changed files with 19 additions and 0 deletions
|
@ -56,6 +56,7 @@ module Fog
|
|||
end
|
||||
|
||||
validate_options(options)
|
||||
coerce_options(options)
|
||||
setup_requirements
|
||||
|
||||
if Fog.mocking?
|
||||
|
@ -114,6 +115,24 @@ module Fog
|
|||
@collections ||= []
|
||||
end
|
||||
|
||||
def coerce_options(options)
|
||||
options.each do |key, value|
|
||||
value_string = value.to_s.downcase
|
||||
if value == value_string.to_i.to_s
|
||||
options[key] = value.to_i
|
||||
else
|
||||
options[key] = case value_string
|
||||
when 'false'
|
||||
false
|
||||
when 'true'
|
||||
true
|
||||
else
|
||||
value
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def mocked_requests
|
||||
@mocked_requests ||= []
|
||||
end
|
||||
|
|
Loading…
Reference in a new issue