{%- if name -%}
class {{ name }}(object):

    CLI_COMMAND_NAME = {{ cli_command_name }}
    ROUTE_CLI_COMMAND_MAP = {{ route_cli_commands_map }}

    def __init__(self, fetch, url):
        self._fetch = fetch
        self._url = url
        {% for resource, resource_class, resource_path in sub_resources -%}
        {%- if resource -%}
        self.{{ resource }} = self.{{ resource_class }}(self._fetch, "%s/{{ resource_path }}" % self._url)
        {% endif -%}
        {% endfor %}
        {%- for method in methods %}
{{ method|indent(4, true) }}
        {% endfor %}
{{ sub_classes }}
{%- else -%}
ROUTE_CLI_COMMAND_MAP.update({{ route_cli_commands_map }})

{% for method in methods -%}
{{ method }}

{% endfor %}
{%- endif -%}
