Sha256: 9d77c0baa07fa74ab0e6e39cb48ac2ec141d8a731661992f71233db574fe01d7
Contents?: true
Size: 1.33 KB
Versions: 1
Compression:
Stored size: 1.33 KB
Contents
require "alma_api/collection" require "alma_api/object" require "json" require_relative "../client" class AlmaApi::Client::Users require_relative "./users/fees" require_relative "./users/loans" require_relative "./users/requests" def initialize(client, user_id = nil) @client = client @user_id = user_id end def get(options = {}) if @user_id (options = options.deep_dup).symbolize_keys!.reverse_merge!({ user_id_type: :all_unique, view: :full }) @client.http(:get, "/v1/users/#{@user_id}", options).try do |_response| if _response.status == 200 AlmaApi::Object.new(JSON.parse(_response.body)) end end else (options = options.deep_dup).symbolize_keys!.reverse_merge!({ limit: 10, offset: 0, order_by: [ :last_name, :first_name, :primary_id ] }) @client.http(:get, "/v1/users", options).try do |_response| if _response.status == 200 AlmaApi::Collection.new(JSON.parse(_response.body), "user") end end end end def fees(fee_id = nil) Fees.new(@client, @user_id, fee_id) end def loans(loan_id = nil) Loans.new(@client, @user_id, loan_id) end def requests(request_id = nil) Requests.new(@client, @user_id, request_id) end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
alma_api-0.1.0 | lib/alma_api/client/users.rb |