Sha256: 251db374bc6de9e14d2ca089526364c5b06dc715ce7e4f94f81b30214d541c9a

Contents?: true

Size: 788 Bytes

Versions: 3

Compression:

Stored size: 788 Bytes

Contents

module Europeana
  module API
    class Record
      class Hierarchy
        ##
        # Base class for common heirarchy API behaviour
        class Base
          include Requestable

          attr_accessor :params

          def initialize(id, params = {})
            @id = id
            @params = params
          end

          def parse_response(response, options = {})
            super.slice(:self, :children, :parent, 'preceding-siblings', 'preceeding-siblings', 'following-siblings', 'ancestors')
          end

          def request_url(_options = {})
            Europeana::API.url + "/record#{@id}/#{api_method}.json"
          end

          def api_method
            self.class.to_s.demodulize.underscore.dasherize
          end
        end
      end
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

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