class Career

Constants

DEPARTMENTS
HEADING_TAG_LIST

Public Class Methods

new(career) click to toggle source
# File lib/nexmo_developer/app/presenters/career.rb, line 5
def initialize(career)
  @career = career
end

Public Instance Methods

department_codes() click to toggle source
# File lib/nexmo_developer/app/presenters/career.rb, line 17
def department_codes
  @department_codes ||= @career[:departments].pluck(:id) # rubocop:disable Rails/PluckId
end
description() click to toggle source
# File lib/nexmo_developer/app/presenters/career.rb, line 21
def description
  content = CGI.unescapeHTML(@career[:content])

  # If it starts with a header, strip it out
  document = Nokogiri::HTML::DocumentFragment.parse(content)
  first_child = document.children[0]
  first_child.remove if HEADING_TAG_LIST.include?(first_child.name)

  document.to_html
end
devrel?() click to toggle source
# File lib/nexmo_developer/app/presenters/career.rb, line 36
def devrel?
  @career[:departments].any? { |d| d[:id] == Greenhouse::DEPARTMENT_ID } &&
    @career[:title].downcase.match?(Regexp.union(Greenhouse::TITLES))
end
location() click to toggle source
# File lib/nexmo_developer/app/presenters/career.rb, line 13
def location
  @career.dig(:location, :name)
end
title() click to toggle source
# File lib/nexmo_developer/app/presenters/career.rb, line 9
def title
  @career[:title]
end
url() click to toggle source
# File lib/nexmo_developer/app/presenters/career.rb, line 32
def url
  @career[:absolute_url]
end