Class: Hanami::Lambda::Event Private

Inherits:
Object
  • Object
show all
Defined in:
lib/hanami/lambda/event.rb

Overview

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.

Base event class

Since:

  • 0.2.0

API:

  • private

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(event) ⇒ Hanami::Lambda::Event

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.

Parameters:

  • the raw event from AWS Lambda

Since:

  • 0.2.0

API:

  • private



17
18
19
20
21
# File 'lib/hanami/lambda/event.rb', line 17

def initialize(event)
  @raw = event
  @event = Hanami::Utils::Hash.deep_symbolize(@raw)
  freeze
end

Instance Attribute Details

#rawObject (readonly)

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.

Since:

  • 0.2.0

API:

  • private



11
12
13
# File 'lib/hanami/lambda/event.rb', line 11

def raw
  @raw
end

Instance Method Details

#[](key) ⇒ Object, NilClass

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.

Return the value of the given key

Parameters:

  • the key to fetch

Returns:

  • the associated value if found

Since:

  • 0.2.0

API:

  • private



30
31
32
# File 'lib/hanami/lambda/event.rb', line 30

def [](key)
  @event[key]
end

#get(*keys) ⇒ Object, NilClass Also known as: dig

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.

Return an value associated with the given event key

Parameters:

  • the keys to fetch

Returns:

  • the associated value if found

Since:

  • 0.2.0

API:

  • private



41
42
43
# File 'lib/hanami/lambda/event.rb', line 41

def get(*keys)
  @event.dig(*keys)
end

#to_hHash

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.

Return the hash of the event

Returns:

  • the hash of the event

Since:

  • 0.2.0

API:

  • private



51
52
53
# File 'lib/hanami/lambda/event.rb', line 51

def to_h
  @event
end