{"id":17794174,"url":"https://github.com/pyk/pemilu","last_synced_at":"2025-03-16T20:31:20.211Z","repository":{"id":14602263,"uuid":"17319408","full_name":"pyk/pemilu","owner":"pyk","description":"A beautiful Ruby interface of Pemilu APIs","archived":false,"fork":false,"pushed_at":"2014-09-14T14:20:00.000Z","size":503,"stargazers_count":9,"open_issues_count":0,"forks_count":2,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-02-27T13:21:01.362Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://pemiluapi.org","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pyk.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-03-01T16:56:45.000Z","updated_at":"2015-12-08T11:37:53.000Z","dependencies_parsed_at":"2022-08-26T22:23:03.293Z","dependency_job_id":null,"html_url":"https://github.com/pyk/pemilu","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyk%2Fpemilu","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyk%2Fpemilu/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyk%2Fpemilu/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pyk%2Fpemilu/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pyk","download_url":"https://codeload.github.com/pyk/pemilu/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243830912,"owners_count":20354848,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-27T11:15:23.067Z","updated_at":"2025-03-16T20:31:19.698Z","avatar_url":"https://github.com/pyk.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# pemilu [![Gem Version](https://badge.fury.io/rb/pemilu.png)](http://badge.fury.io/rb/pemilu) [![Build Status](https://travis-ci.org/pyk/pemilu.png?branch=master)](https://travis-ci.org/pyk/pemilu)  [![Dependency Status](https://gemnasium.com/pyk/pemilu.png)](https://gemnasium.com/pyk/pemilu) [![Code Climate](https://codeclimate.com/github/pyk/pemilu.png)](https://codeclimate.com/github/pyk/pemilu) [![Coverage Status](https://coveralls.io/repos/pyk/pemilu/badge.png)](https://coveralls.io/r/pyk/pemilu)\n\nA beautiful Ruby interface of [Pemilu APIs](http://pemiluapi.org)\n\n\u003e IMPORTANT : This gem is no longer maintaned by me. \n\u003e Feel Free to fork and send PR\n\n\n### Update 9 Mar 2014\n[Developer Pemilu APIs](http://developer.pemiluapi.org/) has published a bunch of [**new excellent** API endpoints](http://developer.pemiluapi.org/endpoints), my planning is to released pemilu gem v2.0.0 to support all those APIs. so far i already implemented [Pertanyaan API V1](http://developer.pemiluapi.org/endpoints), [see here](https://github.com/pyk/pemilu/commit/7902a68d7f3eb4ff62c9fba13177c37cfdb4b826). for the other APIs are in proccess. If you already extend this gem to support all those APIs, feel free to submit pull request.\n\n\n## Contents\n- [About PEMILU APIs 2014][apa2]\n- [Installation][in]\n- [How to use pemilu gem][ht]\n  - [Configure API key][c]\n  - [APIs][a]\n    - **Candidate APIs**\n      - [List of Candidate attributes][ca]\n      - [Get list of all Candidates][g]\n      - [#candidates usage example][cux]\n      - [Get details of Candidate][gdoc]\n      - [#candidate usage example][cue]\n    - **Party APIs**\n      - [List of Party attributes][lop]\n      - [Get list of all Parties][gloap]\n      - [#parties usage example][psue]\n      - [Get details of Party][gdop]\n      - [#party(id) usage example][pue] \n    - **Province APIs**\n      - [List of Province attributes][lopa]\n      - [Get list of all Provinces][gloapv]\n      - [#provinces usage example][pvue]\n      - [Get details of Province][gopv]\n      - [#province(id) usage example][pvue]\n    - **Electoral District APIs**\n      - [List of Electoral District attributes][loeda]\n      - [Get list of all Electoral Districts][adom1]\n      - [#electoral_districts usage example][adom2]\n      - [Get details of Electoral District][adom3]\n      - [#electoral_district(id) usage example][adom4]\n  - [Exception Handling][eh]\n      - [Invalid API key][invkey]\n      - [ID Didn't exist][ide]\n- [Changelog][cnge]\n- [Author][auth]\n- [License][licn]\n\n[apa2]: https://github.com/pyk/pemilu#pemilu-apis-2014\n[cnge]: https://github.com/pyk/pemilu#changelog\n[in]: https://github.com/pyk/pemilu#installation\n[ht]: https://github.com/pyk/pemilu#how-to-use-pemilu-gem\n[c]: https://github.com/pyk/pemilu#configure\n[a]: https://github.com/pyk/pemilu#apis\n[ca]: https://github.com/pyk/pemilu#list-of-candidate-attributes-object\n[g]: https://github.com/pyk/pemilu#get-list-of-all-candidates\n[cux]: https://github.com/pyk/pemilu#candidate-usage-example\n[gdoc]: https://github.com/pyk/pemilu#get-details-of-candidate\n[cue]: https://github.com/pyk/pemilu#candidate-usage-example\n[si]: https://github.com/pyk/pemilu#still-in-active-development\n[lop]: https://github.com/pyk/pemilu#list-of-party-attributes-object\n[gloap]: https://github.com/pyk/pemilu#get-list-of-all-parties\n[psue]: https://github.com/pyk/pemilu#parties-usage-example\n[gdop]: https://github.com/pyk/pemilu#get-details-of-party\n[pue]: https://github.com/pyk/pemilu#partyid-usage-example\n[lopa]: https://github.com/pyk/pemilu#list-of-province-attributes-object\n[gloapv]: https://github.com/pyk/pemilu#get-list-of-all-provinces\n[pvue]: https://github.com/pyk/pemilu#provinceid-usage-example\n[gopv]: https://github.com/pyk/pemilu#get-details-of-province\n[loeda]: https://github.com/pyk/pemilu#list-of-electoral-district-attribute\n[adom1]: https://github.com/pyk/pemilu#get-list-of-all-electoral-district\n[adom2]: https://github.com/pyk/pemilu#electoral_districts-usage-example\n[adom3]: https://github.com/pyk/pemilu#get-details-of-electoral-district\n[adom4]: https://github.com/pyk/pemilu#electoral_districtid-usage-example\n[eh]: https://github.com/pyk/pemilu#exception-handling\n[auth]: https://github.com/pyk/pemilu#author\n[licn]: https://github.com/pyk/pemilu#license\n[invkey]: https://github.com/pyk/pemilu#invalid-api-key\n[ide]: https://github.com/pyk/pemilu#id-didnt-exist\n\n## PEMILU APIs 2014\n\u003e As many as 180 million people are registered to vote in Indonesia's 2014 elections. An estimated 67 million of those people will be voting for the first time.\n\u003e Voters need answers. Am I registered? Where do candidates stand on the issues that are important to me? How do I mark the ballot? What can I do if I'm having trouble voting?\n\u003e To answer those questions, and many more, we're helping to build an open repository of information for Indonesian voters in 2014 — an elections API. - [PEMILU APIs 2014](http://pemiluapi.org/index-en.html)\n\n## Installation\nAdd this line to your application's Gemfile:\n\n```ruby\n    gem 'pemilu'\n```\n\nAnd then execute:\n\n```shell\n    $ bundle\n```\n\nOr install it yourself as:\n\n```shell\n    $ gem install pemilu\n```\n\n## How to use pemilu gem\n\n### Configure\nBefore accessing all available [APIs](#contents) make sure Configure your API key first.\n\n``` ruby\n    require \"pemilu\"\n\n    pemilu = Pemilu::API.new(key: \"YOUR API KEY\")\n```\n\n### APIs\n\n#### List of Candidate attributes object\nList of available attribute to each candidate that you can get some information\nabout candidate itself. For example `candidate.id` will display id of candidate.\n\n| Attribute | Return | Description | `#candidates` | `#candidate` |\n| --------- | ------ | ----------- | ------------- | ------------ |\n| `id` | String | ID of Candidate | x | x |\n| `name` | String | Name of Candidate | x | x |\n| `gender` | String | Gender of Candidate | x | x |\n| `religion`| String | Religion of Candidate | x | x |\n| `birthplace` | String | Birthplace of Candidate | x | x |\n| `date_of_birth` | String | Date of Candidate birth | x | x |\n| `marital_status`| String | Marital status of Candidate | x | x |\n| `name_of_couples`| String | Name of Candidate couples | x | x |\n| `number_of_children` | Integer | Number of Candidate children | x | x |\n| `village` | String | Village where Candidate live | x | x |\n| `sub_district` | String | Sub district where Candidate live | x | x |\n| `district`| String | District where Candidate live | x | x |\n| `province`| Hash | Province where Candidate live | x | x |\n| `electoral_district` | Hash | Electoral district where Candidate running on | x | x |\n| `election_year`| Integer | Election year where Candidate running on | x | x |\n| `legislative_body` | String | Legislative body where Candidate running on (ex. DPR) | x | x |\n| `party` | String | Party of Candidate | x | - |\n| `party` | Hash | Party of Candidate | - | x |\n| `ordinal` | Integer | Ordinal of Candidate | x | x |\n| `picture` | String | URL of Candidate picture | x | x |\n| `educations` | Array | List of Candidate education history | - | x |\n| `jobs` | Array | List of Candidate job history | - | x |\n| `organizations` | Array | List of Candidate organization history | - | x |\n\ndescription:\n- `x` mark is sign this attribute available when return from `#candidates` or `#candidate`\n- `-` mark is sign this attribute `nil` when return from `#candidates` or `#candidate`\n\n#### Get list of all candidates\nReturn an array of `Pemilu::Candidate` object that filtered by declared option.\n\n```ruby\n    pemilu.candidates(options = {})\n```\n##### Available options\n\n| Option | Value | Default | Description | Return |\n| ------ | ----- | ------- | ----------- | ------ |\n| `name` | String | `nil`| String full or partial name of the candidate | Only all candidates that matching with `name` |\n| `party` | String | `nil` | Name of the available party | Only all candidates on the `party` |\n| `electoral_district` | String | `nil`| ID of electoral district (daerah pilihan) | Only all candidates that running on electoral district |\n| `election_year` | Integer | `nil` | Election year (tahun pemilihan)of candidate | Only all candidates that running on election year|\n| `province` | String | `nil` | ID of the Province | Only all candidates that running on `province` |\n| `gender` | String | `nil` | `\"L\"` for man and `\"W\"` for woman|Only all candidates has `gender` specified |\n| `religion` | String | `nil` | Religion of the candidate | Only all candidates that have religion specified |\n| `legislative_body` | String | `nil` | Legislative body that the candidate is running for | Only all candidates that running on that legislative body |\n| `limit` | Integer | `100` | Number of records to return | All candidates on specific limit number |\n| `offset` | Integer | `nil` | Number the offset | All candidates from beginning of the offset number |\n\n#### `#candidates` usage example\n\n```ruby\n    # get 10 man candidates\n    pemilu.candidates(limit: 10, gender: \"L\")\n\n    # print some information about 2 candidates with Islam religion\n    candidates = pemilu.candidates(limit:2, religion: \"ISLAM\")\n    candidates.each do |candidate|\n      puts \"Name: #{candidate.name}\"\n      puts \"Regligion: #{candidate.religion}\"\n    end\n```\n\n#### Get details of Candidate\nReturn an object of `Pemilu::Candidate` with an `id` specified.\n\n```ruby\n    pemilu.candidate(\"ID CANDIDATE\")\n```\n\nID Candidate must be String. like this `\"1101-00-0000-0102\"`\n\n#### `#candidate` usage example\n\n```ruby\n    # print some information about Candidate with id=1101-00-0000-0102\n    candidate = pemilu.candidate(\"1101-00-0000-0102\")\n    puts \"Name: #{candidate.name}\"\n```\n\n#### List of Party attributes object\nList of available attribute to each Party that you can use for get some information\nabout party itself. For example `party.id` will display id of party.\n\n| Attribute | Return | Decription | `#parties` | `#party` |\n| --------- | ------ | ---------- | ---------- | -------- |\n| `id` | Integer | ID of Party | x | x |\n| `nick_name` | String | Nick name or abbreviation of Party | x | x |\n| `full_name` | String | Full name of Party | x | x |\n| `url` | String | URL to Party homepage | x | x |\n| `facebook` | String | URL to Party facebook page | x | x |\n| `twitter` | String | URL to Party twitter page | x | x |\n\ndescription:\n- `x` mark is sign this attribute available when return from `#parties` or\n  `#party`\n- `-` mark is sign this attribute `nil` when return from `#parties` or `#party`\n\n#### Get list of all Parties\nReturn an array of `Pemilu::Party` object.\n\n```ruby\n    # get all parties\n    pemilu.parties\n    #=\u003e [#\u003cPemilu::Party:0xb833bfcc....]\n```\n\n#### `#parties` usage example\n\n```ruby\n    # print name and facebook url each for each party\n    pemilu.parties.each do |party|\n      puts \"Party name: #{party.full_name}\"\n      puts \"Party facebook: #{party.facebook}\"\n    end\n```\n\n#### Get details of Party\nReturn one object of Pemilu::Party specified by ID.\n\n```ruby\n    pemilu.party(\"ID PARTY\")\n```\n\n`ID PARTY` must be an Integer.\n\n#### `#party(id)` usage example\n\n```ruby\n    # print information about Partai Demokrasi Indonesia Perjuangan\n    pdip = pemilu.party(4)\n\n    puts pdip.id #=\u003e 4\n    puts pdip.nick_name #=\u003e PDI-P\n    puts pdip.full_name #=\u003e Partai Demokrasi Indonesia Perjuangan\n    puts pdip.facebook #=\u003e https://www.facebook.com/DPP.PDI.Perjuangan\n    puts pdip.twitter #=\u003e https://twitter.com/pdi_perjuangan\n```\n\n#### List of Province attributes object\nList of available attribute to each Province that you can use for get some information\nabout province itself. For example `province.id` will display id of province.\n\n| Attribute | Return | Decription | `#provinces` | `#province` |\n| --------- | ------ | ---------- | ---------- | -------- |\n| `id` | Integer | ID of Province | x | x |\n| `name` | String | Nick Name of Province | x | x |\n| `full_name` | String | Full Name of Province | x | x |\n| `international_name` | String | International Name (English) of Province | x | x |\n| `available_chairs` | Integer | Availalble chairs for Candidates | x | x |\n| `population` | Integer | Population of Province | x | x |\n| `electoral_district` | Array | List of Electoral District on Province | - | x |\n\ndescription:\n- `x` mark is sign this attribute available when return from `#provinces` or\n  `#province`\n- `-` mark is sign this attribute `nil` when return from `#provinces` or `#province`\n\n#### Get list of all Provinces\nReturn an array of `Pemilu::Province` object.\n\n```ruby\n    # get all provinces\n    pemilu.provinces\n    #=\u003e [#\u003cPemilu::Province:0xb8c4ceb8....]\n```\n\n#### `#provinces` usage example\n\n```ruby\n    # print id and international name of each province\n    pemilu.provinces.each do |province|\n      puts \"ID: #{province.id}\"\n      puts \"Internatioal Name: #{province.international_name}\"\n    end\n```\n\n#### Get details of Province\nReturn one object of Pemilu::Province specified by ID.\n\n```ruby\n    pemilu.province(\"ID PROVINCE\")\n```\n\n`ID PROVINCE` must be an Integer.\n\n#### `#province(id)` usage example\n\n```ruby\n    # print information about Special Region of Aceh\n    aceh = pemilu.province(11)\n\n    puts aceh.id #=\u003e 11\n    puts aceh.name #=\u003e Aceh\n    puts aceh.international_name #=\u003e Special Region of Aceh\n```\n\n#### List of Electoral District attribute\nList of available attribute to each Electoral District that you can use for get some information\nabout Electoral District itself. For example `ed.id` will display id of Electoral District.\n\n| Attribute | Return | Decription | `#electoral_districts` | `#electoral_district` |\n| --------- | ------ | ---------- | ---------- | -------- |\n| `id` | String | ID of Electoral District | x | x |\n| `name` | String | Name or Electoral District | x | x |\n| `legislative_body` | String | Legislative body of Electoral District | x | x |\n| `available_chairs` | Integer | Number of available chairs in Electoral District| x | x |\n| `population` | Integer | Population in Electoral District | x | x |\n| `province` | Hash | Province of Electoral District | x | X |\n| `province.id` | Integer | Province id of Electoral District | x | x |\n| `province.name` | String | Province name of Electoral District | x | x |\n\n\ndescription:\n- `x` mark is sign this attribute available when return from `#parties` or\n  `#party`\n- `-` mark is sign this attribute `nil` when return from `#parties` or `#party`\n\n### Get list of all electoral district\nReturn an array of `Pemilu::ElectoralDistrict` object that filtered by declared option.\n\n```ruby\n    pemilu.electoral_districts(options = {})\n```\n##### Available options\n\n| Option | Value | Default | Description | Return |\n| ------ | ----- | ------- | ----------- | ------ |\n| `province` | String | `nil`| Name of province | Only all electoral district in `province` |\n| `legislative_body` | String | `nil` | Legislative body of Electoral District | Only all electoral district that have specified legislative body |\n\n#### `#electoral_districts` usage example\n\n```ruby\n    # get electoral district on Aceh province\n    pemilu.electoral_districts(province: \"Aceh\")\n```\n\n#### Get details of Electoral District\nReturn one object of Pemilu::ElectoralDistrict specified by ID.\n\n```ruby\n    pemilu.electoral_district(\"ID ELETORAL DISTRICT\")\n```\n\n`ID ELECTORAL DISTRICT` should be String. Like this `\"1101-00-0000\"` \n\n#### `#electoral_district(id)` usage example\n\n```ruby\n    # print information about Aceh I electoral district\n    ed = pemilu.electoral_district(\"1101-00-0000\")\n\n    puts ed.id #=\u003e 1101-00-0000\n    puts ed.legislative_body #=\u003e DPR\n    puts ed.available_chairs #=\u003e 7\n    puts ed.population #=\u003e 2642760\n```\n\n### Exception Handling\n#### Invalid API key\nIf you are using Invalid API key, all your request will return\n    \n    Invalid request error. Please check your API key\n\n##### ID Didn't exist\nIf you are requesting ID for Candidate, Party, Province or Electoral District that didn't exist, your request will return\n\n    Can't get OBJECT with id: ID\n\nnote: `OBJECT` and `ID` are depend on your request. if you are requesting `party(s)` the return will like this\n    \n    Can't get Party with id: s\n\n## Changelog\n##### 1.0.1 March 3, 2014\n- add Handling Exception for Invalid APIs \u0026 ID object Didn't exist\n\n##### 1.0.0 March 2, 2014\n- initial relase\n- support all available APIs on [Pemilu APIs][paps]\n\n[paps]: https://github.com/pemiluAPI/calon-api-endpoint/blob/master/APIBLUEPRINT.md\n\n##### 0.5.1 March 1, 2014\n- pre-release\n- only support Candidate APIs\n\n\n## Author\n| Author |\n| ---------------- |\n|Bayu Aldi Yansyah |\n|S1 Matematika, 2013, Universitas Airlangga |\n|[@peeyek](https://twitter.com/peeyek) |\n\n## License\nMIT (c) 2014 Bayu Aldi Yansyah\n\n[![Analytics](https://ga-beacon.appspot.com/UA-50800627-1/pemilu/readme)](https://github.com/igrigorik/ga-beacon)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyk%2Fpemilu","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpyk%2Fpemilu","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpyk%2Fpemilu/lists"}