Sha256: dd31c9a78cb3c6ae9623c5967de188b726a014577b5118937444e67ff2d72727

Contents?: true

Size: 729 Bytes

Versions: 8

Compression:

Stored size: 729 Bytes

Contents

require 'ezwadl'

module Alma
  module Api


    def default_params
      { :query => { :apikey => Alma.configuration.apikey } }
    end

    def query_merge(hash)
      {:query => default_params[:query].merge(hash)}
    end

    def resources
      @resources ||= load_wadl
    end

    def load_wadl(wadl_filename = nil)
      wadl_filename ||= set_wadl_filename
      parsed_wadl = EzWadl::Parser.parse(File.join(Alma::WADL_DIR, wadl_filename)) do |rs|
        rs.first.path = Alma.configuration.region
      end
      parsed_wadl.first
    end

    def set_wadl_filename
      # Each class including this module should define this
      raise NotImplementedError 'You must define the wadl_filename method'
    end

  end
end

Version data entries

8 entries across 8 versions & 1 rubygems

Version Path
alma-0.2.8 lib/alma/api.rb
alma-0.2.6 lib/alma/api.rb
alma-0.2.5 lib/alma/api.rb
alma-0.2.4 lib/alma/api.rb
alma-0.2.3 lib/alma/api.rb
alma-0.2.1 lib/alma/api.rb
alma-0.2.0 lib/alma/api.rb
alma-0.1.0 lib/alma/api.rb