class Centaman::Object::BookingTime

rubocop:disable Metrics/ClassLength

Attributes

sold_out[R]

Public Instance Methods

attributes() click to toggle source

rubocop:disable Metrics/MethodLength

# File lib/centaman/object/booking_time.rb, line 36
def attributes
  [
    Centaman::Attribute.new(
      centaman_key: 'TimedTicketTypeId',
      app_key: :id,
      type: :integer
    ),
    Centaman::Attribute.new(
      centaman_key: 'BookingTypeId',
      app_key: :booking_type_id,
      type: :integer
    ),
    Centaman::Attribute.new(
      centaman_key: 'BookingTypeDescription',
      app_key: :booking_type_description,
      type: :string
    ),
    Centaman::Attribute.new(
      centaman_key: 'TimedTicketTypeDescription',
      app_key: :description,
      type: :centaman_description
    ),
    Centaman::Attribute.new(
      centaman_key: 'StartDate',
      app_key: :start_date,
      type: :datetime
    ),
    Centaman::Attribute.new(
      centaman_key: 'StartTime',
      app_key: :start_time,
      type: :string
    ),
    Centaman::Attribute.new(
      centaman_key: 'EndTime',
      app_key: :end_time,
      type: :string
    ),
    Centaman::Attribute.new(
      centaman_key: 'StartTime',
      app_key: :display_start_time,
      type: :display_time
    ),
    Centaman::Attribute.new(
      centaman_key: 'EndTime',
      app_key: :display_end_time,
      type: :display_time
    ),
    Centaman::Attribute.new(
      centaman_key: 'Capacity',
      app_key: :capacity,
      type: :integer
    ),
    Centaman::Attribute.new(
      centaman_key: 'vacancy',
      app_key: :vacancy,
      type: :integer
    ),
    Centaman::Attribute.new(
      centaman_key: 'vacancy',
      app_key: :remaining,
      type: :integer
    ),
    Centaman::Attribute.new(
      centaman_key: 'Bookingfee',
      app_key: :booking_fee,
      type: :float
    ),
    Centaman::Attribute.new(
      centaman_key: 'BookingFeeItemCode',
      app_key: :booking_fee_item_code,
      type: :integer
    ),
    Centaman::Attribute.new(
      centaman_key: 'Cancelled',
      app_key: :cancelled,
      type: :boolean
    ),
    Centaman::Attribute.new(
      centaman_key: 'IsBookedExclusively',
      app_key: :is_booked_exclusively,
      type: :boolean
    )
  ]
end
define_variables(args) click to toggle source
Calls superclass method Centaman::Object#define_variables
# File lib/centaman/object/booking_time.rb, line 7
def define_variables(args)
  super
  @sold_out = vacancy <= 0 || is_booked_exclusively
end
json() click to toggle source

rubocop:disable Metrics/MethodLength, Metrics/AbcSize

# File lib/centaman/object/booking_time.rb, line 13
def json
  {
    id: id,
    booking_type_id: booking_type_id,
    booking_type_description: booking_type_description,
    description: description,
    start_date: start_date.strftime('%Y-%m-%d'),
    start_time: start_time,
    end_time: end_time,
    display_start_time: display_start_time,
    display_end_time: display_end_time,
    capacity: capacity,
    vacancy: vacancy,
    remaining: remaining,
    booking_fee: booking_fee,
    booking_fee_item_code: booking_fee_item_code,
    cancelled: cancelled,
    sold_out: sold_out
  }
end