Sha256: 7e0de44630922636ab9da40d459154918404c239b6e0c303514c385ce642b482

Contents?: true

Size: 1.57 KB

Versions: 5

Compression:

Stored size: 1.57 KB

Contents

module Europeana
  module API
    class Record
      ##
      # Retrieve record hierarchies over the Europeana API
      class Hierarchy
        autoload :AncestorSelfSiblings, 'europeana/api/record/hierarchy/ancestor_self_siblings'
        autoload :Base, 'europeana/api/record/hierarchy/base'
        autoload :Children, 'europeana/api/record/hierarchy/children'
        autoload :FollowingSiblings, 'europeana/api/record/hierarchy/following_siblings'
        autoload :Parent, 'europeana/api/record/hierarchy/parent'
        autoload :PrecedingSiblings, 'europeana/api/record/hierarchy/preceding_siblings'
        autoload :Self, 'europeana/api/record/hierarchy/self'

        def initialize(id)
          @id = id
        end

        # bad idea having a method named self, but this is just a minimal
        # helper class, so going with it for consistency with the API
        def self(params = {})
          Self.new(@id, params).execute_request
        end

        def parent(params = {})
          Parent.new(@id, params).execute_request
        end

        def children(params = {})
          Children.new(@id, params).execute_request
        end

        def preceding_siblings(params = {})
          PrecedingSiblings.new(@id, params).execute_request
        end
        alias_method :preceeding_siblings, :preceding_siblings

        def following_siblings(params = {})
          FollowingSiblings.new(@id, params).execute_request
        end

        def ancestor_self_siblings(params = {})
          AncestorSelfSiblings.new(@id, params).execute_request
        end
      end
    end
  end
end

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
europeana-api-0.5.2 lib/europeana/api/record/hierarchy.rb
europeana-api-0.5.0 lib/europeana/api/record/hierarchy.rb
europeana-api-0.4.3 lib/europeana/api/record/hierarchy.rb
europeana-api-0.4.2 lib/europeana/api/record/hierarchy.rb
europeana-api-0.4.1 lib/europeana/api/record/hierarchy.rb