Sha256: d2e0aba9e2a456a1e9cabc75a61728285bdb7e196bf49a6a317dc3675a9e8383

Contents?: true

Size: 666 Bytes

Versions: 5

Compression:

Stored size: 666 Bytes

Contents

module AboutPage
  class Fedora < AboutPage::Configuration::Node
    delegate :each_pair, :to_json, :to_xml, :to => :to_h

    validates_each :profile do |record, attr, value| 
      unless value.present?
        record.errors.add attr, ": unable to connect to Fedora: #{record.rubydora.inspect}"
      end
    end

    attr_accessor :rubydora

    def initialize rubydora_instance
      self.rubydora = rubydora_instance
    end

    def profile
      rubydora.profile || {}
    end

    def to_h
      profile
    end


    def preflight request
      # FIXME: ew.
      self.rubydora.instance_variable_set('@profile', nil)
      super(request)
    end

  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
about_page-0.0.7 lib/about_page/fedora.rb
about_page-0.0.6 lib/about_page/fedora.rb
about_page-0.0.5 lib/about_page/fedora.rb
about_page-0.0.4 lib/about_page/fedora.rb
about_page-0.0.3 lib/about_page/fedora.rb