shopify
shopify copied to clipboard
Remove douplicate code from Resource / NestedResource
Because we are defining singular_resource
, plural_resource
and to_json
in both modules, linters will warn you about "functions can not match because a previous function will always match"
defmodule Shopify.Variant do
@derive [Poison.Encoder]
@singular "variant"
@plural "variants"
use Shopify.Resource, import: [
:find
]
# This will trigger warnings:
use Shopify.NestedResource, import: [
:create,
:all,
:count,
:update,
:delete
]
# ...
end
One way to solve this would be to move to_json
and the resource functions in respective modules.