{"id":19541927,"url":"https://github.com/nullscreen/movida_events","last_synced_at":"2025-09-12T04:44:43.907Z","repository":{"id":56884632,"uuid":"162165503","full_name":"nullscreen/movida_events","owner":"nullscreen","description":"A BeBanjo Movida event stream processor","archived":false,"fork":false,"pushed_at":"2023-04-27T16:40:13.000Z","size":43,"stargazers_count":0,"open_issues_count":0,"forks_count":2,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-08-15T08:36:39.262Z","etag":null,"topics":["bebanjo","events","movida","poller"],"latest_commit_sha":null,"homepage":null,"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/nullscreen.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2018-12-17T17:18:15.000Z","updated_at":"2022-09-10T02:48:00.000Z","dependencies_parsed_at":"2023-07-12T17:00:45.306Z","dependency_job_id":null,"html_url":"https://github.com/nullscreen/movida_events","commit_stats":null,"previous_names":["machinima/movida_events"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/nullscreen/movida_events","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullscreen%2Fmovida_events","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullscreen%2Fmovida_events/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullscreen%2Fmovida_events/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullscreen%2Fmovida_events/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nullscreen","download_url":"https://codeload.github.com/nullscreen/movida_events/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nullscreen%2Fmovida_events/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":274755531,"owners_count":25343290,"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","status":"online","status_checked_at":"2025-09-12T02:00:09.324Z","response_time":60,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["bebanjo","events","movida","poller"],"created_at":"2024-11-11T03:12:22.219Z","updated_at":"2025-09-12T04:44:43.868Z","avatar_url":"https://github.com/nullscreen.png","language":"Ruby","readme":"# MovidaEvents\n\n[![Gem Version](https://badge.fury.io/rb/movida_events.svg)](https://badge.fury.io/rb/movida_events)\n[![CI](https://github.com/nullscreen/movida_events/workflows/CI/badge.svg)](https://github.com/nullscreen/movida_events/actions?query=workflow%3ACI+branch%main)\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/5c70b27a9f874f34b522c3b6589b1266)](https://www.codacy.com/gh/nullscreen/movida_events/dashboard)\n[![Code Coverage](https://codecov.io/gh/nullscreen/movida_events/branch/main/graph/badge.svg?token=24N4OJWF0Q)](https://codecov.io/gh/nullscreen/movida_events)\n\nA BeBanjo Movida event stream processor\n\n## Documentation\n\nRead below to get started, or see the [API Documentation][api-docs] for more\ndetails.\n\n[api-docs]: https://www.rubydoc.info/github/nullscreen/movida_events\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'movida_events'\n```\n\n## Usage\n\n```ruby\nrequire 'movida_events'\n\nclient = MovidaEvents::Client.new(username: 'my_user', password: 'my_pass')\npoller = MovidaEvents::Poller.new(client)\npoller.poll do |event|\n  puts event.inspect\nend\n```\n\nAbove, we first create a `Client` object. This serves as the interface between\nthe poller and Movida. We then create a `Poller` object with that client. Then\nusing the `poll` method, we print each event.\n\nBy default, the Poller only processes events that occur after the poller has\nstarted.\n\n### Starting at after a given event\n\nUsually, you want to keep track of which event was processed last, so that you\ncan ensure that every event gets processed. Use the `newer_than` option to tell\nthe poller to process all events after a given ID.\n\n```ruby\nMovidaEvents::Poller.new(client, newer_than: 1234).poll do |event|\n  # All events after (but not including) event 1234 will be processed here\nend\n```\n\n### Filtering event types\n\nYou can limit the types of events by setting the `event_types` option. See\nthe [event type documentation][event-types] for a list of available types.\n\n```ruby\ntypes = ['title_created', 'title_updated']\nMovidaEvents::Poller.new(client, event_types: types).poll do |event|\n  # Only title_created and title_updated events will be processed here\nend\n```\n\nThe `event_types` option also accepts a comma separated string like\n`\"title_created,title_updated\"`.\n\n[event-types]: https://github.com/bebanjo/almodovar/wiki/Movida-Events-Feed#event-type-event-type\n\n### The poll interval\n\nThe poller checks for new events every few seconds. The default poll interval is\n30 seconds, that can be changed with the `interval` option.\n\nNote that even though the poller checks for new events every few seconds, the\nprocessing block will not get called unless there is a new event.\n\n```ruby\n# Polls every 5 seconds to check for new events\nMovidaEvents::Poller.new(client, interval: 5)\n```\n\n### Run code for every poll\n\nThe processing block only gets called if an event is found, but we can use the\n`on_poll` method to set a callback for every time the poller checks for new\nevents. This is especially useful for logging. It could be used to broadcast a\nheartbeat, etc.\n\n\n```ruby\npoller.on_poll do |stats|\n  log(\"Polled #{stats.requests} times\")\nend\npoller.poll\n```\n\nSee below for more information about the `stats` object.\n\n### Stats\n\nThe blocks for `poll` and `on_poll` both accept a stats object. It contains\ninformation about the current poller status. The available methods are:\n\n- last: The ID of the event processed last. In the case of the `poll` method,\n  this is the current event ID.\n- requests: The number of requests processed including the current one.\n- events: The number of events processed including the current one.\n- request\\_events: The number of events processed in the current request\n  including the current one. For `on_poll` this will always be 0.\n\n```ruby\npoller.poll do |event, stats|\n  log(\"Processing event number #{stats.events}\")\nend\n```\n\n### Stopping the poller\n\nUse the `stop` method on the poller to manually stop polling for events. When\n`stop` is called, the poller will finish processing the current request\nincluding the associated events. Then it will exit the poll loop.\n\n```ruby\ntrap('INT') { poller.stop }\npoller.poll do |event, stats|\n  # If the poller is interrupted in the middle of an event, it will finish\n  # processing before stopping\n  log('Processing event')\nend\n\n### Setting the number of times to poll\n\nThe `poll` method accepts an argument `times` that sets how many times it checks\nfor new events. This can be useful for testing.\n\n```ruby\n# Will only check for new events once\nMovidaEvents::Poller.new(client).poll(1) do |event|\nend\n```\n\n### Setting the API domain\n\nThe default API domain is `movida.bebanjo.net`. It can be set to a different\ndomain with the `domain` option in the client object.\n\n```ruby\nMovidaEvents::Client.new(\n  username: 'my_user',\n  password: 'my_pass',\n  domain: 'staging-movida.bebanjo.net'\n)\n```\n\n## Development\n\nYou can run `bin/console` for an interactive prompt that will allow you to\nexperiment.\n\nBefore committing, run `bin/rake` to run the linter and tests.\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnullscreen%2Fmovida_events","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnullscreen%2Fmovida_events","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnullscreen%2Fmovida_events/lists"}