Class: Centaman::Object::AttendeeDetail

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

#ticket_idObject

Returns the value of attribute ticket_id.



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

def ticket_id
  @ticket_id
end

#ticket_typeObject

Returns the value of attribute ticket_type.



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

def ticket_type
  @ticket_type
end

#udfsObject

Returns the value of attribute udfs.



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

def udfs
  @udfs
end

Instance Method Details

#after_init(args = {}) ⇒ Object



5
6
7
8
9
# File 'lib/centaman/object/attendee_detail.rb', line 5

def after_init(args= {})
  @ticket_type = args.fetch(:ticket_type, nil)
  @ticket_id = args.fetch(:ticket_id, nil)
  @udfs = set_attendee_udfs(args[:udfs] || [])
end

#attributesObject



36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
# File 'lib/centaman/object/attendee_detail.rb', line 36

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

#full_nameObject



32
33
34
# File 'lib/centaman/object/attendee_detail.rb', line 32

def full_name
  [first_name, last_name].compact.join(' ')
end

#jsonObject



11
12
13
14
15
16
17
# File 'lib/centaman/object/attendee_detail.rb', line 11

def json
  {
    'AttendeeFirstName': first_name,
    'AttendeeLastName': last_name,
    'AttendeeMemberCode': member_code || ''
  }.as_json
end

#set_attendee_udfs(attendee_udfs) ⇒ Object



19
20
21
22
23
24
25
26
27
28
29
30
# File 'lib/centaman/object/attendee_detail.rb', line 19

def set_attendee_udfs(attendee_udfs)
  attendee_udfs.map do |u|
    Centaman::Object::Udf.new(
      is_email: u[:is_email],
      value: u[:value],
      field_name: u[:field_name],
      field_type: u[:field_type],
      field_length: u[:field_length],
      tab_name: u[:tab_name]
    )
  end
end