Skip to content

Commit

Permalink
Added logic to support both string and symbol access to keys in dialo…
Browse files Browse the repository at this point in the history
  • Loading branch information
gtanzillo committed Apr 3, 2019
1 parent a0ce54f commit ad3c892
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion lib/services/api/request_parser.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,11 @@ def self.parse_user(data)

def self.parse_options(data)
raise BadRequestError, "Request is missing options" if data["options"].blank?
data["options"].deep_symbolize_keys
# Need to preserve string keys in dialog sub-hash while still supporting access by symbols
dialog = data["options"].delete("dialog")
data["options"].deep_symbolize_keys.tap do |hash|
hash[:dialog] = dialog.with_indifferent_access if dialog.present?
end
end

def self.parse_auto_approve(data)
Expand Down

0 comments on commit ad3c892

Please sign in to comment.