class Catalog

Constants

ATTACHMENT_METADATA_FIELDS
ATTACHMENT_TYPES

Public Class Methods

update_from_catalog_entry(entry_hash) click to toggle source
# File lib/buweb/catalog.rb, line 46
def self.update_from_catalog_entry(entry_hash)
  Catalog.find_or_initialize_by(external_id: entry_hash["Catalog OID"], name: entry_hash["Catalog Name"]).tap do |cat|
    if cat.new_record?
      cat.save
    end
  end
end

Public Instance Methods

courses() click to toggle source
# File lib/buweb/catalog.rb, line 54
def courses
  catalog_entries.map(&:course)
end
cover_image() click to toggle source
# File lib/buweb/catalog.rb, line 62
def cover_image
  attachments.where('metadata.type' => 'catalog-cover-image').first
end
disclaimer_text() click to toggle source
# File lib/buweb/catalog.rb, line 74
def disclaimer_text
  "Information in the #{name} is accurate as of the date of publication. Biola University reserves the right to make changes in policies, regulations, and fees, giving reasonable notice of changes made that may impact student requirements."
end
download() click to toggle source
# File lib/buweb/catalog.rb, line 58
def download
  attachments.where('metadata.type' => 'catalog-download').first
end
supplement?() click to toggle source
# File lib/buweb/catalog.rb, line 66
def supplement?
  !full
end
to_s() click to toggle source
# File lib/buweb/catalog.rb, line 78
def to_s
  name
end

Private Instance Methods

set_slug() click to toggle source
# File lib/buweb/catalog.rb, line 83
def set_slug
  if name? && !slug?
    self.slug = name.parameterize
  elsif slug?
    self.slug = slug.parameterize
  end
end