Class: Centaman::Service::TicketType
- Inherits:
-
Centaman::Service
- Object
- Wrapper
- Centaman::Service
- Centaman::Service::TicketType
- Includes:
- JsonWrapper
- Defined in:
- lib/centaman/service/ticket_type.rb
Constant Summary collapse
- DISCOUNT =
0.0
Constants inherited from Centaman::Service
Constants inherited from Wrapper
Instance Attribute Summary collapse
-
#booking_time_id ⇒ Object
readonly
Returns the value of attribute booking_time_id.
Attributes inherited from Wrapper
#api_password, #api_token, #api_username
Instance Method Summary collapse
- #after_init(args) ⇒ Object
- #build_objects(resp) ⇒ Object
- #endpoint ⇒ Object
- #object_class ⇒ Object
- #objects ⇒ Object
- #options ⇒ Object
-
#require_args ⇒ Object
rubocop:enable Metrics/MethodLength.
-
#sample_response ⇒ Object
rubocop:disable Metrics/MethodLength.
Methods included from JsonWrapper
#additional_hash_to_serialize_after_response, #build_object
Methods inherited from Centaman::Service
#after_post, #fetch_all, #payload, #payload_key, #post, #wrap_request_in_case_of_timeout
Methods inherited from Wrapper
#generate_token, #headers, #initialize, #options_hash
Constructor Details
This class inherits a constructor from Centaman::Wrapper
Instance Attribute Details
#booking_time_id ⇒ Object (readonly)
Returns the value of attribute booking_time_id.
6 7 8 |
# File 'lib/centaman/service/ticket_type.rb', line 6 def booking_time_id @booking_time_id end |
Instance Method Details
#after_init(args) ⇒ Object
8 9 10 11 |
# File 'lib/centaman/service/ticket_type.rb', line 8 def after_init(args) @booking_time_id = args[:booking_time_id] require_args end |
#build_objects(resp) ⇒ Object
17 18 19 20 21 22 |
# File 'lib/centaman/service/ticket_type.rb', line 17 def build_objects(resp) ticket_types = super(resp) # need to trigger the price method to have it returned in json ticket_types.each(&:price) ticket_types end |
#endpoint ⇒ Object
13 14 15 |
# File 'lib/centaman/service/ticket_type.rb', line 13 def endpoint '/ticket_services/TimedTicket' end |
#object_class ⇒ Object
24 25 26 |
# File 'lib/centaman/service/ticket_type.rb', line 24 def object_class Centaman::Object::TicketType end |
#objects ⇒ Object
34 35 36 |
# File 'lib/centaman/service/ticket_type.rb', line 34 def objects Rails.env.test? ? build_objects(sample_response) : super end |
#options ⇒ Object
28 29 30 31 32 |
# File 'lib/centaman/service/ticket_type.rb', line 28 def super + [ { key: "TimedTicketTypeId", value: booking_time_id } ] end |
#require_args ⇒ Object
rubocop:enable Metrics/MethodLength
93 94 95 |
# File 'lib/centaman/service/ticket_type.rb', line 93 def require_args raise "booking_time_id is required for #{self.class.name}" if booking_time_id.nil? end |
#sample_response ⇒ Object
rubocop:disable Metrics/MethodLength
39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 |
# File 'lib/centaman/service/ticket_type.rb', line 39 def sample_response # when passing a timed_booking_time_id [ { 'TicketId'=>504, 'TicketDescription'=>' Adult 19 64yrs online w tax 42 56 90m', 'TicketPrice'=>42.56, 'TicketBookingFee'=>0.0, 'TicketFeeItemId'=>501, 'DepositPercentage'=>100.0, 'IsTaxInclusive'=>true, 'TaxPercentage'=>12.0 }, { 'TicketId'=>505, 'TicketDescription'=>' Senior 65yrs online w tax 35 84 90m', 'TicketPrice'=>35.84, 'TicketBookingFee'=>0.0, 'TicketFeeItemId'=>501, 'DepositPercentage'=>100.0, 'IsTaxInclusive'=>true, 'TaxPercentage'=>12.0}, { 'TicketId'=>506, 'TicketDescription'=>' Youth 7 18yrs online w tax 17 92 90m', 'TicketPrice'=>17.92, 'TicketBookingFee'=>0.0, 'TicketFeeItemId'=>501, 'DepositPercentage'=>100.0, 'IsTaxInclusive'=>true, 'TaxPercentage'=>12.0}, { 'TicketId'=>524, 'TicketDescription'=>' Child 7years accompanying booking ', 'TicketPrice'=>0.0, 'TicketBookingFee'=>0.0, 'TicketFeeItemId'=>501, 'DepositPercentage'=>100.0, 'IsTaxInclusive'=>true, 'TaxPercentage'=>12.0}, { 'TicketId'=>630, 'TicketDescription'=>'Percent Pound Two Adult Ticket Groupon Special ', 'TicketPrice'=>85.12, 'TicketBookingFee'=>0.0, 'TicketFeeItemId'=>0, 'DepositPercentage'=>100.0, 'IsTaxInclusive'=>true, 'TaxPercentage'=>12.0 } ] end |