{"id":19092204,"url":"https://github.com/cvut/kosapi_client.rb","last_synced_at":"2025-04-30T11:54:05.516Z","repository":{"id":16679551,"uuid":"19435490","full_name":"cvut/kosapi_client.rb","owner":"cvut","description":"KOSapi client in Ruby","archived":false,"fork":false,"pushed_at":"2022-09-14T14:22:41.000Z","size":218,"stargazers_count":4,"open_issues_count":10,"forks_count":5,"subscribers_count":6,"default_branch":"master","last_synced_at":"2024-04-15T15:11:22.960Z","etag":null,"topics":["cvut","kosapi","ruby"],"latest_commit_sha":null,"homepage":"","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/cvut.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2014-05-04T20:36:01.000Z","updated_at":"2023-02-03T19:12:55.000Z","dependencies_parsed_at":"2022-07-12T15:14:26.310Z","dependency_job_id":null,"html_url":"https://github.com/cvut/kosapi_client.rb","commit_stats":null,"previous_names":[],"tags_count":15,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvut%2Fkosapi_client.rb","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvut%2Fkosapi_client.rb/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvut%2Fkosapi_client.rb/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/cvut%2Fkosapi_client.rb/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/cvut","download_url":"https://codeload.github.com/cvut/kosapi_client.rb/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223779772,"owners_count":17201334,"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":["cvut","kosapi","ruby"],"created_at":"2024-11-09T03:18:34.259Z","updated_at":"2024-11-09T03:18:34.670Z","avatar_url":"https://github.com/cvut.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# KOSapi Client\n\n[![Gem Version](https://img.shields.io/gem/v/kosapi_client.svg)](https://rubygems.org/gems/kosapi_client)\n[![Build Status](https://github.com/cvut/kosapi_client.rb/workflows/CI/badge.svg)](https://github.com/cvut/kosapi_client.rb/actions?query=workflow%3A%22CI%22)\n[![Inline docs](http://inch-ci.org/github/cvut/kosapi_client.rb.svg)](http://inch-ci.org/github/cvut/kosapi_client.rb)\n\nA simple Ruby client library for [KOSapi RESTful service](https://kosapi.fit.cvut.cz).\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n    gem 'kosapi_client', github: 'cvut/kosapi_client.rb'\n\nAnd then execute:\n\n    $ bundle\n\n## Basic usage\n\n```ruby\n# Creates a new instance of client with OAuth2 credentials\nclient = KOSapiClient.new({ client_id: OAUTH_CLIENT_ID, client_secret: OAUTH_SECRET })\n\n# Retrieves first page of all course events\ncourse_events_page = client.course_events\ncourse_events_page.each { |event| do_stuff_with_event(event) }\n\n# Fetches page of parallels according to API parameters\nparallels_page = client.parallels.offset(0).limit(50).query('course.department' =\u003e '18*')\n\n# Finds all parallels related to parallel with id = 42\nclient.parallels.find(42).related\n```\n\n## Configuration\n\nKOSapiClient can be created and configured in two ways.\nThe simple way is to call `KOSapiClient.new`, which returns an ApiClient instance.\n\n```ruby\nclient = KOSapiClient.new({ client_id: OAUTH_CLIENT_ID, client_secret: OAUTH_SECRET })\nclient.parallels.find(42)\n```\n\nThe other way is to configure client using `KOSapiClient.configure` and setting options inside a block.\nIn addition to returning the client instance from `configure`, the client is also stored in `KOSapiClient` singleton property and its methods can be accessed by calling them on `KOSapiClient` directly.\nThis approach is more suitable for configuring client inside an initializer.\n\n```ruby\nKOSapiClient.configure do |c|\n  c.client_id = ENV['KOSAPI_OAUTH_CLIENT_ID']\n  c.client_secret = ENV['KOSAPI_OAUTH_CLIENT_SECRET']\nend\n\nKOSapiClient.parallels.find(42)\n```\n\n## Development\n\nRun `bin/setup` script to setup dependencies and create `.env` file. You will need to obtain access to KOSapi.\n\n### OAuth Credentials\n\nYou will need a KOSapi OAuth credentials from the [Apps Manager](https://auth.fit.cvut.cz/manager/) to run integration specs.\n\nOAuth credentials need to be exposed as environment variables `KOSAPI_OAUTH_CLIENT_ID` and `KOSAPI_OAUTH_CLIENT_SECRET`. If you put them into `.env` file, the test suite will load them for you automatically:\n\n```\nKOSAPI_OAUTH_CLIENT_ID=xxx-xxxx-xxxx\nKOSAPI_OAUTH_CLIENT_SECRET=yyyyyyyyy\n```\n\n### Contributing\n\nBug reports and pull requests are welcome on GitHub at [cvut/kosapi_client.rb](https://github.com/cvut/kosapi_client.rb). This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcvut%2Fkosapi_client.rb","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcvut%2Fkosapi_client.rb","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcvut%2Fkosapi_client.rb/lists"}