Class: SpreeCmCommissioner::Integrations::Larryta::Resources::Seat
- Defined in:
- app/services/spree_cm_commissioner/integrations/larryta/resources/seat.rb
Instance Attribute Summary collapse
-
#booking ⇒ Object
Returns the value of attribute booking.
-
#check_value ⇒ Object
Returns the value of attribute check_value.
-
#column ⇒ Object
Returns the value of attribute column.
-
#external_class ⇒ Object
Returns the value of attribute external_class.
-
#label ⇒ Object
Returns the value of attribute label.
-
#loading ⇒ Object
Returns the value of attribute loading.
-
#row ⇒ Object
Returns the value of attribute row.
Instance Method Summary collapse
- #available? ⇒ Boolean
- #block_type ⇒ Object
- #booked? ⇒ Boolean
- #driver? ⇒ Boolean
-
#initialize(data) ⇒ Seat
constructor
rubocop:disable Lint/MissingSuper.
Methods inherited from Base
Constructor Details
#initialize(data) ⇒ Seat
rubocop:disable Lint/MissingSuper
5 6 7 8 9 10 11 12 13 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/resources/seat.rb', line 5 def initialize(data) # rubocop:disable Lint/MissingSuper @label = data['label'].to_s @external_class = data['class'] @check_value = data['check_value'] @booking = data['booking'] || [] @loading = data['loading'] @row = data['row'] @column = data['column'] end |
Instance Attribute Details
#booking ⇒ Object
Returns the value of attribute booking.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/resources/seat.rb', line 3 def booking @booking end |
#check_value ⇒ Object
Returns the value of attribute check_value.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/resources/seat.rb', line 3 def check_value @check_value end |
#column ⇒ Object
Returns the value of attribute column.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/resources/seat.rb', line 3 def column @column end |
#external_class ⇒ Object
Returns the value of attribute external_class.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/resources/seat.rb', line 3 def external_class @external_class end |
#label ⇒ Object
Returns the value of attribute label.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/resources/seat.rb', line 3 def label @label end |
#loading ⇒ Object
Returns the value of attribute loading.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/resources/seat.rb', line 3 def loading @loading end |
#row ⇒ Object
Returns the value of attribute row.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/resources/seat.rb', line 3 def row @row end |
Instance Method Details
#available? ⇒ Boolean
23 24 25 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/resources/seat.rb', line 23 def available? external_class == 'available' && booking.empty? end |
#block_type ⇒ Object
15 16 17 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/resources/seat.rb', line 15 def block_type driver? ? :driver : :seat end |
#booked? ⇒ Boolean
27 28 29 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/resources/seat.rb', line 27 def booked? !available? end |
#driver? ⇒ Boolean
19 20 21 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/resources/seat.rb', line 19 def driver? label.match?(/DR/i) end |