Class: Peddler::Operation Private

Inherits:
SimpleDelegator
  • Object
show all
Defined in:
lib/peddler/operation.rb

This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.

Instance Method Summary collapse

Constructor Details

#initialize(action) ⇒ Operation

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.

Returns a new instance of Operation.



8
9
10
# File 'lib/peddler/operation.rb', line 8

def initialize(action)
  super('Action' => action)
end

Instance Method Details

#store(key, val) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



24
25
26
27
28
29
# File 'lib/peddler/operation.rb', line 24

def store(key, val)
  key = camelize(key) if key.is_a?(Symbol)
  val = val.iso8601 if val.respond_to?(:iso8601)

  __getobj__.store(key, val)
end

#structure!(*list_keys) ⇒ Object

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



12
13
14
15
16
17
18
19
20
21
22
# File 'lib/peddler/operation.rb', line 12

def structure!(*list_keys)
  list_key = list_keys.first

  if has_key?(list_key)
    builder = StructuredList.new(*list_keys)
    vals = delete(list_key)
    update(builder.build(vals))
  end

  self
end

#update(hsh) ⇒ Object Also known as: add

This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.



31
32
33
34
# File 'lib/peddler/operation.rb', line 31

def update(hsh)
  hsh.each { |key, val| store(key, val) }
  self
end