lib/aliyun/ecs.rb in aliyun-api-0.0.5 vs lib/aliyun/ecs.rb in aliyun-api-0.0.6
- old
+ new
@@ -16,20 +16,11 @@
end
def method_missing(method_name, *args)
super if /[A-Z]/ =~ method_name.to_s
method_name = method_name.to_s.split('_').map{|w| w.capitalize }.join('').gsub '_',''
- params={}
- if args[0]
- args[0].each do |k,v|
- if /[A-Z]/ !~ k.to_s
- key=k.to_s.split('_').map{|w| w.capitalize }.join('').gsub '_',''
- params[key]=v
- end
- end
- end
- proxy_to_aliyun(method_name, params)
+ proxy_to_aliyun(method_name, args[0])
end
private
def proxy_to_aliyun(method_name, params)
params = build_request_parameters method_name, params
@@ -43,9 +34,15 @@
end
end
def build_request_parameters(method_name, params={})
params = Aliyun[:request_parameters].merge(params||{})
+ params.keys.each do |k|
+ if /[A-Z]/ !~ k.to_s
+ key=k.to_s.split('_').map{|w| w.capitalize }.join('').gsub('_','').to_sym
+ params[key] = params.delete k
+ end
+ end
params.merge!({
:AccessKeyId => Aliyun[:access_key_id],
:Action => method_name.to_s,
:SignatureNonce => SecureRandom.uuid,
:TimeStamp => Time.now.utc.iso8601