lib/folio_client.rb in folio_client-0.3.1 vs lib/folio_client.rb in folio_client-0.4.0

- old
+ new

@@ -29,31 +29,31 @@ self end delegate :config, :connection, :get, :post, to: :instance - delegate :fetch_hrid, :fetch_marc_hash, to: :instance + delegate :fetch_hrid, :fetch_marc_hash, :has_instance_status?, to: :instance end attr_accessor :config # Send an authenticated get request # @param path [String] the path to the Folio API request # @param request [Hash] params to get to the API def get(path, params = {}) - response = connection.get(path, params, { "x-okapi-token": config.token }) + response = connection.get(path, params, {"x-okapi-token": config.token}) UnexpectedResponse.call(response) unless response.success? JSON.parse(response.body) end # Send an authenticated post request # @param path [String] the path to the Folio API request # @param request [json] request body to post to the API def post(path, request = nil) - response = connection.post(path, request, { "x-okapi-token": config.token }) + response = connection.post(path, request, {"x-okapi-token": config.token}) UnexpectedResponse.call(response) unless response.success? JSON.parse(response.body) end @@ -77,8 +77,15 @@ def fetch_marc_hash(...) TokenWrapper.refresh(config, connection) do source_storage = SourceStorage.new(self) source_storage.fetch_marc_hash(...) + end + end + + def has_instance_status?(...) + TokenWrapper.refresh(config, connection) do + inventory = Inventory.new(self) + inventory.has_instance_status?(...) end end end