Resty v0.12.0 Resty View Source

This module makes it easy for Resty’s modules to get default configuration values.

All of these values can be changed in your config.exs file in order to globally change the way Resty works.

Link to this section Summary

Functions

Return the Resty.Auth implementation that should be used to authenticate outgoing requests

Return the global Resty.Connection that will be used to query every resource

Return the default headers that are going to be sent for every resource

Return the Resty.Serializer implementation that should be used to serialize and deserialize resources

Return the default site that is going to be queried for every resource

Link to this section Functions

Return the Resty.Auth implementation that should be used to authenticate outgoing requests.

The default is Resty.Auth.Null

This value can be configured in your config.exs file like this:

config :resty, auth: Resty.Auth.Null

You can also set it on a per resource basis thanks to the Resty.Resource.Base.with_auth/2 macro.

Return the global Resty.Connection that will be used to query every resource.

This value can be configured in your config.exs file like this:

config :resty, connection: Resty.Connection.HTTPoison

You can also set it on a per resource basis thanks to the Resty.Resource.Base.set_connection/1 macro.

Return the default headers that are going to be sent for every resource.

The defaults are:

[
  "Content-Type": "application/json",
  Accept: "application/json; Charset=utf-8"
]

This value can be configured in your config.exs file like this:

config :resty, headers: [
  "Content-Type": "application/json",
  Accept: "application/json; Charset=utf-8"
]

You can also set it on a per resource basis thanks to the Resty.Resource.Base.set_headers/1 macro.

Return the Resty.Serializer implementation that should be used to serialize and deserialize resources.

The default is Resty.Serializer.Json

This value can be configured in your config.exs file like this:

config :resty, serializer: Resty.Serializer.Json

You can also set it on a per resource basis thanks to the Resty.Resource.Base.set_serializer/2 macro.

Return the default site that is going to be queried for every resource.

The default is nil.

This value can be configured in your config.exs file like this:

config :resty, site: "https://my-webservice.com/api/v2"

You can also set it on a per resource basis thanks to the Resty.Resource.Base.set_site/1 macro.