diff --git a/Gemfile.lock b/Gemfile.lock index 0c1ba6f..f0a3e3a 100644 --- a/Gemfile.lock +++ b/Gemfile.lock @@ -1,7 +1,7 @@ PATH remote: . specs: - livekit-ruby (0.1.0) + livekit (0.1.0) jwt (~> 2.2.3) twirp (~> 1.7.2) @@ -31,7 +31,6 @@ GEM faraday-patron (1.0.0) faraday-rack (1.0.0) google-protobuf (3.17.3) - google-protobuf (3.17.3-x86_64-linux) jwt (2.2.3) method_source (1.0.0) multipart-post (2.1.1) @@ -90,7 +89,7 @@ PLATFORMS x86_64-linux DEPENDENCIES - livekit-ruby! + livekit! pry pry-doc rake diff --git a/README.md b/README.md index bd3c427..e337f71 100644 --- a/README.md +++ b/README.md @@ -11,7 +11,7 @@ TODO: Delete this and the text above, and describe your gem Add this line to your application's Gemfile: ```ruby -gem 'livekit-ruby' +gem 'livekit' ``` And then execute: @@ -20,7 +20,7 @@ And then execute: Or install it yourself as: - $ gem install livekit-ruby + $ gem install livekit ## Usage @@ -28,18 +28,14 @@ TODO: Write usage instructions here ## Development -After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. +After checking out the repo, run `bundle install` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment. To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org). ## Contributing -Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/livekit-ruby. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [code of conduct](https://github.com/[USERNAME]/livekit-ruby/blob/master/CODE_OF_CONDUCT.md). +Bug reports and pull requests are welcome on GitHub at https://github.com/livekit/livekit. ## License -The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). - -## Code of Conduct - -Everyone interacting in the Livekit::Ruby project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/livekit-ruby/blob/master/CODE_OF_CONDUCT.md). +The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). \ No newline at end of file diff --git a/lib/livekit.rb b/lib/livekit.rb index cde26bc..af3f649 100644 --- a/lib/livekit.rb +++ b/lib/livekit.rb @@ -1,8 +1,25 @@ # frozen_string_literal: true require 'livekit/version' -require 'livekit/access_token' module Livekit autoload(:Proto, File.expand_path('livekit/proto.rb', __dir__)) + autoload(:AccessToken, File.expand_path('livekit/access_token.rb', __dir__)) + + Proto.initialize_proto! + + class Client + extend Forwardable + + room_methods = (Proto::RoomServiceClient.instance_methods - public_methods) - [:rpc] + delegate room_methods => :@client + + def initialize(url) + conn = Faraday.new(url: url) do |c| + c.request :authorization, 'Bearer', LiveKit::AccessToken.new + end + + @client = Proto::RoomServiceClient.new(conn) + end + end end diff --git a/lib/livekit/proto.rb b/lib/livekit/proto.rb index e164138..7eb8863 100644 --- a/lib/livekit/proto.rb +++ b/lib/livekit/proto.rb @@ -2,11 +2,11 @@ module Livekit module Proto - FOLDER = Pathname.new(File.expand_path('lib/livekit/proto')) + PATH = Pathname.new(File.expand_path(__dir__ + '/proto')) def self.initialize_proto! - $LOAD_PATH.unshift(FOLDER) - FOLDER.children.sort.each { |proto_file| require proto_file } + $LOAD_PATH.unshift(PATH) + PATH.children.sort.each { |proto_file| require proto_file } end end end diff --git a/livekit_ruby.gemspec b/livekit.gemspec similarity index 97% rename from livekit_ruby.gemspec rename to livekit.gemspec index 67d6929..9a18269 100644 --- a/livekit_ruby.gemspec +++ b/livekit.gemspec @@ -3,7 +3,7 @@ require_relative 'lib/livekit/version' Gem::Specification.new do |spec| - spec.name = 'livekit-ruby' + spec.name = 'livekit' spec.version = Livekit::VERSION spec.authors = ['Omri Gabay'] spec.email = ['omri@omrigabay.me'] diff --git a/protocol b/protocol deleted file mode 160000 index 031bb23..0000000 --- a/protocol +++ /dev/null @@ -1 +0,0 @@ -Subproject commit 031bb23807408312d718c1426148148d36a3dde0