class Centaman::Service::TicketType

Constants

DISCOUNT

Attributes

booking_time_id[R]
cost_rate_id[R]

Public Instance Methods

additional_hash_to_serialize_after_response() click to toggle source
# File lib/centaman/service/ticket_type.rb, line 36
def additional_hash_to_serialize_after_response
  {
    booking_time_id: booking_time_id
  }
end
after_init(args) click to toggle source
# File lib/centaman/service/ticket_type.rb, line 8
def after_init(args)
  @booking_time_id = args[:booking_time_id]
  @cost_rate_id = args[:cost_rate_id]
  require_args
end
build_objects(resp) click to toggle source
Calls superclass method Centaman::JsonWrapper#build_objects
# File lib/centaman/service/ticket_type.rb, line 18
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() click to toggle source
# File lib/centaman/service/ticket_type.rb, line 14
def endpoint
  '/ticket_services/TimedTicket'
end
object_class() click to toggle source
# File lib/centaman/service/ticket_type.rb, line 25
def object_class
  Centaman::Object::TicketType
end
objects() click to toggle source
Calls superclass method Centaman::JsonWrapper#objects
# File lib/centaman/service/ticket_type.rb, line 42
def objects
  Rails.env.test? ? build_objects(sample_response) : super
end
options() click to toggle source
Calls superclass method
# File lib/centaman/service/ticket_type.rb, line 29
def options
  super + [
    { key: 'TimedTicketTypeId', value: booking_time_id },
    { key: 'CostRateId', value: cost_rate_id }
  ]
end
require_args() click to toggle source

rubocop:enable Metrics/MethodLength

# File lib/centaman/service/ticket_type.rb, line 101
def require_args
  raise "booking_time_id is required for #{self.class.name}" if booking_time_id.nil?
end
sample_response() click to toggle source

rubocop:disable Metrics/MethodLength

# File lib/centaman/service/ticket_type.rb, line 47
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