Sha256: ae06b02a80aabc824b49b2c74b2b3335f545b72164a3f027dbc56e928110190e

Contents?: true

Size: 710 Bytes

Versions: 1

Compression:

Stored size: 710 Bytes

Contents

module Alma
  class ItemRequestOptions < RequestOptions

    class ResponseError < Alma::StandardError
    end

    def self.get(mms_id, holding_id=nil, item_pid=nil, options={})
      url = "#{bibs_base_path}/#{mms_id}/holdings/#{holding_id}/items/#{item_pid}/request-options"
      options.select! {|k,_|  REQUEST_OPTIONS_PERMITTED_ARGS.include? k }
      response = HTTParty.get(url, headers: headers, query: options, timeout: timeout)
      new(response)
    end

    def validate(response)
      if response.code != 200
        message = "Could not get item request options."
        log = loggable.merge(response.parsed_response)
        raise ResponseError.new(message, log)
      end
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
alma-0.3.1 lib/alma/item_request_options.rb