Class: EtdaUtilities::Partner

Inherits:
Object
  • Object
show all
Defined in:
lib/etda_utilities/partner.rb

Constant Summary collapse

VALID_IDS =
%w[graduate honors milsch sset].freeze

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id) ⇒ Partner

Returns a new instance of Partner.



11
12
13
14
15
16
17
# File 'lib/etda_utilities/partner.rb', line 11

def initialize(id)
  unless VALID_IDS.include?(id)
    raise ArgumentError, "Unknown partner id #{id.inspect}"
  end

  @id = id
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



19
20
21
# File 'lib/etda_utilities/partner.rb', line 19

def id
  @id
end

Class Method Details

.currentObject



7
8
9
# File 'lib/etda_utilities/partner.rb', line 7

def self.current
  new(ENV.fetch('PARTNER'))
end

Instance Method Details

#committee_labelObject



41
42
43
# File 'lib/etda_utilities/partner.rb', line 41

def committee_label
  attributes['committee']['label']
end

#committee_list_labelObject



45
46
47
# File 'lib/etda_utilities/partner.rb', line 45

def committee_list_label
  attributes['committee']['list']['label']
end

#email_addressObject



25
26
27
# File 'lib/etda_utilities/partner.rb', line 25

def email_address
  attributes['email']['address']
end

#email_listObject



21
22
23
# File 'lib/etda_utilities/partner.rb', line 21

def email_list
  attributes['email']['list']
end

#graduate?Boolean

Returns:

  • (Boolean)


53
54
55
# File 'lib/etda_utilities/partner.rb', line 53

def graduate?
  id == 'graduate'
end

#header_titleObject



49
50
51
# File 'lib/etda_utilities/partner.rb', line 49

def header_title
  attributes['header_title']
end

#honors?Boolean

Returns:

  • (Boolean)


57
58
59
# File 'lib/etda_utilities/partner.rb', line 57

def honors?
  id == 'honors'
end

#milsch?Boolean

Returns:

  • (Boolean)


61
62
63
# File 'lib/etda_utilities/partner.rb', line 61

def milsch?
  id == 'milsch'
end

#nameObject



29
30
31
# File 'lib/etda_utilities/partner.rb', line 29

def name
  attributes['name']
end

#program_labelObject



37
38
39
# File 'lib/etda_utilities/partner.rb', line 37

def program_label
  attributes['program']['label']
end

#slugObject



33
34
35
# File 'lib/etda_utilities/partner.rb', line 33

def slug
  attributes['slug']
end

#sset?Boolean

Returns:

  • (Boolean)


65
66
67
# File 'lib/etda_utilities/partner.rb', line 65

def sset?
  id == 'sset'
end