Module: NetDNARWS::Utils
- Included in:
- NetDNA
- Defined in:
- lib/netdnarws.rb
Constant Summary collapse
- RESERVED_CHARACTERS =
/[^a-zA-Z0-9\-\.\_\~]/
Instance Method Summary collapse
Instance Method Details
#encode_params(params = {}) ⇒ Object
15 16 17 |
# File 'lib/netdnarws.rb', line 15 def encode_params params={} Hash[params.map { |k, v| [escape(k), escape(v)] }] end |
#escape(value) ⇒ Object
9 10 11 12 13 |
# File 'lib/netdnarws.rb', line 9 def escape(value) URI::escape(value.to_s, NetDNARWS::Utils::RESERVED_CHARACTERS) rescue ArgumentError URI::escape(value.to_s.force_encoding(Encoding::UTF_8), NetDNARWS::Utils::RESERVED_CHARACTERS) end |