Class: Peddler::Request::Parameters
- Inherits:
-
SimpleDelegator
- Object
- SimpleDelegator
- Peddler::Request::Parameters
- Defined in:
- lib/peddler/request/parameters.rb
Instance Method Summary collapse
- #camelize_keys! ⇒ Object
- #format_structured_lists! ⇒ Object
-
#initialize(action) ⇒ Parameters
constructor
A new instance of Parameters.
- #timestamp! ⇒ Object
- #update(hsh) ⇒ Object
Constructor Details
#initialize(action) ⇒ Parameters
Returns a new instance of Parameters.
9 10 11 |
# File 'lib/peddler/request/parameters.rb', line 9 def initialize(action) super({ 'Action' => camelize(action) }) end |
Instance Method Details
#camelize_keys! ⇒ Object
33 34 35 36 37 38 39 40 41 42 |
# File 'lib/peddler/request/parameters.rb', line 33 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 |
#format_structured_lists! ⇒ Object
21 22 23 24 25 26 27 28 29 30 31 |
# File 'lib/peddler/request/parameters.rb', line 21 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 |
#timestamp! ⇒ Object
13 14 15 16 17 18 19 |
# File 'lib/peddler/request/parameters.rb', line 13 def each do |key, value| store(key, value.iso8601) if value.respond_to?(:iso8601) end self end |
#update(hsh) ⇒ Object
44 45 46 47 |
# File 'lib/peddler/request/parameters.rb', line 44 def update(hsh) __getobj__.update(hsh) self end |