lib/wordnik/request.rb in wordnik-0.3.7 vs lib/wordnik/request.rb in wordnik-0.3.8
- old
+ new
@@ -87,12 +87,13 @@
# .. stringifying values so Addressable doesn't blow up.
# .. obfuscating the API key if needed.
def query_string_params(obfuscated=false)
qsp = {}
self.params.each_pair do |key, value|
- next if self.path.include? "{#{key}}"
- next if value.blank?
- value = "YOUR_API_KEY" if key.to_sym == :api_key && obfuscated
+ next if self.path.include? "{#{key}}" # skip path params
+ next if value.blank? # skip empties
+ value = "YOUR_API_KEY" if key.to_sym == :api_key && obfuscated # obscure the API key
+ key = key.to_s.camelize(:lower).to_sym unless key.to_sym == :api_key # api_key is not a camelCased param
qsp[key] = value.to_s
end
qsp
end
\ No newline at end of file