Class: SpreeCmCommissioner::Integrations::Larryta::Resources::BookingSession
- Inherits:
-
Base
- Object
- Base
- SpreeCmCommissioner::Integrations::Larryta::Resources::BookingSession
- Defined in:
- app/services/spree_cm_commissioner/integrations/larryta/resources/booking_session.rb
Overview
Represents a booking session from Larryta API (seat selection response)
Instance Attribute Summary collapse
-
#booking_code ⇒ Object
Returns the value of attribute booking_code.
-
#msg ⇒ Object
Returns the value of attribute msg.
-
#session_token ⇒ Object
Returns the value of attribute session_token.
-
#status ⇒ Object
Returns the value of attribute status.
Instance Method Summary collapse
-
#error_message ⇒ Object
Returns the error message if failed.
-
#failed? ⇒ Boolean
Returns true if the session failed.
-
#initialize(data) ⇒ BookingSession
constructor
rubocop:disable Lint/MissingSuper.
-
#success? ⇒ Boolean
Returns true if the session was created successfully.
-
#to_h ⇒ Object
Returns a hash representation.
Methods inherited from Base
Constructor Details
#initialize(data) ⇒ BookingSession
rubocop:disable Lint/MissingSuper
6 7 8 9 10 11 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/resources/booking_session.rb', line 6 def initialize(data) # rubocop:disable Lint/MissingSuper @session_token = data['session_token'] @booking_code = data['booking_code'] @status = data['status'] @msg = data['msg'] end |
Instance Attribute Details
#booking_code ⇒ Object
Returns the value of attribute booking_code.
4 5 6 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/resources/booking_session.rb', line 4 def booking_code @booking_code end |
#msg ⇒ Object
Returns the value of attribute msg.
4 5 6 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/resources/booking_session.rb', line 4 def msg @msg end |
#session_token ⇒ Object
Returns the value of attribute session_token.
4 5 6 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/resources/booking_session.rb', line 4 def session_token @session_token end |
#status ⇒ Object
Returns the value of attribute status.
4 5 6 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/resources/booking_session.rb', line 4 def status @status end |
Instance Method Details
#error_message ⇒ Object
Returns the error message if failed
24 25 26 27 28 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/resources/booking_session.rb', line 24 def return msg if failed? nil end |
#failed? ⇒ Boolean
Returns true if the session failed
19 20 21 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/resources/booking_session.rb', line 19 def failed? !success? end |
#success? ⇒ Boolean
Returns true if the session was created successfully
14 15 16 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/resources/booking_session.rb', line 14 def success? status == true && session_token.present? end |
#to_h ⇒ Object
Returns a hash representation
31 32 33 34 35 36 37 38 39 40 41 |
# File 'app/services/spree_cm_commissioner/integrations/larryta/resources/booking_session.rb', line 31 def to_h { session_token: session_token, booking_code: booking_code, success: success?, failed: failed?, error_message: , status: status, message: msg } end |