lib/alma/bib.rb in alma-0.2.8 vs lib/alma/bib.rb in alma-0.3.1
- old
+ new
@@ -1,18 +1,20 @@
module Alma
class Bib
+ extend Alma::ApiDefaults
extend Forwardable
def self.find(ids, args)
get_bibs(ids, args)
end
def self.get_bibs(ids, args={})
response = HTTParty.get(
self.bibs_base_path,
- query: {mms_id: ids_from_array(ids)},
- headers: headers
+ query: {mms_id: ids_from_array(ids) }.merge(args),
+ headers: headers,
+ timeout: timeout
)
if response.code == 200
Alma::BibSet.new(get_body_from(response))
else
@@ -46,35 +48,15 @@
end
private
- def self.bibs_base_path
- "#{self.region}/almaws/v1/bibs"
- end
-
def bibs_base_path
self.class.bibs_base_path
end
- def self.headers
- { "Authorization": "apikey #{self.apikey}",
- "Accept": "application/json",
- "Content-Type": "application/json" }
- end
-
-
def headers
self.class.headers
- end
-
-
- def self.apikey
- Alma.configuration.apikey
- end
-
- def self.region
- Alma.configuration.region
end
def self.get_body_from(response)
JSON.parse(response.body)
end