README.md in json_api_client-0.2.2 vs README.md in json_api_client-0.2.3

- old
+ new

@@ -40,11 +40,11 @@ u = MyApi::User.find(1).first u.accounts => MyApi::Account.where(user_id: u.id).all ``` -## Connection options +## Connection Options You can configure your connection using Faraday middleware. In general, you'll want to do this in a base model that all your resources inherit from: ``` @@ -61,9 +61,28 @@ module MyApi class User < Base # will use the customized connection end end +``` + +## Custom Connection + +You can configure your API client to use a custom connection that implementes the `execute` instance method. It should return data that your parser can handle. + +``` +class NullConnection + def initialize(*args) + end + + def execute(query) + end +end + +class CustomConnectionResource < TestResource + self.connection_class = NullConnection +end + ``` ## Custom Parser You can configure your API client to use a custom parser that implements the `parse` class method. It should return a `JsonApiClient::ResultSet` instance. You can use it by setting the parser attribute on your model: \ No newline at end of file