Sha256: c38b60fe1d5b17e01e9b3e9151005c51d4a517b416ecd5231db8fdbd2bf2f736

Contents?: true

Size: 674 Bytes

Versions: 2

Compression:

Stored size: 674 Bytes

Contents

module <%= class_base %><%= class_suffix %>
  module Resources
    class <%= resource_name.camelize %> < <%= class_base %><%= class_suffix %>::Base
<% resource[:methods].each do |method| -%>

      def <%= method[:name] %><%= "(#{ client_args(method).join(", ") })" if client_args(method).any? %>
<% if method[:params].any? -%>
        validate_params!(params, <%= validation_hash(method).inspect.html_safe %>)
<% end -%>
        call(:<%= api(method)[:http_method].downcase %>, "<%= substituted_url(method) %>"<%=
        (api(method)[:http_method].downcase == 'get' ? ", :params => params" : ", params") if method[:params].any? %>)
      end
<% end -%>

    end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
apipie-rails-0.0.9 lib/apipie/client/template/resource.rb.tt
apipie-rails-0.0.8 lib/apipie/client/template/resource.rb.tt