Sha256: b593a32b86b44931325bd64c60cfe33db32febdb3c47e2ad59332f2ae6e082c8
Contents?: true
Size: 1.02 KB
Versions: 4
Compression:
Stored size: 1.02 KB
Contents
require 'delegate' require 'time' require 'peddler/request/structured_list' module Peddler class Request 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
Version data entries
4 entries across 4 versions & 1 rubygems