lib/folio_client.rb in folio_client-0.2.0 vs lib/folio_client.rb in folio_client-0.2.1

- old
+ new

@@ -64,10 +64,14 @@ url: config.url, headers: DEFAULT_HEADERS.merge(config.okapi_headers || {}) ) end + # Public methods available on the FolioClient below + # Wrap methods in `TokenWrapper` to ensure a new token is fetched automatically if expired def fetch_hrid(...) - inventory = Inventory.new(self) - inventory.fetch_hrid(...) + TokenWrapper.refresh(config, connection) do + inventory = Inventory.new(self) + inventory.fetch_hrid(...) + end end end