README.md in stub_requests-0.1.2 vs README.md in stub_requests-0.1.3

- old
+ new

@@ -12,24 +12,31 @@ This is achieve by keeping a registry over the service endpoints. <!-- MarkdownTOC --> +- [Required ruby version](#required-ruby-version) - [Installation](#installation) - [Usage](#usage) - [Register service endpoints](#register-service-endpoints) - [Stubbing service endpoints](#stubbing-service-endpoints) - [Metrics](#metrics) + - [Observing endpoint invocations](#observing-endpoint-invocations) - [Future Improvements](#future-improvements) - [API Client Gem](#api-client-gem) - [Development](#development) - [Contributing](#contributing) - [License](#license) - [Code of Conduct](#code-of-conduct) <!-- /MarkdownTOC --> +<a id="required-ruby-version"></a> +## Required ruby version + +Ruby version >= 2.3 + <a id="installation"></a> ## Installation Add this line to your application's Gemfile: @@ -108,9 +115,29 @@ ```ruby StubRequests.configure do |config| config.record_metrics = true end +``` + +<a id="observing-endpoint-invocations"></a> +### Observing endpoint invocations + +```ruby +# To jump into pry when a request is called +callback = lambda do |request| + p request + binding.pry +end + +callback = ->(request) { p request; binding.pry } + +StubRequests.subscribe_to(:document_service, :show, :get, callback) +``` + +```ruby +# To unsubscribe from notifications +StubRequests.unsubscribe_from(:document_service, :show, :get) ``` <a id="future-improvements"></a> ## Future Improvements