Sha256: 9c8092f38c02e02d7ccf388f0001aa605562cbc274fa2fef5aeb2a9b1d603c8e
Contents?: true
Size: 857 Bytes
Versions: 3
Compression:
Stored size: 857 Bytes
Contents
# frozen_string_literal: true require "tainbox" require "rabbit/receiving/malformed_message" module Rabbit::Receiving class Message include Tainbox attribute :group_id attribute :project_id attribute :event attribute :data attribute :original_message attr_accessor :original_message def self.build(message, type:, app_id:, **) group_id, project_id = app_id.split(".") new(group_id: group_id, project_id: project_id, event: type, data: message) end def data=(value) self.original_message = value super(JSON.parse(value).deep_symbolize_keys) rescue JSON::ParserError => error mark_as_malformed!("JSON::ParserError: #{error.message}") end def mark_as_malformed!(errors = "Error not specified") MalformedMessage.raise!(self, errors, caller(1)) end end end
Version data entries
3 entries across 3 versions & 1 rubygems
Version | Path |
---|---|
rabbit_messaging-0.7.1 | lib/rabbit/receiving/message.rb |
rabbit_messaging-0.7.0 | lib/rabbit/receiving/message.rb |
rabbit_messaging-0.6.0 | lib/rabbit/receiving/message.rb |