lib/sucker/parameters.rb in sucker-1.3.0.pre.2 vs lib/sucker/parameters.rb in sucker-1.3.0.pre.3
- old
+ new
@@ -1,25 +1,21 @@
-# encoding: utf-8
-
-require 'active_support/inflector'
-
-module Sucker #:nodoc:
-
- class Parameters < Hash #:nodoc:
+module Sucker
+ class Parameters < Hash
API_VERSION = '2010-11-01'
SERVICE = 'AWSECommerceService'
def initialize
self.store 'Service', SERVICE
self.store 'Version', API_VERSION
self.store 'Timestamp', timestamp
end
+ # Ensures all keys and values are strings and camelizes former.
def normalize
inject({}) do |hash, kv|
k, v = kv
v = v.is_a?(Array) ? v.join(',') : v.to_s
- hash[k.to_s.camelize] = v
+ hash[k.to_s.split('_').map {|w| w[0, 1] = w[0, 1].upcase; w }.join] = v
hash
end
end
private