RingCentral.JSON behaviour (RingCentral v0.2.0) View Source
JSON behaviour for RingCentral
Build your own JSON encoder & decoder:
defmodule MyApp.AwesomeJSONCoder do
@behaviour RingCentral.JSON
@impl true
def decode!(json_string) do
Jason.decode!(json_string)
end
@impl true
def encode!(data) do
Jason.encode!(data)
end
end
Then Use the custom JSON implementation while building the client:
ringcentral =
RingCentral.build(
client_id: "my-client-id",
client_secret: "my-client-secret",
http_client: MyApp.AwesomeHTTPClient
json_coder: MyApp.AwesomeJSONCoder
)
See RingCentral.JSON.DefaultCoder
for a reference implementation.