Class: Centaman::Object::TicketType

Inherits:
Centaman::Object show all
Defined in:
lib/centaman/object/ticket_type.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Methods inherited from Centaman::Object

#define_variables, #initialize

Constructor Details

This class inherits a constructor from Centaman::Object

Instance Attribute Details

#booking_time_idObject (readonly)

Returns the value of attribute booking_time_id.



3
4
5
# File 'lib/centaman/object/ticket_type.rb', line 3

def booking_time_id
  @booking_time_id
end

#discountObject (readonly)

Returns the value of attribute discount.



3
4
5
# File 'lib/centaman/object/ticket_type.rb', line 3

def discount
  @discount
end

#priceObject (readonly)

Returns the value of attribute price.



3
4
5
# File 'lib/centaman/object/ticket_type.rb', line 3

def price
  @price
end

#quantityObject

Returns the value of attribute quantity.



4
5
6
# File 'lib/centaman/object/ticket_type.rb', line 4

def quantity
  @quantity
end

Instance Method Details

#adult?Boolean

Returns:

  • (Boolean)


22
23
24
# File 'lib/centaman/object/ticket_type.rb', line 22

def adult?
  age_group == 'adult'
end

#after_init(args) ⇒ Object



6
7
8
# File 'lib/centaman/object/ticket_type.rb', line 6

def after_init(args)
  @booking_time_id = args.fetch(:booking_time_id, nil)
end

#attributesObject

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
91
92
# File 'lib/centaman/object/ticket_type.rb', line 39

def attributes
  [
    Centaman::Attribute.new(
      centaman_key: "TicketId",
      app_key: :id,
      type: :integer
    ),
    Centaman::Attribute.new(
      centaman_key: "TicketDescription",
      app_key: :description,
      type: :string
    ),
    Centaman::Attribute.new(
      centaman_key: "TicketPrice",
      app_key: :price_including_tax,
      type: :float
    ),
    Centaman::Attribute.new(
      centaman_key: "TicketBookingFee",
      app_key: :booking_fee,
      type: :float
    ),
    Centaman::Attribute.new(
      centaman_key: "TicketFeeItemId",
      app_key: :fee_item_id,
      type: :integer
    ),
    Centaman::Attribute.new(
      centaman_key: "DepositPercentage",
      app_key: :deposit_percentage,
      type: :float
    ),
    Centaman::Attribute.new(
      centaman_key: "IsTaxInclusive",
      app_key: :is_tax_inclusive,
      type: :boolean
    ),
    Centaman::Attribute.new(
      centaman_key: "TaxPercentage",
      app_key: :tax_percentage,
      type: :float
    ),
    Centaman::Attribute.new(
      centaman_key: "TicketDescription",
      app_key: :age_group,
      type: :age_group
    ),
    Centaman::Attribute.new(
      centaman_key: "TicketDescription",
      app_key: :display_age_group,
      type: :display_age_group
    ),
  ]
end

#child?Boolean

Returns:

  • (Boolean)


30
31
32
# File 'lib/centaman/object/ticket_type.rb', line 30

def child?
  age_group == 'child'
end

#senior?Boolean

Returns:

  • (Boolean)


34
35
36
# File 'lib/centaman/object/ticket_type.rb', line 34

def senior?
  age_group == 'senior'
end

#youth?Boolean

Returns:

  • (Boolean)


26
27
28
# File 'lib/centaman/object/ticket_type.rb', line 26

def youth?
  age_group == 'youth'
end