Sha256: 98bdff16519ad8955a95beb0e5e7d94ff6abf17390ce63170b4793f29f19c15a

Contents?: true

Size: 518 Bytes

Versions: 3

Compression:

Stored size: 518 Bytes

Contents

# frozen_string_literal: true

module Hahamut
  # Hahamut Webhook Event
  class Event
    include Support::Attributes

    attribute :botid, :string
    attribute :time, :timestamp

    def initialize(attributes)
      assign_attributes(attributes)

      @attributes[:messaging] ||= []
    end

    def messaging
      @attributes[:messaging]
    end

    def messaging=(messages)
      @attributes[:messaging] =
        messages
        &.map { |message| Message.parse(message) }
        &.compact
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
hahamut-0.1.2 lib/hahamut/event.rb
hahamut-0.1.1 lib/hahamut/event.rb
hahamut-0.1.0 lib/hahamut/event.rb