### Start Development Server (Rails & Mailcatcher) Source: https://context7.com/openaustralia/theyvoteforyou/llms.txt Instructions for starting the local development server, including installing dependencies, running Mailcatcher for email testing, and starting the Rails server. ```bash # Install dependencies bundle install gem install mailcatcher # Start mailcatcher for email testing (access at http://localhost:1080) mailcatcher # Start Rails server bundle exec rails server # Access at http://localhost:3000 # Or use Foreman to manage processes foreman start ``` -------------------------------- ### Configure Database and Setup Database Source: https://github.com/openaustralia/theyvoteforyou/blob/main/README.md Copies the example database configuration file and then sets up the development database, including seeding it with initial data. Assumes database.yml has been edited with correct credentials. ```shell cp config/database.yml.example config/database.yml # (Edit config/database.yml and fill in your username, password and database settings.) bundle exec rake application:config:dev bundle exec rake db:setup ``` -------------------------------- ### Start Rails Development Server Source: https://github.com/openaustralia/theyvoteforyou/blob/main/local_dev/DEVELOPMENT.md This command starts the Rails development server, binding it to all network interfaces (0.0.0.0) to make it accessible from your host machine. The website can then be viewed at http://localhost:3000. ```bash bundle exec rails server --binding=0.0.0.0 ``` -------------------------------- ### Start and SSH into Vagrant VM Source: https://github.com/openaustralia/theyvoteforyou/blob/main/local_dev/DEVELOPMENT.md These commands initiate the Vagrant virtual machine and allow you to connect to it via SSH. This is the first step in setting up the local development environment. ```bash vagrant up vagrant ssh ``` -------------------------------- ### Start Docker Compose Stack Source: https://github.com/openaustralia/theyvoteforyou/blob/main/local_dev/DEVELOPMENT.md This command logs into Docker (optional, for increasing API limits) and then starts the services defined in the docker-compose.yml file in detached mode. This brings up necessary services like databases or other containers. ```bash docker login docker compose -f /opt/docker-compose/docker-compose.yml up --detach ``` -------------------------------- ### Install Ruby Version with rbenv Source: https://github.com/openaustralia/theyvoteforyou/blob/main/local_dev/DEVELOPMENT.md After SSHing into the Vagrant VM and navigating to the source directory, this command installs the required Ruby version specified in the .ruby-version file using rbenv. Ensure rbenv is installed and configured beforehand. ```bash cd /opt/source rbenv install ``` -------------------------------- ### Start Guard for Live Reload Source: https://github.com/openaustralia/theyvoteforyou/blob/main/local_dev/DEVELOPMENT.md Starts the 'guard' process, which provides live reloading capabilities and allows the local website to update automatically as code changes are made. This requires a separate SSH connection to the Vagrant VM. ```bash vagrant ssh cd /opt/source bundle exec guard ``` -------------------------------- ### Install Project Gems Source: https://github.com/openaustralia/theyvoteforyou/blob/main/local_dev/DEVELOPMENT.md After installing Bundler, this command installs all the project's Ruby dependencies listed in the Gemfile.lock. Running 'rbenv rehash' again ensures any new executables are accessible. ```bash bundle install rbenv rehash ``` -------------------------------- ### Install and Rehash Bundler Source: https://github.com/openaustralia/theyvoteforyou/blob/main/local_dev/DEVELOPMENT.md This step involves installing a specific version of Bundler, as indicated by the Gemfile.lock, and then rehashing rbenv to ensure the bundler executable is available. This is crucial for managing project dependencies. ```bash gem install bundler -v 2.2.3 rbenv rehash ``` -------------------------------- ### Running Tests and Server with Vagrant Source: https://github.com/openaustralia/theyvoteforyou/blob/main/README.md Commands to execute tests and start the Rails server within a Vagrant environment. This assumes Vagrant and VirtualBox are installed and the repository is cloned. The dummy SMTP server for sign-up confirmations is accessible at http://localhost:1080. ```bash vagrant ssh cd /vagrant bundle exec rake bundle exec rails server ``` -------------------------------- ### Install Development Tools on Linux (Debian) Source: https://github.com/openaustralia/theyvoteforyou/blob/main/README.md Installs MySQL server and client, and the libmysqlclient-dev package on Debian-based Linux systems. It also provides instructions to install rbenv and ruby-build. ```shell # ... or Linux (Debian) sudo apt-get install tidy mysql-server mysql-client libmysqlclient-dev # then follow: https://github.com/sstephenson/rbenv#basic-github-checkout to get rbenv and ruby-build ``` -------------------------------- ### Install Development Tools on OS X Source: https://github.com/openaustralia/theyvoteforyou/blob/main/README.md Installs Homebrew, tidy-html5, MySQL, and rbenv with ruby-build on macOS. It then installs the required Ruby version specified in the .ruby-version file. ```shell # OS X ... brew install tidy-html5 mysql rbenv ruby-build rbenv install $(cat .ruby-version) ``` -------------------------------- ### Run Tests and Start Rails Server Source: https://github.com/openaustralia/theyvoteforyou/blob/main/README.md Executes the test suite for the Rails application and then starts the development server to run the application locally. ```shell bundle exec rake bundle exec rails server ``` -------------------------------- ### Install Ruby Dependencies and Mailcatcher Source: https://github.com/openaustralia/theyvoteforyou/blob/main/README.md Installs the necessary Ruby gems for the application using Bundler and installs the mailcatcher gem for development email handling. ```shell bundle install gem install mailcatcher ``` -------------------------------- ### Database Setup and Configuration (Rake Tasks) Source: https://context7.com/openaustralia/theyvoteforyou/llms.txt Steps to set up the development database, including copying configuration files, editing credentials, creating the database, running migrations, and loading seed data. ```bash # Copy example config cp config/database.yml.example config/database.yml # Edit config/database.yml with your credentials # Then run configuration setup bundle exec rake application:config:dev # Create database, run migrations, and load seed data bundle exec rake db:setup # Or step by step bundle exec rake db:create bundle exec rake db:migrate bundle exec rake db:seed ``` -------------------------------- ### API v1 Policy Endpoint Request Examples (Ruby) Source: https://github.com/openaustralia/theyvoteforyou/blob/main/app/views/api/v1/policies/_docs_show.md These examples demonstrate how to construct GET requests to the API v1 policy endpoint. They differentiate between authenticated requests (using a current user's API key) and unauthenticated requests, showing how to substitute placeholder values for IDs and API keys. The output is formatted as JSON. ```erb <% if current_user %>
GET <%= api_v1_policy_url(format: "json", id: "foo", key: current_user.api_key).gsub("foo", "[id]") %>
<% else %>
GET <%= api_v1_policy_url(format: "json", id: "id2", key: "api_key2").gsub("id2", "[id]").gsub("api_key2", "[api_key]") %>
<% end %> ``` ```erb <% if current_user %>
GET <%= link_to api_v1_policy_url(format: "json", id: 1, key: current_user.api_key), api_v1_policy_url(format: "json", id: 1, key: current_user.api_key) %>
<% end %> ``` -------------------------------- ### Set Up Database and Seed Data Source: https://github.com/openaustralia/theyvoteforyou/blob/main/local_dev/DEVELOPMENT.md This Rake task sets up the application's database, including creating tables and populating it with initial seed data. This is essential for the application to function correctly. ```bash bundle exec rake db:setup ``` -------------------------------- ### Run Project Tests Source: https://github.com/openaustralia/theyvoteforyou/blob/main/local_dev/DEVELOPMENT.md Executes all the defined tests for the project using Rake. This is a standard step to ensure the application's integrity and functionality. ```bash bundle exec rake ``` -------------------------------- ### Example Division API Request (Authenticated) Source: https://github.com/openaustralia/theyvoteforyou/blob/main/app/views/api/v1/divisions/_docs_show.md This example provides a concrete instance of how to link to the division API endpoint for an authenticated user, using a specific division ID (2788). It's useful for understanding how to implement the authenticated request in practice. ```html <% if current_user %>
GET <%= link_to api_v1_division_url(format: "json", id: 2788, key: current_user.api_key), api_v1_division_url(format: "json", id: 2788, key: current_user.api_key) %>
<% end %> ``` -------------------------------- ### Build Cache and Elasticsearch Index Source: https://github.com/openaustralia/theyvoteforyou/blob/main/local_dev/DEVELOPMENT.md These commands rebuild the application's cache and reindex all data in Elasticsearch. This is important for ensuring search functionality and cached data are up-to-date. ```bash bundle exec rake application:cache:all bundle exec rake searchkick:reindex:all ``` -------------------------------- ### Deploy Application Updates (Mina & Capistrano) Source: https://context7.com/openaustralia/theyvoteforyou/llms.txt Commands for deploying the application to different environments using Capistrano for Australia and Mina for Ukraine. Includes initial setup and post-deployment tasks. ```bash # Deploy to production (Capistrano for Australia) bundle exec cap production deploy # Deploy to Ukraine environments (Mina) bundle exec mina ukraine_dev setup # First time setup bundle exec mina ukraine_dev deploy # Deploy updates bundle exec mina ukraine_production deploy # Production deploy # Post-deployment tasks bundle exec mina ukraine_dev rake[application:load:members] bundle exec mina ukraine_dev rake[application:cache:all_except_people_distances] bundle exec mina ukraine_dev rake[searchkick:reindex:all] ``` -------------------------------- ### Setting up and Deploying with Mina for Ukraine (Development) Source: https://github.com/openaustralia/theyvoteforyou/blob/main/README.md Sequence of commands to set up and deploy the application to a development server in Ukraine using Mina. Includes loading data, setting up caches, and building the search index. ```bash bundle exec mina ukraine_dev setup bundle exec mina ukraine_dev deploy bundle exec mina ukraine_dev rake[application:load:popolo[https://raw.githubusercontent.com/everypolitician/everypolitician-data/master/data/Ukraine/Verkhovna_Rada/ep-popolo-v1.0.json]] bundle exec mina ukraine_dev rake[application:load:popolo[https://arcane-mountain-8284.herokuapp.com/vote_events/2015-07-14]] bundle exec mina ukraine_dev rake[application:cache:all_except_people_distances] bundle exec mina ukraine_dev rake[searchkick:reindex:all] ``` -------------------------------- ### Retrieve Policies (JSON) Source: https://github.com/openaustralia/theyvoteforyou/blob/main/app/views/api/v1/policies/_docs_index.md This snippet shows how to make a GET request to the API v1 policies endpoint to retrieve policy data in JSON format. It includes examples for both authenticated users (using their API key) and unauthenticated requests (using a placeholder for the API key). ```ruby <% if current_user %> GET <%= link_to api_v1_policies_url(format: "json", key: current_user.api_key), api_v1_policies_url(format: "json", key: current_user.api_key) %> <% else %> GET <%= api_v1_policies_url(format: "json", key: "api_key2").gsub("api_key2", "[api_key]") %> <% end %> ``` -------------------------------- ### Deploying to Ukraine Production with Mina Source: https://github.com/openaustralia/theyvoteforyou/blob/main/README.md Instructions to deploy to the production server for Ukraine using Mina, by replacing the development target with the production target. ```bash # Replace ukraine_dev with ukraine_production in the above commands ``` -------------------------------- ### Load Initial Data (Mina) Source: https://context7.com/openaustralia/theyvoteforyou/llms.txt Command to load initial application data, specifically 'popolo' data for Ukraine, using Mina for deployment. This is part of the initial setup or data refresh process. ```bash bundle exec mina ukraine_dev rake[application:load:popolo[https://raw.githubusercontent.com/everypolitician/everypolitician-data/master/data/Ukraine/Verkhovna_Rada/ep-popolo-v1.0.json]] ``` -------------------------------- ### GET /api/v1/policies Source: https://context7.com/openaustralia/theyvoteforyou/llms.txt Retrieves a list of all voting policies tracked in the system. ```APIDOC ## GET /api/v1/policies ### Description Retrieves all voting policies tracked in the system. ### Method GET ### Endpoint `/api/v1/policies` ### Request Example ```bash curl "https://theyvoteforyou.org.au/api/v1/policies" -H "Accept: application/json" ``` ### Response #### Success Response (200) - **id** (integer) - The unique identifier for the policy. - **name** (string) - The name of the policy. - **description** (string) - A brief description of the policy. - **provisional** (boolean) - Indicates if the policy is provisional. - **last_edited_at** (string) - The timestamp when the policy was last edited. #### Response Example ```json [ { "id": 1, "name": "increasing environmental protections", "description": "Votes that increase protection of Australia's natural environment", "provisional": false, "last_edited_at": "2023-12-15T10:30:00Z" } ] ``` ``` -------------------------------- ### GET /api/v1/people Source: https://context7.com/openaustralia/theyvoteforyou/llms.txt Retrieves a list of current members of parliament with their basic information. ```APIDOC ## GET /api/v1/people ### Description Retrieves a list of current members of parliament with their basic information. ### Method GET ### Endpoint `/api/v1/people` ### Request Example ```bash curl "https://theyvoteforyou.org.au/api/v1/people" -H "Accept: application/json" ``` ### Response #### Success Response (200) - **id** (integer) - The unique identifier for the person. - **latest_member** (object) - Contains information about the person's latest parliamentary membership. - **id** (integer) - The ID of the latest membership record. - **name** (object) - The name of the member. - **first** (string) - The first name. - **last** (string) - The last name. - **electorate** (string) - The electorate the member represents. - **house** (string) - The parliamentary house the member belongs to. - **party** (string) - The political party the member belongs to. #### Response Example ```json [ { "id": 567, "latest_member": { "id": 890, "name": { "first": "Anthony", "last": "Albanese" }, "electorate": "Grayndler", "house": "representatives", "party": "Australian Labor Party" } } ] ``` ``` -------------------------------- ### GET /api/v1/policies/{id} Source: https://context7.com/openaustralia/theyvoteforyou/llms.txt Retrieves detailed information about a specific voting policy. ```APIDOC ## GET /api/v1/policies/{id} ### Description Retrieves detailed information about a specific voting policy. ### Method GET ### Endpoint `/api/v1/policies/{id}` #### Path Parameters - **id** (integer) - Required - The unique identifier of the policy. ### Request Example ```bash curl "https://theyvoteforyou.org.au/api/v1/policies/1" -H "Accept: application/json" ``` ### Response #### Success Response (200) - **id** (integer) - The unique identifier for the policy. - **name** (string) - The name of the policy. - **description** (string) - A brief description of the policy. - **provisional** (boolean) - Indicates if the policy is provisional. - **last_edited_at** (string) - The timestamp when the policy was last edited. #### Response Example ```json { "id": 1, "name": "increasing environmental protections", "description": "Votes that increase protection of Australia's natural environment", "provisional": false, "last_edited_at": "2023-12-15T10:30:00Z" } ``` ``` -------------------------------- ### GET /api/v1/divisions/{id} Source: https://context7.com/openaustralia/theyvoteforyou/llms.txt Retrieves detailed information about a specific parliamentary division by its ID. ```APIDOC ## GET /api/v1/divisions/{id} ### Description Retrieves detailed information about a specific parliamentary division by its ID. ### Method GET ### Endpoint `/api/v1/divisions/{id}` #### Path Parameters - **id** (integer) - Required - The unique identifier of the division. ### Request Example ```bash curl "https://theyvoteforyou.org.au/api/v1/divisions/12345" -H "Accept: application/json" ``` ### Response #### Success Response (200) - **id** (integer) - The unique identifier for the division. - **house** (string) - The parliamentary house where the division occurred. - **name** (string) - The name or title of the bill or motion voted on. - **date** (string) - The date the division took place (YYYY-MM-DD). - **number** (integer) - The division number for that day. - **clock_time** (string) - The time of the division. - **aye_votes** (integer) - The number of 'Aye' votes. - **no_votes** (integer) - The number of 'No' votes. - **possible_turnout** (integer) - The total number of members eligible to vote. - **rebellions** (integer) - The number of members who voted against their party line. - **edited** (boolean) - Indicates if the division has been edited or corrected. #### Response Example ```json { "id": 12345, "house": "representatives", "name": "Environment Protection and Biodiversity Conservation Amendment Bill 2023", "date": "2023-06-15", "number": 3, "clock_time": "4:30 PM", "aye_votes": 76, "no_votes": 72, "possible_turnout": 151, "rebellions": 2, "edited": true } ``` ``` -------------------------------- ### Vagrant Provisioning Troubleshooting Source: https://github.com/openaustralia/theyvoteforyou/blob/main/README.md Command to re-provision and reload the Vagrant environment if shared folder mounting issues occur due to kernel updates. ```bash vagrant provision && vagrant reload ``` -------------------------------- ### Deploying to Production with Capistrano Source: https://github.com/openaustralia/theyvoteforyou/blob/main/README.md Command to deploy the application to the production environment using Capistrano. ```bash bundle exec cap production deploy ``` -------------------------------- ### GET /api/v1/divisions Source: https://github.com/openaustralia/theyvoteforyou/blob/main/app/views/api/v1/divisions/_docs_index.md Retrieves the most recent 100 parliamentary divisions. Requires an API key for authenticated access. ```APIDOC ## GET /api/v1/divisions ### Description Retrieves basic information about the most recent 100 divisions. An API key is required for access. ### Method GET ### Endpoint `/api/v1/divisions.json` ### Parameters #### Query Parameters - **key** (string) - Required - Your API key. - **start_date** (string) - Optional - The start date for filtering divisions (format: `yyyy-mm-dd`). - **end_date** (string) - Optional - The end date for filtering divisions (format: `yyyy-mm-dd`). - **house** (string) - Optional - Filters divisions by house ('senate' or 'house_of_representatives'). ### Request Example ```json { "example": "GET https://api.example.com/v1/divisions.json?key=[api_key]" } ``` ```json { "example": "GET https://api.example.com/v1/divisions.json?key=[api_key]&start_date=2014-08-01&end_date=2014-09-01&house=senate" } ``` ### Response #### Success Response (200) - **id** (integer) - A unique identifier for the division. - **house** (string) - The house where the division took place ('senate' or 'house_of_representatives'). - **name** (string) - A short name for the division. - **date** (string) - The date of the division (format: `yyyy-mm-dd`). - **number** (integer) - The division number for that day and house. - **clock_time** (string or null) - The time of the division (format: `hh:mm AM` or `hh:mm PM`). - **aye_votes** (integer) - The number of 'aye' votes. - **no_votes** (integer) - The number of 'no' votes. - **possible_turnout** (integer) - The number of potential voters. - **rebellions** (integer) - The number of votes against the party's majority. - **edited** (boolean) - Indicates if the division summary has been edited. #### Response Example ```json { "example": [ { "id": 1234, "house": "senate", "name": "A Specific Vote", "date": "2023-10-27", "number": 5, "clock_time": "02:30 PM", "aye_votes": 30, "no_votes": 25, "possible_turnout": 76, "rebellions": 2, "edited": false } ] } ``` ``` -------------------------------- ### GET /api/v1/divisions Source: https://context7.com/openaustralia/theyvoteforyou/llms.txt Retrieves a list of parliamentary divisions. Supports filtering by date range and parliamentary house. ```APIDOC ## GET /api/v1/divisions ### Description Retrieves a list of parliamentary divisions with optional filtering by date range and house. ### Method GET ### Endpoint `/api/v1/divisions` #### Query Parameters - **start_date** (string) - Optional - The start date for filtering divisions (YYYY-MM-DD). - **end_date** (string) - Optional - The end date for filtering divisions (YYYY-MM-DD). - **house** (string) - Optional - Filters divisions by house ('representatives' or 'senate'). ### Request Example ```bash curl "https://theyvoteforyou.org.au/api/v1/divisions?start_date=2023-01-01&end_date=2023-12-31&house=representatives" -H "Accept: application/json" ``` ### Response #### Success Response (200) - **id** (integer) - The unique identifier for the division. - **house** (string) - The parliamentary house where the division occurred. - **name** (string) - The name or title of the bill or motion voted on. - **date** (string) - The date the division took place (YYYY-MM-DD). - **number** (integer) - The division number for that day. - **clock_time** (string) - The time of the division. - **aye_votes** (integer) - The number of 'Aye' votes. - **no_votes** (integer) - The number of 'No' votes. - **possible_turnout** (integer) - The total number of members eligible to vote. - **rebellions** (integer) - The number of members who voted against their party line. - **edited** (boolean) - Indicates if the division has been edited or corrected. #### Response Example ```json [ { "id": 12345, "house": "representatives", "name": "Environment Protection and Biodiversity Conservation Amendment Bill 2023", "date": "2023-06-15", "number": 3, "clock_time": "4:30 PM", "aye_votes": 76, "no_votes": 72, "possible_turnout": 151, "rebellions": 2, "edited": true } ] ``` ``` -------------------------------- ### Create Policy with Description Source: https://github.com/openaustralia/theyvoteforyou/blob/main/spec/mailers/regression/alert_mailer/email1.html This snippet demonstrates how to create a new policy with a given description. It is typically used in a web application context where user actions trigger backend processes. ```html

Created policy "red being a nice colour" with description "there should be fabulous test policies".

``` -------------------------------- ### CSS for Page Styling and Layout Source: https://github.com/openaustralia/theyvoteforyou/blob/main/spec/mailers/regression/alert_mailer/email2.html This CSS code provides styling for various HTML elements, including margins, padding, fonts, images, body, tables, and containers. It defines styles for headers, footers, content blocks, alerts, invoices, and includes media queries for responsive design on smaller screens. No external dependencies are noted. ```CSS *{margin:0;padding:0;font-family:"Helvetica Neue", "Helvetica", Helvetica, Arial, sans-serif;box-sizing:border-box;font-size:16px}img{max-width:100%}body{-webkit-font-smoothing:antialiased;-webkit-text-size-adjust:none;width:100% !important;height:100%;line-height:1.6}table td{vertical-align:top}body{background-color:#f6f6f6}.body-wrap{background-color:#f6f6f6;width:100%}.container{display:block !important;max-width:600px !important;margin:0 auto !important;clear:both !important}.content{max-width:600px;margin:0 auto;display:block;padding:20px}.main{background:#fff;border:1px solid #e9e9e9;border-radius:3px}.content-wrap{padding:20px}.content-block{padding:0 0 20px}.header{width:100%;margin-bottom:20px}.footer{width:100%;clear:both;color:#999;padding:20px}.footer a{color:#999}.footer p,.footer a,.footer unsubscribe,.footer td{font-size:12px}h1,h2,h3{font-family:"Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;color:#000;margin:40px 0 0;line-height:1.2;font-weight:400}h1{font-size:32px;font-weight:500}h2{font-size:24px}h3{font-size:18px}h4{font-size:16px;font-weight:600}.unstyled-heading{font-size:16px;margin:0 0 10px;font-weight:normal}.heading-object-link{text-decoration:none}p,ul,ol{margin-bottom:10px;font-weight:normal}p li,ul li,ol li{margin-left:5px;list-style-position:inside}.small{font-size:14px}a{color:#348eda;text-decoration:underline}.btn-primary{text-decoration:none;color:#FFF;background-color:#348eda;border:solid #348eda;border-width:10px 20px;line-height:2;font-weight:bold;text-align:center;cursor:pointer;display:inline-block;border-radius:5px;text-transform:capitalize}.last{margin-bottom:0}.first{margin-top:0}.aligncenter{text-align:center}.alignright{text-align:right}.alignleft{text-align:left}.clear{clear:both}.text-muted{color:#666666}.alert{font-size:16px;color:#fff;font-weight:500;padding:20px;text-align:center;border-radius:3px 3px 0 0}.alert a{color:#fff;text-decoration:none;font-weight:500;font-size:16px}.alert.alert-warning{background:#ff9f00}.alert.alert-bad{background:#d0021b}.alert.alert-good{background:#68b90f}.invoice{margin:40px auto;text-align:left;width:80%}.invoice td{padding:5px 0}.invoice .invoice-items{width:100%}.invoice .invoice-items td{border-top:#eee 1px solid}.invoice .invoice-items .total td{border-top:2px solid #333;border-bottom:2px solid #333;font-weight:700}@media only screen and (max-width: 640px){h1,h2,h3,h4{font-weight:600 !important;margin:20px 0 5px !important}h1{font-size:22px !important}h2{font-size:18px !important}h3{font-size:16px !important}.container{width:100% !important}.content,.content-wrap{padding:10px !important}.invoice{width:100% !important}} ``` -------------------------------- ### GET /api/v1/people/{id} Source: https://context7.com/openaustralia/theyvoteforyou/llms.txt Retrieves detailed information about a specific person, including their parliamentary membership history. ```APIDOC ## GET /api/v1/people/{id} ### Description Retrieves detailed information about a specific person including their parliamentary membership history. ### Method GET ### Endpoint `/api/v1/people/{id}` #### Path Parameters - **id** (integer) - Required - The unique identifier of the person. ### Request Example ```bash curl "https://theyvoteforyou.org.au/api/v1/people/567" -H "Accept: application/json" ``` ### Response #### Success Response (200) - **id** (integer) - The unique identifier for the person. - **latest_member** (object) - Contains information about the person's latest parliamentary membership. - **id** (integer) - The ID of the latest membership record. - **name** (object) - The name of the member. - **first** (string) - The first name. - **last** (string) - The last name. - **electorate** (string) - The electorate the member represents. - **house** (string) - The parliamentary house the member belongs to. - **party** (string) - The political party the member belongs to. #### Response Example ```json { "id": 567, "latest_member": { "id": 890, "name": { "first": "Anthony", "last": "Albanese" }, "electorate": "Grayndler", "house": "representatives", "party": "Australian Labor Party" } } ``` ``` -------------------------------- ### Create First Admin User via Rails Console Source: https://github.com/openaustralia/theyvoteforyou/blob/main/README.md This snippet demonstrates how to create the first administrative user in a Rails application using the Rails console. It requires environment setup and specific commands to find and update user attributes. Ensure you substitute the correct email address for your user. ```ruby deploy@hostname:/srv/www/production/current$ RAILS_ENV=production bundle exec rails c Loading production environment (Rails 8.0.2) 3.4.4 :001 > User.find_by(email: "matthew@oaf.org.au") => # 3.4.4 :002 >$ bundle exec rails c irb> User.find_by(email: "matthew@oaf.org.au").update(admin: true) ``` -------------------------------- ### GET /api/v1/policies Source: https://github.com/openaustralia/theyvoteforyou/blob/main/app/views/api/v1/policies/_docs_index.md Fetches a list of policies. If authenticated, it uses your API key. Otherwise, it requires a placeholder API key. ```APIDOC ## GET /api/v1/policies ### Description Retrieves basic information about policies. ### Method GET ### Endpoint /api/v1/policies ### Query Parameters - **key** (string) - Required - Your API key for authentication. ### Response #### Success Response (200) - **id** (integer) - A unique identifier for this policy. - **name** (string) - A short name for the policy. - **description** (string) - More detail on what the policy means. - **provisional** (boolean) - Indicates if the policy is provisional. - **last_edited_at** (string) - Time the policy was last edited in ISO 8601 format. #### Response Example { "policies": [ { "id": 1, "name": "Climate Change Policy", "description": "Policies related to addressing climate change.", "provisional": false, "last_edited_at": "2023-10-27T10:00:00Z" } ] } ``` -------------------------------- ### API: Get Single Policy Source: https://context7.com/openaustralia/theyvoteforyou/llms.txt Retrieves detailed information about a specific voting policy. Returns a JSON object representing the policy. ```bash curl "https://theyvoteforyou.org.au/api/v1/policies/1" \ -H "Accept: application/json" ```