{"id":19780465,"url":"https://github.com/cbetta/uclapi","last_synced_at":"2025-04-30T21:33:24.487Z","repository":{"id":48771481,"uuid":"106100487","full_name":"cbetta/uclapi","owner":"cbetta","description":"Ruby API library for the UCL API","archived":false,"fork":false,"pushed_at":"2023-07-16T06:59:52.000Z","size":21,"stargazers_count":4,"open_issues_count":2,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2024-04-09T15:15:45.704Z","etag":null,"topics":["api","gem","ruby","ucl","university"],"latest_commit_sha":null,"homepage":"http://uclapi.com","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/cbetta.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-07T13:35:07.000Z","updated_at":"2024-04-09T15:15:45.705Z","dependencies_parsed_at":"2023-01-19T07:00:32.744Z","dependency_job_id":null,"html_url":"https://github.com/cbetta/uclapi","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/cbetta%2Fuclapi","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbetta%2Fuclapi/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbetta%2Fuclapi/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cbetta%2Fuclapi/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cbetta","download_url":"https://codeload.github.com/cbetta/uclapi/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":224225349,"owners_count":17276435,"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":["api","gem","ruby","ucl","university"],"created_at":"2024-11-12T05:39:53.735Z","updated_at":"2024-11-12T05:39:54.470Z","avatar_url":"https://github.com/cbetta.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Ruby API library for the UCL API\n\n[![Gem Version](https://badge.fury.io/rb/uclapi.svg)](https://badge.fury.io/rb/uclapi) [![Build Status](https://travis-ci.org/cbetta/uclapi.svg?branch=master)](https://travis-ci.org/cbetta/uclapi)\n\nA wrapper for the [UCL API](https://uclapi.com/). Specification is as described in the the [developer documentation](https://docs.uclapi.com/).\n\n## Installation\n\nEither install directly or via bundler.\n\n```rb\ngem 'uclapi'\n```\n\n## Getting started\n\nThe client will accept the app token either as a parameter on initialization,\nor as an environment variable. Additionally a `debug` parameter can be set to enable verbose debugging.\n\n```rb\nrequire 'uclapi'\n\n# using parameters\nclient = UCLAPI::Client.new(token: '...')\n\n# using environment variables:\n# * UCLAPI_TOKEN\nclient = UCLAPI::Client.new\n```\n\nThe client provides with direct access to every API call as documented in the\ndeveloper documentation. Additionally it also provides some convenience methods.\n\n```rb\n# get a room\nroom = client.roombookings.rooms.first\n# get the bookings for a room\nbookings = room.bookings\n# get the equipment for a room\nequipment = room.equipment\n```\n\n## Convenience methods\n\n### `room.bookings`\n\nMaps to `client.roombookings.bookings` and passes along all the\nsame parameters while automatically setting the `roomid` and `siteid`.\n\n### `room.equipment`\n\nMaps to `client.roombookings.equipment` and passes along all the\nsame parameters while automatically setting the `roomid` and `siteid`.\n\n### `booking.room`\n\nMaps to `client.roombookings.room` and passes along the `roomid` and `siteid`.\n\n### `booking.next_page`\n\nMaps to `client.roombookings.bookings` and passes along the `roomid`, `siteid` and `page_token` to fetch the next page.\n\n### `equipment.room`\n\nMaps to `client.roombookings.room` and passes along the `roomid` and `siteid`.\n\n\n## API\n\n### `GET /roombookings/rooms`\n\nThis endpoint returns rooms and information about them. If you don’t specify any query parameters besides the token, all rooms will be returned.\n\nMore: [Documentation](https://docs.uclapi.com/#get-rooms)\n\n```rb\n\u003e rooms = client.roombookings.rooms\n[#\u003cUCLAPI::Room siteid=\"123\" ....\u003e, #\u003cUCLAPI::Room siteid=\"123\" ....\u003e]\n\u003e rooms.first\nUCLAPI::Room {\n            :siteid =\u003e \"123\",\n          :location =\u003e {\n        \"coordinates\" =\u003e {\n            \"lat\" =\u003e \"51.523504\",\n            \"lng\" =\u003e \"-0.134937\"\n        },\n            \"address\" =\u003e [\n            [0] \"74 Huntley Street\",\n            [1] \"London\",\n            [2] \"WC1E 6AU\",\n            [3] \"\"\n        ]\n\n    },\n            :roomid =\u003e \"234\",\n          :sitename =\u003e \"Medical School Building\",\n          :roomname =\u003e \"Rockefeller Building 335\",\n         :automated =\u003e \"P\",\n          :capacity =\u003e 20,\n    :classification =\u003e \"CR\"\n}\n# optional provide any extra parameters\n\u003e rooms = client.roombookings.rooms(siteid: 123)\n```\n\n### `GET /roombookings/bookings`\n\nThis endpoint shows the results to a bookings or space availability query. It returns a paginated list of bookings.\n\nMore: [Documentation](https://docs.uclapi.com/#get-bookings)\n\n```rb\n\u003e bookings = client.roombookings.bookings\n[#\u003cUCLAPI::Booking slotid=\"1234567\" ....\u003e, ...]\n\u003e bookings.first\nUCLAPI::Booking {\n         :siteid =\u003e \"123\",\n       :end_time =\u003e \"2018-02-01T12:00:00+00:00\",\n         :roomid =\u003e \"456\",\n         :slotid =\u003e 1234567,\n          :phone =\u003e nil,\n       :roomname =\u003e \"IOE - Bedford Way (20) - 790\",\n     :start_time =\u003e \"2018-02-01T11:00:00+00:00\",\n        :contact =\u003e \"Mr John Doe\",\n    :description =\u003e \"Introduction to The UCL API\",\n     :weeknumber =\u003e 23.0\n}\n# optional provide any extra parameters\n\u003e bookings = client.roombookings.bookings(siteid: 374)\n# to fetch the next page, just call next_page on any book\n\u003e next_bookings = bookings.first.next_page\n```\n\n### `GET /roombookings/equipment`\n\nThis endpoint returns any equipment/feature information about a specific room. So, for example whether there is a Whiteboard or a DVD Player in the room.\n\nMore: [Documentation](https://docs.uclapi.com/#get-equipment)\n\n```rb\n\u003e equipment = client.roombookings.equipment(siteid: 123, roomid: 345)\n[#\u003cUCLAPI::Equipment description=\"White Board\" ....\u003e, ...]\n\u003e equipment.first\nUCLAPI::Equipment {\n    :description =\u003e \"White Board\",\n           :type =\u003e \"FF\",\n          :units =\u003e 1,\n         :roomid =\u003e \"335\",\n         :siteid =\u003e \"374\"\n}\n```\n\n### `GET /search/people`\n\nThis endpoint returns matching people and information about them.\nMore: [Documentation](https://docs.uclapi.com/#get-people)\n\n```rb\n\u003e people = client.search.people(query: 'John')\n[#\u003cUCLAPI::People name=\"John Doe\" ....\u003e, ...]\n\u003e people.first\nUCLAPI::People {\n        :status =\u003e \"Staff\",\n          :name =\u003e \"John Doe\",\n         :email =\u003e \"j.doe@ucl.ac.uk\",\n    :department =\u003e \"UCL API Development\"\n}\n```\n\n## Contributing\n\n 1. **Fork** the repo on GitHub\n 2. **Clone** the project to your own machine\n 3. **Commit** changes to your own branch\n 4. **Push** your work back up to your fork\n 5. Submit a **Pull request** so that we can review your changes\n\n### Development\n\n* `bundle install` to get dependencies\n* `rake` to run tests\n* `rake console` to run a local console with the library loaded\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in this project is expected to follow the [code of conduct](https://github.com/cbetta/uclapi/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcbetta%2Fuclapi","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcbetta%2Fuclapi","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcbetta%2Fuclapi/lists"}