livekit-server-sdk 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2bb36af1d7e9069ca23d61a380d94da731d3cf8026fc8c3c18df4925d1bc2fa0
4
- data.tar.gz: fd621f01e789ee6662a4e8b7aa1aa18d768aa925eb9cb5700c8054bd9de5a285
3
+ metadata.gz: 77f26a584a937bc38b3d303925f5e5119afa710751c98cc3e66daef682486635
4
+ data.tar.gz: 6ef059111dbb04ba75c79dd753247b90cd18b636c060199c1e96e538e892c2ab
5
5
  SHA512:
6
- metadata.gz: eaf4b7fbe37e0645720225331e656982ae78ff21ef4359882426839b6f281c6ee1feb429eabf3f559ca8128f5d8bb71e54586e2e70cd52ef3897e7b9e017eb6d
7
- data.tar.gz: ccb9f015ab8a5e0f42927313f7fbbd2dcc8337aa0cf0999e1cacccf7a83cd373511035e723de4a2e444ae188da0aea3b9aaab97740fcf5dbb558fce2c5fd72cf
6
+ metadata.gz: 80e8d8ce2fe6abbd2b7ea150ea2c6d0a5072713d47c554df5fc377724e2b5225efc436ea4a6e5c6c1b5b8e3e7363b5468433952562ec17bc64033a828776a989
7
+ data.tar.gz: dd0e0edf976ce497fd07ea0aa315608099fa026ac3a7fddb798df1ad90c7f75dd0623a978fc0be7018d1ddc837db3805733a911dc1f755996c922a9cb8f81acf
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- livekit-server-sdk (0.2.1)
4
+ livekit-server-sdk (0.2.2)
5
5
  google-protobuf (~> 3.19.2)
6
6
  jwt (~> 2.2.3)
7
7
  twirp (~> 1.9.0)
@@ -11,7 +11,7 @@ GEM
11
11
  specs:
12
12
  coderay (1.1.3)
13
13
  diff-lcs (1.4.4)
14
- faraday (1.9.3)
14
+ faraday (1.10.0)
15
15
  faraday-em_http (~> 1.0)
16
16
  faraday-em_synchrony (~> 1.0)
17
17
  faraday-excon (~> 1.1)
@@ -34,8 +34,7 @@ GEM
34
34
  faraday-patron (1.0.0)
35
35
  faraday-rack (1.0.0)
36
36
  faraday-retry (1.0.3)
37
- google-protobuf (3.19.2)
38
- google-protobuf (3.19.2-x86_64-linux)
37
+ google-protobuf (3.19.4)
39
38
  jwt (2.2.3)
40
39
  method_source (1.0.0)
41
40
  multipart-post (2.1.1)
data/README.md CHANGED
@@ -1,45 +1,81 @@
1
- [![Specs](https://github.com/livekit/server-sdk-ruby/actions/workflows/test.yml/badge.svg)](https://github.com/livekit/server-sdk-ruby/actions/workflows/test.yml)
1
+ # LiveKit Server API for Ruby
2
2
 
3
- # LiveKit::Ruby
3
+ Ruby API for server-side integrations with LiveKit. This gem provides the ability to create access tokens as well as access RoomService.
4
4
 
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/livekit/ruby`. To experiment with that code, run `bin/console` for an interactive prompt.
6
-
7
- TODO: Delete this and the text above, and describe your gem
5
+ This library is designed to work with Ruby 2.6.0 and above.
8
6
 
9
7
  ## Installation
10
8
 
11
9
  Add this line to your application's Gemfile:
12
10
 
11
+ ### Gemfile
12
+
13
13
  ```ruby
14
- gem 'livekit-ruby'
14
+ gem 'livekit-server-sdk'
15
15
  ```
16
16
 
17
- And then execute:
17
+ and then `bundle install`.
18
18
 
19
- $ bundle install
19
+ ### Install system-wide
20
20
 
21
- Or install it yourself as:
22
-
23
- $ gem install livekit-ruby
21
+ ```shell
22
+ gem install livekit-server-sdk
23
+ ```
24
24
 
25
25
  ## Usage
26
26
 
27
- TODO: Write usage instructions here
27
+ ### Creating Access Tokens
28
28
 
29
- ## Development
29
+ Creating a token for participant to join a room.
30
30
 
31
- 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.
31
+ ```ruby
32
+ require 'livekit'
32
33
 
33
- 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).
34
+ token = LiveKit::AccessToken.new(api_key: 'yourkey', api_secret: 'yoursecret')
35
+ token.identity = 'participant-identity'
36
+ token.name = 'participant-name'
37
+ token.add_grant(roomJoin: true, room: 'room-name')
34
38
 
35
- ## Contributing
39
+ puts token.to_jwt
40
+ ```
36
41
 
37
- 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).
42
+ By default, a token expires after 6 hours. You may override this by passing in `ttl` when creating the token. `ttl` is expressed in seconds.
38
43
 
39
- ## License
44
+ ### Setting Permissions with Access Tokens
40
45
 
41
- The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
46
+ It's possible to customize the permissions of each participant. See more details at [access tokens guide](https://docs.livekit.io/guides/access-tokens#room-permissions).
47
+
48
+ ### Room Service
49
+
50
+ `RoomServiceClient` is a Twirp-based client that provides management APIs to LiveKit. You can connect it to your LiveKit endpoint. See [service apis](https://docs.livekit.io/guides/server-api) for a list of available APIs.
51
+
52
+ ```ruby
53
+ require 'livekit'
54
+
55
+ client = LiveKit::RoomServiceClient.new('https://my.livekit.instance',
56
+ api_key: 'yourkey', api_secret: 'yoursecret')
42
57
 
43
- ## Code of Conduct
58
+ name = 'myroom'
44
59
 
45
- 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).
60
+ client.list_rooms
61
+
62
+ client.list_participants(room: name)
63
+
64
+ client.mute_published_track(room: name, identity: 'participant',
65
+ track_sid: 'track-id', muted: true)
66
+
67
+ client.remove_participant(room: name, identity: 'participant')
68
+
69
+ client.delete_room(room: name)
70
+ ```
71
+
72
+ ### Environment Variables
73
+
74
+ You may store credentials in environment variables. If api-key or api-secret is not passed in when creating a `RoomServiceClient` or `AccessToken`, the values in the following env vars will be used:
75
+
76
+ - `LIVEKIT_API_KEY`
77
+ - `LIVEKIT_API_SECRET`
78
+
79
+ ## License
80
+
81
+ The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
@@ -13,16 +13,14 @@ module LiveKit
13
13
  @api_secret = api_secret
14
14
  end
15
15
 
16
- # creates a new room with name
17
16
  def create_room(name, empty_timeout: nil, max_participants: nil)
18
17
  self.rpc(
19
18
  :CreateRoom,
20
- Proto::ListRoomsRequest(name: name, empty_timeout: empty_timeout, max_participants: max_participants),
19
+ Proto::CreateRoomRequest.new(name: name, empty_timeout: empty_timeout, max_participants: max_participants),
21
20
  headers: auth_header(roomCreate: true),
22
21
  )
23
22
  end
24
23
 
25
- # Lists rooms, when names is set, only list matching rooms
26
24
  def list_rooms(names: nil)
27
25
  self.rpc(
28
26
  :ListRooms,
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LiveKit
4
- VERSION = "0.2.1"
4
+ VERSION = "0.2.2"
5
5
  end
metadata CHANGED
@@ -1,15 +1,15 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: livekit-server-sdk
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Omri Gabay
8
8
  - David Zhao
9
- autorequire:
9
+ autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2022-01-09 00:00:00.000000000 Z
12
+ date: 2022-05-16 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: google-protobuf
@@ -53,7 +53,7 @@ dependencies:
53
53
  - - "~>"
54
54
  - !ruby/object:Gem::Version
55
55
  version: 1.9.0
56
- description:
56
+ description:
57
57
  email:
58
58
  - omri@omrigabay.me
59
59
  - dz@livekit.io
@@ -113,7 +113,7 @@ homepage: https://livekit.io
113
113
  licenses:
114
114
  - MIT
115
115
  metadata: {}
116
- post_install_message:
116
+ post_install_message:
117
117
  rdoc_options: []
118
118
  require_paths:
119
119
  - lib
@@ -128,8 +128,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
128
128
  - !ruby/object:Gem::Version
129
129
  version: '0'
130
130
  requirements: []
131
- rubygems_version: 3.0.3.1
132
- signing_key:
131
+ rubygems_version: 3.3.11
132
+ signing_key:
133
133
  specification_version: 4
134
134
  summary: LiveKit Server SDK for Ruby
135
135
  test_files: []