{"id":21482602,"url":"https://github.com/rimian/events","last_synced_at":"2025-03-17T09:22:11.664Z","repository":{"id":136254741,"uuid":"202328075","full_name":"rimian/events","owner":"rimian","description":null,"archived":false,"fork":false,"pushed_at":"2019-08-17T09:46:14.000Z","size":37,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-01-23T18:50:31.790Z","etag":null,"topics":["ruby"],"latest_commit_sha":null,"homepage":null,"language":"Ruby","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/rimian.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":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-08-14T10:25:48.000Z","updated_at":"2019-08-19T01:13:37.000Z","dependencies_parsed_at":null,"dependency_job_id":"2fdc50d6-4150-4c21-9157-f6f769638962","html_url":"https://github.com/rimian/events","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/rimian%2Fevents","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rimian%2Fevents/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rimian%2Fevents/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rimian%2Fevents/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rimian","download_url":"https://codeload.github.com/rimian/events/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244006303,"owners_count":20382443,"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":["ruby"],"created_at":"2024-11-23T12:34:41.377Z","updated_at":"2025-03-17T09:22:11.644Z","avatar_url":"https://github.com/rimian.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Schedule\n\nThis gem takes dates strings and checks if they collide with a pre-booked schedule.\n\nSee usage below.\n\n A week is insignificant, day and time is significant. Meaning that an event on Friday 21st Dec, 1:00 - 1:30pm will clash with an event on Friday 28th Dec – 1:00-3:00pm, as they are on the same day of the week and overlap time despite being in separate weeks.\n\n# Installation\n\n`gem install schedule`\n\n## Usage\n\n`pry`\n\n`pry(main)\u003e require 'schedule'` # true\n\n### Add some dates:\n\nCreate an event:\n\nWhere start and end dates are valid date strings that can be parsed by `DateTime`\n\n```\nschedule = Schedule.new\navailable = Event.new(start_state, end_date)\nbooked = Event.new(start_state, end_date)\n```\n\n```\nschedule.events \u003c\u003c available\nschedule.booked \u003c\u003c booked\n```\n\nRun it:\n\n`schedule.not_booked`\n\nHuman readable:\n\n`schedule.not_booked.map(\u0026:to_s)`\n\n##Exanple\n\n```\nalready_booked = [\n  Event.new('2018-12-19 16:00:00', '2018-12-19 17:00:00'),\n  Event.new('2018-12-20 9:00:00', '2018-12-20 10:00:00')\n]\n\navailable = [\n  Event.new('2018-12-19 16:00:00', '2018-12-19 17:00:00'),\n  Event.new('2018-12-20 9:30:00', '2018-12-20 11:30:00'),\n  Event.new('2018-12-21 9:00:00', '2018-12-20 11:00:00')\n]\n\nschedule = Schedule.new\nschedule.events = available\nschedule.booked = already_booked\nschedule.not_booked.map(\u0026:to_s) # [\"start: 2018-12-21 09:00:00, end: 2018-12-20 11:00:00\"]\n```\n\n## Assumptions\n\n* The date time format can be parsed by `DateTime`\n* The start date is before the end date\n* The dates can be in the past and the future\n* It's a local time zone.\n* The events only have attributes: start and end dates.\n* The list of events is formatted correctly\n* An event has a start and end on the same day\n\n# Improvements\n\n* Parse the dates and send `DateTime` to `Events`\n* Support events on more than one day\n* Fix the mistake in the data in the example.\n* Validate events \n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frimian%2Fevents","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frimian%2Fevents","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frimian%2Fevents/lists"}