Class: AlephApi::RestfulApiClient::Patron::CirculationActions::Requests::Holds

Inherits:
Object
  • Object
show all
Defined in:
lib/aleph_api/restful_api_client/patron/circulation_actions/requests/holds.rb

Instance Method Summary collapse

Constructor Details

#initialize(client, patron_id, hold_id = nil) ⇒ Holds

Returns a new instance of Holds.



4
5
6
7
8
# File 'lib/aleph_api/restful_api_client/patron/circulation_actions/requests/holds.rb', line 4

def initialize(client, patron_id, hold_id = nil)
  @client = client
  @hold_id = hold_id
  @patron_id = patron_id
end

Instance Method Details

#delete(options = {}) ⇒ Object



22
23
24
25
26
27
28
29
30
# File 'lib/aleph_api/restful_api_client/patron/circulation_actions/requests/holds.rb', line 22

def delete(options = {})
  if @hold_id
    @client.http(:delete, "/patron/#{@patron_id}/circulationActions/requests/holds/#{@hold_id}", options).try do |_response|
      _response.body
    end
  else
    raise ArgumentError, "No hold id given!"
  end
end

#get(options = {}) ⇒ Object



10
11
12
13
14
15
16
17
18
19
20
# File 'lib/aleph_api/restful_api_client/patron/circulation_actions/requests/holds.rb', line 10

def get(options = {})
  if @hold_id
    @client.http(:get, "/patron/#{@patron_id}/circulationActions/requests/holds/#{@hold_id}", options).try do |_response|
      _response.body
    end
  else
    @client.http(:get, "/patron/#{@patron_id}/circulationActions/requests/holds", options).try do |_response|
      _response.body
    end
  end
end