Sha256: 7cf8c9de6a906f4b3dc56b371fb88fed8ade9f43828cf5267a6048745cd28eeb

Contents?: true

Size: 766 Bytes

Versions: 1

Compression:

Stored size: 766 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, '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

1 entries across 1 versions & 1 rubygems

Version Path
europeana-api-0.4.1 lib/europeana/api/record/hierarchy/base.rb