Class: Centaman::Object::Customer

Inherits:
Centaman::Object show all
Defined in:
lib/centaman/object/customer.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

#addressObject (readonly)

Returns the value of attribute address.



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

def address
  @address
end

#attendeesObject (readonly)

Returns the value of attribute attendees.



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

def attendees
  @attendees
end

#phoneObject (readonly)

Returns the value of attribute phone.



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

def phone
  @phone
end

Instance Method Details

#after_init(args) ⇒ Object

rubocop:disable Metrics/MethodLength



6
7
8
9
10
# File 'lib/centaman/object/customer.rb', line 6

def after_init(args)
  @address = args["Address"]
  @phone = args["Address"]["HomePhone"]
  @attendees = build_booking_attendees(args["BookingAttendee"])
end

#attributesObject



16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/centaman/object/customer.rb', line 16

def attributes
  [
    Centaman::Attribute.new(
      centaman_key: 'MemberCode',
      app_key: :member_code,
      type: :integer
    ),
    Centaman::Attribute.new(
      centaman_key: 'FirstName',
      app_key: :first_name,
      type: :string
    ),
    Centaman::Attribute.new(
      centaman_key: 'LastName',
      app_key: :last_name,
      type: :string
    ),
    Centaman::Attribute.new(
      centaman_key: 'Email',
      app_key: :email,
      type: :string
    ),
  ]
end

#build_booking_attendees(booking_attendees = []) ⇒ Object



12
13
14
# File 'lib/centaman/object/customer.rb', line 12

def build_booking_attendees(booking_attendees = [])
  booking_attendees.map { |a| Centaman::Object::AttendeeDetail.new(a) }
end