Class: IdCardAttributes

Inherits:
Object
  • Object
show all
Defined in:
app/models/id_card_attributes.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Instance Attribute Details

#userObject

Returns the value of attribute user.



4
5
6
# File 'app/models/id_card_attributes.rb', line 4

def user
  @user
end

Class Method Details

.for_user(user) ⇒ Object



6
7
8
9
10
# File 'app/models/id_card_attributes.rb', line 6

def self.for_user(user)
  id_attributes = IdCardAttributes.new
  id_attributes.user = user
  id_attributes
end

Instance Method Details

#traitsObject

Return dict of traits in canonical order



13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
# File 'app/models/id_card_attributes.rb', line 13

def traits
  {
    'edipi' => @user.edipi,
    'firstname' => @user.first_name,
    'lastname' => @user.last_name,
    'address' => @user.address[:street] || '',
    'city' => @user.address[:city] || '',
    'state' => @user.address[:state] || '',
    'zip' => @user.address[:postal_code] || '',
    'email' => @user.email || '',
    'phone' => @user.home_phone || '',
    'title38status' => title38_status_code,
    'branchofservice' => branches_of_service,
    'dischargetype' => discharge_types
  }
end