Skip to content

Instantly share code, notes, and snippets.

@ahmetabdi
Created February 20, 2016 22:35
Show Gist options
  • Save ahmetabdi/7e3d9d9b1671dea3ea60 to your computer and use it in GitHub Desktop.
Save ahmetabdi/7e3d9d9b1671dea3ea60 to your computer and use it in GitHub Desktop.
Odeon API Notes
seating_data = "113|120|120|20|20|1|0|114|2;114|140|120|20|20|1|113|115|2;115|160|120|20|20|1|114|116|2;116|180|120|20|20|1|115|117|2;117|200|120|20|20|1|116|118|2;118|220|120|20|20|1|117|119|2;119|240|120|20|20|1|118|120|2;120|260|120|20|20|1|119|121|2;121|280|120|20|20|1|120|122|2;122|300|120|20|20|1|121|123|2;123|320|120|20|20|1|122|124|2;124|340|120|20|20|1|123|125|2;125|360|120|20|20|1|124|126|2;126|380|120|20|20|1|125|127|2;127|400|120|20|20|4|126|128|2;128|420|120|20|20|4|127|129|2;129|440|120|20|20|4|128|130|2;130|460|120|20|20|4|129|0|2;131|120|140|20|20|1|0|132|2;132|140|140|20|20|1|131|133|2;133|160|140|20|20|1|132|134|2;134|180|140|20|20|1|133|135|2;135|200|140|20|20|1|134|136|2;136|220|140|20|20|1|135|137|2;137|240|140|20|20|1|136|138|2;138|260|140|20|20|1|137|139|2;139|280|140|20|20|1|138|140|2;140|300|140|20|20|1|139|141|2;141|320|140|20|20|1|140|142|2;142|340|140|20|20|1|141|143|2;143|360|140|20|20|1|142|144|2;144|380|140|20|20|1|143|145|2;145|400|140|20|20|1|144|146|2;146|420|140|20|20|1|145|147|2;147|440|140|20|20|1|146|148|2;148|460|140|20|20|1|147|0|2;149|120|160|20|20|1|0|150|2;150|140|160|20|20|1|149|151|2;151|160|160|20|20|1|150|152|2;152|180|160|20|20|1|151|153|2;153|200|160|20|20|1|152|154|2;154|220|160|20|20|1|153|155|2;155|240|160|20|20|1|154|156|2;156|260|160|20|20|1|155|157|2;157|280|160|20|20|1|156|158|2;158|300|160|20|20|1|157|159|2;159|320|160|20|20|1|158|160|2;160|340|160|20|20|1|159|161|2;161|360|160|20|20|1|160|162|2;162|380|160|20|20|1|161|163|2;163|400|160|20|20|1|162|164|2;164|420|160|20|20|1|163|165|2;165|440|160|20|20|1|164|166|2;166|460|160|20|20|1|165|0|2;167|120|180|20|20|1|0|168|2;168|140|180|20|20|1|167|169|2;169|160|180|20|20|1|168|170|2;170|180|180|20|20|1|169|171|2;171|200|180|20|20|1|170|172|2;172|220|180|20|20|1|171|173|2;173|240|180|20|20|1|172|174|2;174|260|180|20|20|1|173|175|2;175|280|180|20|20|1|174|176|2;176|300|180|20|20|1|175|177|2;177|320|180|20|20|1|176|178|2;178|340|180|20|20|1|177|179|2;179|360|180|20|20|1|178|180|2;180|380|180|20|20|1|179|181|2;181|400|180|20|20|1|180|182|2;182|420|180|20|20|1|181|183|2;183|440|180|20|20|1|182|184|2;184|460|180|20|20|1|183|0|2"
rows = seating_data.split(";")
rows.each do |row|
row_data = row.split("|")
seat_number = row_data[0]
x_position = row_data[1]
y_position = row_data[2]
width = row_data[3]
height = row_data[4]
type = row_data[5]
neighbour_left = row_data[6]
neightbour_right = row_data[7]
state = row_data[8]
end
BookingSeat Model
----
Types:
REGULAR = 1
LOVE = 2
WHEELCHAIR = 3
HOUSE = 4
REMOVEABLE = 5
else UNKNOWN
is_occupied()
return isSpecialSeat() || isBookedOrReserved()
isSpecialSeat()
return (type.equals(REGULAR) || type.equals(LOVE) || type.equals(WHEELCHAIR)) ? false : true
isBookedOrReserved()
return this.state != State.free
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment