Skip to content

Commit

Permalink
build message fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
raghuramg committed Dec 19, 2023
1 parent 085359f commit 669a93a
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
4 changes: 2 additions & 2 deletions lib/event_source/message.rb
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ def initialize(options = {})
private

def build_message(options)
result = EventSource::Operations::BuildMessageOptions.call(options)
result = EventSource::Operations::BuildMessageOptions.new.call(options)
raise "unable to build message options due to #{result.failure}" unless result.success?
result.success
end

def create_message(options)
result = EventSource::Operations::CreateMessage.call(options)
result = EventSource::Operations::CreateMessage.new.call(options)
raise "unable to create message due to #{result.failure}" unless result.success?
result.success
end
Expand Down
6 changes: 3 additions & 3 deletions lib/event_source/operations/build_message_options.rb
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@ def call(params)

def build_options(params)
message_attributes = {
payload: params[:attributes].symbolize_keys,
headers: params[:headers].symbolize_keys
payload: params[:attributes]&.symbolize_keys || {},
headers: params[:headers]&.symbolize_keys || {}
}

message_attributes[:payload][:message_id] ||= SecureRandom.uuid
Expand All @@ -48,7 +48,7 @@ def fetch_session_options(message_attributes)
else
message_attributes[:payload].merge!(
account_id: system_account&.id
)
) if defined?(system_account)
end

# Create system account user <admin@dc.gov> when session is not available
Expand Down

0 comments on commit 669a93a

Please sign in to comment.