Class: SeatSelector::Parser
- Inherits:
-
Object
- Object
- SeatSelector::Parser
- Defined in:
- lib/seat_selector/parser.rb
Defined Under Namespace
Classes: UnprocessableEntity
Class Method Summary collapse
Class Method Details
.parse(json_str) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 |
# File 'lib/seat_selector/parser.rb', line 8 def self.parse(json_str) begin obj = JSON.parse(json_str) seats = build_available_seats(obj.fetch("seats").values) layout = obj.fetch("venue").fetch("layout") rows = layout.fetch("rows") columns = layout.fetch("columns") venue = Venue.new(seats, rows, columns) Finder.new(venue) rescue StandardError raise UnprocessableEntity end end |