{"id":21142176,"url":"https://github.com/resultadosdigitais/paddy-elixir","last_synced_at":"2026-03-16T16:32:45.717Z","repository":{"id":41950252,"uuid":"180646502","full_name":"ResultadosDigitais/paddy-elixir","owner":"ResultadosDigitais","description":"Elixir wrapper around GCP Pub Sub","archived":false,"fork":false,"pushed_at":"2024-11-06T12:23:18.000Z","size":17,"stargazers_count":10,"open_issues_count":1,"forks_count":1,"subscribers_count":85,"default_branch":"master","last_synced_at":"2024-11-06T13:31:40.741Z","etag":null,"topics":["elixir","google-cloud-platform","google-pubsub"],"latest_commit_sha":null,"homepage":"","language":"Elixir","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/ResultadosDigitais.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":"CODEOWNERS","security":null,"support":null}},"created_at":"2019-04-10T19:05:15.000Z","updated_at":"2023-06-10T16:16:24.000Z","dependencies_parsed_at":"2022-08-12T00:21:52.374Z","dependency_job_id":null,"html_url":"https://github.com/ResultadosDigitais/paddy-elixir","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ResultadosDigitais%2Fpaddy-elixir","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ResultadosDigitais%2Fpaddy-elixir/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ResultadosDigitais%2Fpaddy-elixir/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ResultadosDigitais%2Fpaddy-elixir/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ResultadosDigitais","download_url":"https://codeload.github.com/ResultadosDigitais/paddy-elixir/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":225489495,"owners_count":17482378,"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":["elixir","google-cloud-platform","google-pubsub"],"created_at":"2024-11-20T07:44:11.750Z","updated_at":"2026-03-16T16:32:45.672Z","avatar_url":"https://github.com/ResultadosDigitais.png","language":"Elixir","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Paddy Elixir\n\nThis library intent is to create a wrapper and send data to a Google Pub Sub topic.\n\n## Installation\n\nAdd the `paddy` lib to your list of dependencies in `mix.exs`:\n\n```elixir\ndef deps do\n  [\n    {:paddy, github: \"ResultadosDigitais/paddy-elixir\", tag: \"0.1.0\"}\n  ]\nend\n```\n\n**Disclaimer**\n\nIt will install three dependencies:\n\n - `google_api_pub_sub` Publish data to Google Pub Sub\n - `goth` Auth with google\n - `mock` (only for test env)\n\n## Configuration\n\nIn the application that will use the `paddy` lib, you need to set some configurations that will be used for `paddy`, `google_api_pub_sub` and `goth`.\n\nFirst you need to create and download your own credentials in Google Cloud Platform [click here for more information](https://cloud.google.com/genomics/docs/how-tos/getting-started).\n\nOnce you download your `credentials.json` file you are ready to set all configurations.\n\n### Development/Test environment\n\n- Inside `YOUR_APP_LIB/config` copy or create a new `json` file with the same content of `credentials.json`\n- In the `app/config/dev.exs` and `app/config/test.exs` put the code:\n\n```elixir\nconfig :goth,\n  json: \"#{Path.dirname(__DIR__)}/config/YOUR_CREDENTIALS_FILE.json\" |\u003e File.read!()\n```\n\n### Production/Staging enviroment\n\nFirst you need to set the `goth` configuration properly. You can follow the [Goth documentation](https://github.com/peburrows/goth#goth) and config the `goth` lib as you want.\n\nYou need to set the `paddy` configuration for `project_id` and `topic_id` that will be used internally to publish data to the given topic.\n\n- In the `YOUR_APP_LIB/config/staging.exs` and `YOUR_APP_LIB/config/prod.exs` put the code:\n\n```elixir\nconfig :paddy,\n  project_id: \"some-project-id\",\n  topic_id: \"some-topic\"\n```\n\n### Using\n\n\u003e The lib is only responsible to receive the data and publish it to the previously set project_id/topic_id, the list IS NOT responsible to transform and mount the format, this step must be done by the application that will use `paddy`.\n\nSee an example of how to use Paddy in the `iex` console.\n\n```elixir\niex\u003e version = :v1\niex\u003e company_id = :rand.uniform(100)\niex\u003e event_type = \"foobar_event\"\niex\u003e payload = %{id: 1, name: \"foobar\"}\niex\u003e event_timestamp = ~N[2018-08-01 22:15:07]\niex\u003e params = %{\n  version: :v1,\n  company_id: company_id,\n  event_type: event_type,\n  event_timestamp: event_timestamp,\n  payload: payload\n}\niex\u003e data = %{\n  event_type: \"#{:v1}_foobar_event\",\n  event_identifier: payload[:id],\n  event_timestamp: event_timestamp,\n  tenant_id: company_id,\n  event_family: \"SOME_FAMILY\",\n  payload: payload\n}\niex\u003e alias Paddy\niex\u003e Paddy.publish(data)\niex\u003e {:ok,%GoogleApi.PubSub.V1.Model.PublishResponse{messageIds: [\"SOME_MESSAGE_ID\"]}}\n```\n\n### Development\n\nTo improve the lib or run the tests locally you also will need to create a credential file and put if inside `config/YOU_CREDENTIALS_FILE.json`, recommended name\nfor this file is `google-pub-sub-fake-data.json`. If you pick another name, you need to change the path for the file inside `config/test.exs`.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fresultadosdigitais%2Fpaddy-elixir","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fresultadosdigitais%2Fpaddy-elixir","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fresultadosdigitais%2Fpaddy-elixir/lists"}