Sha256: 6cbaa3c9afcdf3df99cf8d3feffa5e0a8aeebcfb494f5c415497c0ddb4ef1dbc
Contents?: true
Size: 879 Bytes
Versions: 1
Compression:
Stored size: 879 Bytes
Contents
require "alma_api/collection" require "json" require_relative "../users" class AlmaApi::Client::Users::Requests def initialize(client, user_id, request_id = nil) @client = client @request_id = request_id @user_id = user_id end def get(options = {}) (options = options.deep_dup).symbolize_keys!.reverse_merge!({ request_type: nil, # :HOLD, :DIGITIZATION, :BOOKING limit: 10, offset: 0, status: :active # :active, :history }) # sanitize api quirks options[:request_type] = options[:request_type].try(:to_s).try(:upcase).try(:to_sym) options[:status] = options[:status].to_s.downcase.to_sym @client.http(:get, "/v1/users/#{@user_id}/requests", options).try do |_response| if _response.status == 200 AlmaApi::Collection.new(JSON.parse(_response.body), "user_request") end end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alma_api-0.1.0 | lib/alma_api/client/users/requests.rb |