openaustralia/publicwhip

View on GitHub
app/views/help/data.html.haml

Summary

Maintainability
Test Coverage
- content_for :title, "API - Get the data"
- set_meta_tags description: "How to use the #{Settings.project_name} API to access data about people and votes in parliament and the issues that matter to you."

- content_for :header do
  .section-header.clearfix
    .page-header.container
      %h1= yield :title
      %p.lead
        With modest developer skills you can use the modern REST API to access almost all the information available on #{inline_project_name}

.row
  .col-md-10
    %p
      All endpoints return their results as JSON.

    %p
      Jump to the section you're most interested in

    %ul
      - if current_user.nil?
        %li= link_to "Get an API key", "#key"
      - else
        %li= link_to "Your personal API key", "#key"
      %li= link_to "All current people in parliament", "#people"
      %li= link_to "Details for a person", "#person"
      %li= link_to "All policies", "#policies"
      %li= link_to "Details for a policy", "#policy"
      %li= link_to "All divisions", "#divisions"
      %li= link_to "Details for a division", "#division"
      %li= link_to "Legacy API", "#legacy"

- if current_user.nil?
  %h2#key Get an API key
  .row
    .col-md-10
      %p
        First thing you will need is a key. It is a key just for you. Please don't share it with
        anyone else.
      %p
        You'll get one automatically when you
        = link_to "Login", new_user_session_path
        or
        = link_to "Sign Up", new_user_registration_path, class: "link-signup"
        and come back to this page.
- else
  %h2#key Your personal API key
  .row
    .col-md-10
      %p
        Your API key is <code>#{current_user.api_key}</code>. It is a key just for you. Please don't share it with
        anyone else.
      %p
        The API examples below already include your personal key.

%h2#people All current people in parliament
.row
  .col-md-10
    = render "api/v1/people/docs_index"
  .col-md-2
    = link_to "Edit docs", "https://github.com/openaustralia/theyvoteforyou/tree/test/app/views/api/v1/people/_docs_index.md", class: "btn btn-default"

%h2#person Details for a person
.row
  .col-md-10
    = render "api/v1/people/docs_show"
  .col-md-2
    = link_to "Edit docs", "https://github.com/openaustralia/theyvoteforyou/tree/test/app/views/api/v1/people/_docs_show.md", class: "btn btn-default"

%h2#policies All policies
.row
  .col-md-10
    = render "api/v1/policies/docs_index"
  .col-md-2
    = link_to "Edit docs", "https://github.com/openaustralia/theyvoteforyou/tree/test/app/views/api/v1/policies/_docs_index.md", class: "btn btn-default"

%h2#policy Details for a policy
.row
  .col-md-10
    = render "api/v1/policies/docs_show"
  .col-md-2
    = link_to "Edit docs", "https://github.com/openaustralia/theyvoteforyou/tree/test/app/views/api/v1/policies/_docs_show.md", class: "btn btn-default"

%h2#divisions All divisions
.row
  .col-md-10
    = render "api/v1/divisions/docs_index"
  .col-md-2
    = link_to "Edit docs", "https://github.com/openaustralia/theyvoteforyou/tree/test/app/views/api/v1/divisions/_docs_index.md", class: "btn btn-default"

%h2#division Details for a division
.row
  .col-md-10
    = render "api/v1/divisions/docs_show"
  .col-md-2
    = link_to "Edit docs", "https://github.com/openaustralia/theyvoteforyou/tree/test/app/views/api/v1/divisions/_docs_show.md", class: "btn btn-default"

%h2#legacy Legacy API
.row
  .col-md-10
    = render "legacy_api"
  .col-md-2
    = link_to "Edit docs", "https://github.com/openaustralia/theyvoteforyou/tree/test/app/views/help/_legacy_api.md", class: "btn btn-default"