Class: SpreeCmCommissioner::Integrations::BookMeBusV1::Resources::ReservationCart
- Inherits:
-
Base
- Object
- Base
- SpreeCmCommissioner::Integrations::BookMeBusV1::Resources::ReservationCart
- Defined in:
- app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/reservation_cart.rb
Defined Under Namespace
Classes: Reservation
Instance Attribute Summary collapse
-
#amount ⇒ Object
Returns the value of attribute amount.
-
#discount ⇒ Object
Returns the value of attribute discount.
-
#fare ⇒ Object
Returns the value of attribute fare.
-
#id ⇒ Object
Returns the value of attribute id.
-
#reservation_cart_number ⇒ Object
Returns the value of attribute reservation_cart_number.
-
#reservations ⇒ Object
Returns the value of attribute reservations.
-
#status ⇒ Object
Returns the value of attribute status.
-
#ticket_type ⇒ Object
Returns the value of attribute ticket_type.
-
#time_to_cancel_in_sec ⇒ Object
Returns the value of attribute time_to_cancel_in_sec.
-
#type ⇒ Object
Returns the value of attribute type.
Instance Method Summary collapse
- #first_reservation ⇒ Object
-
#initialize(attributes = {}) ⇒ ReservationCart
constructor
A new instance of ReservationCart.
- #to_h ⇒ Object
Methods inherited from Base
from_json_api, from_json_api_item, from_json_api_single
Constructor Details
#initialize(attributes = {}) ⇒ ReservationCart
Returns a new instance of ReservationCart.
14 15 16 17 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/reservation_cart.rb', line 14 def initialize(attributes = {}) super(attributes) @reservations = parse_reservations(attributes['reservations']) end |
Instance Attribute Details
#amount ⇒ Object
Returns the value of attribute amount.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/reservation_cart.rb', line 3 def amount @amount end |
#discount ⇒ Object
Returns the value of attribute discount.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/reservation_cart.rb', line 3 def discount @discount end |
#fare ⇒ Object
Returns the value of attribute fare.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/reservation_cart.rb', line 3 def fare @fare end |
#id ⇒ Object
Returns the value of attribute id.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/reservation_cart.rb', line 3 def id @id end |
#reservation_cart_number ⇒ Object
Returns the value of attribute reservation_cart_number.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/reservation_cart.rb', line 3 def reservation_cart_number @reservation_cart_number end |
#reservations ⇒ Object
Returns the value of attribute reservations.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/reservation_cart.rb', line 3 def reservations @reservations end |
#status ⇒ Object
Returns the value of attribute status.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/reservation_cart.rb', line 3 def status @status end |
#ticket_type ⇒ Object
Returns the value of attribute ticket_type.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/reservation_cart.rb', line 3 def ticket_type @ticket_type end |
#time_to_cancel_in_sec ⇒ Object
Returns the value of attribute time_to_cancel_in_sec.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/reservation_cart.rb', line 3 def time_to_cancel_in_sec @time_to_cancel_in_sec end |
#type ⇒ Object
Returns the value of attribute type.
3 4 5 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/reservation_cart.rb', line 3 def type @type end |
Instance Method Details
#first_reservation ⇒ Object
19 20 21 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/reservation_cart.rb', line 19 def first_reservation reservations&.first end |
#to_h ⇒ Object
23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'app/services/spree_cm_commissioner/integrations/book_me_bus_v1/resources/reservation_cart.rb', line 23 def to_h { 'id' => id, 'reservation_cart_number' => reservation_cart_number, 'amount' => amount, 'fare' => fare, 'discount' => discount, 'status' => status, 'ticket_type' => ticket_type, 'time_to_cancel_in_sec' => time_to_cancel_in_sec, 'reservations' => reservations&.map(&:to_h) }.compact end |