Sha256: 21db6bfdd7056ab6c27e078af99ab3b4362303d31b57b32c072647de29c11faa

Contents?: true

Size: 1.08 KB

Versions: 7

Compression:

Stored size: 1.08 KB

Contents

module Centaman
  class Object::Customer < Centaman::Object
    attr_reader :address, :phone, :attendees
    # rubocop:disable Metrics/MethodLength

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

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

    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
    # rubocop:enable Metrics/MethodLength
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
centaman-8.0.0 lib/centaman/object/customer.rb
centaman-7.0.5 lib/centaman/object/customer.rb
centaman-7.0.4 lib/centaman/object/customer.rb
centaman-7.0.3 lib/centaman/object/customer.rb
centaman-7.0.2 lib/centaman/object/customer.rb
centaman-7.0.1 lib/centaman/object/customer.rb
centaman-7.0.0 lib/centaman/object/customer.rb