Module: CommandTower::Deserializers::Clients::Payload

Defined in:
app/deserializers/command_tower/deserializers/clients/payload.rb

Overview

Payload key extraction that distinguishes absent keys from explicit nil.

Class Method Summary collapse

Class Method Details

.fetch(payload, key) ⇒ Object



10
11
12
13
14
15
16
17
# File 'app/deserializers/command_tower/deserializers/clients/payload.rb', line 10

def fetch(payload, key)
  unless payload.is_a?(Hash)
    raise ::CommandTower::Clients::Errors::ConfigurationError,
          "Deserializers::Clients::Payload.fetch expects a Hash payload"
  end

  payload.fetch(key, Missing)
end