Apipie/apipie-rails

View on GitHub
app/views/apipie/apipies/_method_detail.erb

Summary

Maintainability
Test Coverage
<%= raw method[:full_description] %>

<% unless method[:formats].blank? %>
  <%= heading(t('apipie.supported_formats'), h_level) %>
  <%= method[:formats].join(', ') %>
<% end %>

<% unless method[:errors].blank? %>
  <%= heading(t('apipie.errors'), h_level) %>
  <%= render(:partial => "errors", :locals => {:errors => method[:errors]}) %>
<% end %>

<% unless method[:metadata].blank? %>
  <%= heading(t('apipie.metadata'), h_level) %>
  <%= render(:partial => "metadata", :locals => {:meta => method[:metadata]}) %>
<% end %>

<% unless method[:examples].blank? %>
  <%= heading(t('apipie.examples'), h_level) %>
  <% method[:examples].each do |example| %>
    <pre class="prettyprint"><%= example %></pre>
  <% end %>
<% end %>

<% unless method[:params].blank? %>
  <%= heading(t('apipie.params'), h_level) %>
  <table class='table'>
    <thead>
      <tr>
        <th><%= t('apipie.param_name') %></th>
        <th><%= t('apipie.description') %></th>
      </tr>
    </thead>
    <tbody>
      <%= render(:partial => "params", :locals => {:params => method[:params]}) %>
    </tbody>
  </table>
<% end %>
<% unless method[:returns].blank? %>
  <%= heading(t('apipie.returns'), h_level) %>
  <% method[:returns].each do |item| %>
    <%= heading("#{t('apipie.code')}: #{item[:code]}", h_level + 1) %>
    <% if item[:description] %>
      <%= heading("#{t('apipie.description')}:", h_level + 2) %>
      <p><%= item[:description] %></p>
    <% end %>
    <table class='table'>
      <thead>
        <tr>
          <th><%= t('apipie.param_name') %></th>
          <th><%= t('apipie.description') %></th>
        </tr>
      </thead>
      <tbody>
        <%= render(:partial => "params", :locals => {:params => item[:returns_object]}) %>
      </tbody>
    </table>

    <%= render(:partial => "headers", :locals => {:headers => item[:headers], :h_level => h_level+2 }) %>
  <% end %>
<% end %>

<%= render(:partial => "headers", :locals => {:headers => method[:headers], :h_level => h_level }) %>