Sha256: 6b26851d01865261700127c0bd22e4bb75b6b93289be5f70a47ac1c601dcdad1
Contents?: true
Size: 1.04 KB
Versions: 2
Compression:
Stored size: 1.04 KB
Contents
module MWS module Orders module Helper class Parameters < SimpleDelegator def initialize(action) super({ 'Action' => camelize(action) }) end def timestamp! each do |key, value| store(key, value.iso8601) if value.respond_to?(:iso8601) end self end def format_structured_lists! lists = {} each do |key, value| if StructuredList.handle?(key) lists.update(StructuredList.new(key).build(delete(key))) end end update(lists) end def camelize_keys! keys.each do |key| if key.is_a?(Symbol) new_key = camelize(key) store(new_key, delete(key)) end end self end def update(hsh) __getobj__.update(hsh) self end private def camelize(sym) sym.to_s.split('_').map(&:capitalize).join end end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
mws-orders-0.0.2 | lib/mws/orders/helpers/parameters.rb |
mws-orders-0.0.1 | lib/mws/orders/helpers/parameters.rb |