dyte 0.6.0 → 0.7.1

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: c52eb75aa2c387f5d6ba0a020774e39a0bc0fc4145e6d0479f517c4274c9ce03
4
- data.tar.gz: 17a4c2efd7d7f5d0f66d82f3b23dda5de6fabba3a57688647f17503e3338010f
3
+ metadata.gz: 6a0d44579e444900e0c0f1886e04bf4af3e75bf7c749cdc9ee01481f8842456b
4
+ data.tar.gz: b31f92d21fbb4f668abfc592d6972c5627077634994f401445ef2df732c7a68f
5
5
  SHA512:
6
- metadata.gz: 5424e1e0f338d08616eb5611f399d5260b0e20049df51c9b6c45c46d15c9bfa4cdb6be14a2fafab310e3ca3f601fc98b515b1c16329e0a06425e54886521cae0
7
- data.tar.gz: bb4b863e2fdf39fce16854ad861e4849db76294f5dd03fd90e2fefe1ec4d2b864f5a5181e167a78f237c8c56b5a7b11be0fa2d4e2d4a9d160d214a0f7c85fa6a
6
+ metadata.gz: 7d56ca8fdd360ed979143a1c5b9ffe68c1d34a65317f46448ef68dd6834b06d0e83dcadae14884a90b55d937e83084454596982117269d9f8ced462ef619d2b0
7
+ data.tar.gz: b70f25b138db96cb8e4d88357394cd54da32a0061708031bfbbad5b3f7d3aac25a9bb0de4197ec1c1924c2f85af475161766c53f29c3d62c09221cf5d4f0b487
data/Gemfile CHANGED
@@ -6,10 +6,9 @@ source "https://rubygems.org"
6
6
  gemspec
7
7
 
8
8
  group :development do
9
- gem "rake", "~> 13.0"
9
+ gem "rake", "~> 13.1"
10
10
  gem "standard"
11
- gem "minitest", "~> 5.17"
12
- gem "webmock", "~> 3.18"
13
- gem "solargraph", "~> 0.48.0"
11
+ gem "minitest", "~> 5.21"
12
+ gem "webmock", "~> 3.19"
14
13
  gem "debug"
15
14
  end
data/README.md CHANGED
@@ -52,6 +52,12 @@ client.meetings.fetch_participant_details(meeting_id: "id", participant_id: "id"
52
52
 
53
53
  # Edits a participant for the given meeting and participant ID.
54
54
  client.meetings.edit_participant_details(meeting_id: "id", participant_id: "id")
55
+
56
+ # Adds a participant to a meeting.
57
+ client.meetings.add_participant(meeting_id: "id", participant_id: "id")
58
+
59
+ # Replaces specified details for the given meeting ID.
60
+ client.meetings.replace( meeting_id: "id", {})
55
61
  ```
56
62
  ### Presets
57
63
 
@@ -70,11 +76,56 @@ client.sessions.fetch_participants(session_id: "id")
70
76
  client.sessions.participant_details(session_id: "id", participant_id: "id")
71
77
  client.sessions.chat_messages(session_id: "id")
72
78
  ```
79
+ ### Organizations
80
+
81
+ ```ruby
82
+ # Creates a new organization. The authenticated user becomes the owner of the organization.
83
+ client.organizations.create(
84
+ {
85
+ "name": "Cool Org",
86
+ "contact": "778-330-2389",
87
+ "website": "https://www.dyte.io",
88
+ "feature_flags": [
89
+ "string"
90
+ ],
91
+ "preferred_region": "ap-south-1"
92
+ }
93
+ )
94
+
95
+ # Updates organization details for the given organization ID. The user must be the organization's owner.
96
+ client.organizations.update(organization_id: "id",
97
+ {
98
+ "name": "A much better name",
99
+ "contact": "string",
100
+ "website": "https://www.dyte.io",
101
+ "feature_flags": [
102
+ "string"
103
+ ],
104
+ "preferred_region": "ap-south-1"
105
+ }
106
+ )
107
+ ```
108
+ ### Webhooks
109
+ ```ruby
110
+ # Returns the Webhook relating to the given ID
111
+ client.webhooks.fetch(webhook_id: "id")
112
+
113
+ # Returns all Webhooks for a given organization
114
+ client.webhooks.list
115
+ ```
116
+
73
117
  ### Participants
74
118
 
75
119
  ## Development
120
+ ### Setup
121
+ After checking out the repo run `bin/setup` to install dependencies. Then, run `rake test` to run the tests.
122
+
123
+ ### Running Locally
124
+ It can be convenient to run the gem locally while developing, to test changes. To do so, follow these steps:
125
+ 1) Run `bin/console` from the root directory
126
+ 1) Instantiate the client (enter your Dyte credentials) `client = Client.new(organization_id: '1234', api_key: '1234')`
127
+ 1) Run a test command, for example: `client.participants.list(session_id: 1)`
76
128
 
77
- After checking out the repo run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
78
129
 
79
130
  ## Contributing
80
131
 
data/lib/dyte/client.rb CHANGED
@@ -35,6 +35,14 @@ module Dyte
35
35
  ActiveSessionsResource.new(self)
36
36
  end
37
37
 
38
+ def organizations
39
+ OrganizationsResource.new(self)
40
+ end
41
+
42
+ def webhooks
43
+ WebhooksResource.new(self)
44
+ end
45
+
38
46
  def connection
39
47
  auth_token = Base64.strict_encode64("#{@organization_id}:#{@api_key}")
40
48
  @connection ||= Faraday.new(BASE_URL) do |conn|
data/lib/dyte/object.rb CHANGED
@@ -3,7 +3,7 @@ require "ostruct"
3
3
  module Dyte
4
4
  class Object < OpenStruct
5
5
  def initialize(attributes)
6
- super to_ostruct(attributes)
6
+ super(to_ostruct(attributes))
7
7
  end
8
8
 
9
9
  def to_ostruct(obj)
@@ -0,0 +1,4 @@
1
+ module Dyte
2
+ class Organization < Object
3
+ end
4
+ end
@@ -0,0 +1,4 @@
1
+ module Dyte
2
+ class Webhook < Object
3
+ end
4
+ end
@@ -43,5 +43,15 @@ module Dyte
43
43
  response = patch_request("meetings/#{meeting_id}/participants/#{participant_id}", body: attributes)
44
44
  Participant.new response.body.dig("data")
45
45
  end
46
+
47
+ def add_participant(meeting_id:, **attributes)
48
+ response = post_request("meetings/#{meeting_id}/participants", body: attributes)
49
+ Participant.new response.body.dig("data")
50
+ end
51
+
52
+ def replace(meeting_id:, **attributes)
53
+ response = put_request("meetings/#{meeting_id}", body: attributes)
54
+ Meeting.new response.body.dig("data")
55
+ end
46
56
  end
47
57
  end
@@ -0,0 +1,15 @@
1
+ module Dyte
2
+ class OrganizationsResource < Resource
3
+ def create(**attributes)
4
+ Organization.new post_request("orgs", body: attributes).body.dig("data")
5
+ end
6
+
7
+ def fetch(organization_id:)
8
+ Organization.new get_request("orgs/#{organization_id}").body.dig("data")
9
+ end
10
+
11
+ def update(organization_id:, **attributes)
12
+ Organization.new patch_request("orgs/#{organization_id}", body: attributes).body.dig("data")
13
+ end
14
+ end
15
+ end
@@ -1,3 +1,5 @@
1
+ # This module is deprecated in favour of adding participant actions to the meetings resource. This is for the purpose
2
+ # of better following how Dyte's API is structured. This module will be removed in a future release.
1
3
  module Dyte
2
4
  class ParticipantsResource < Resource
3
5
  def list(session_id:, **params)
@@ -0,0 +1,12 @@
1
+ module Dyte
2
+ class WebhooksResource < Resource
3
+ def fetch(webhook_id:)
4
+ Webhook.new get_request("webhooks/#{webhook_id}").body.dig("data")
5
+ end
6
+
7
+ def list
8
+ response = get_request("webhooks")
9
+ Collection.from_response(response, type: Webhook)
10
+ end
11
+ end
12
+ end
data/lib/dyte/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Dyte
4
- VERSION = "0.6.0"
4
+ VERSION = "0.7.1"
5
5
  end
data/lib/dyte.rb CHANGED
@@ -14,6 +14,8 @@ require "dyte/objects/participant"
14
14
  require "dyte/objects/session"
15
15
  require "dyte/objects/recording"
16
16
  require "dyte/objects/active_session"
17
+ require "dyte/objects/organization"
18
+ require "dyte/objects/webhook"
17
19
 
18
20
  # Resources
19
21
  require "dyte/resources/meetings"
@@ -22,6 +24,8 @@ require "dyte/resources/participants"
22
24
  require "dyte/resources/sessions"
23
25
  require "dyte/resources/recordings"
24
26
  require "dyte/resources/active_sessions"
27
+ require "dyte/resources/organizations"
28
+ require "dyte/resources/webhooks"
25
29
 
26
30
  module Dyte
27
31
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: dyte
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.0
4
+ version: 0.7.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Nick Warwick
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2023-09-04 00:00:00.000000000 Z
11
+ date: 2024-01-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday
@@ -52,17 +52,21 @@ files:
52
52
  - lib/dyte/object.rb
53
53
  - lib/dyte/objects/active_session.rb
54
54
  - lib/dyte/objects/meeting.rb
55
+ - lib/dyte/objects/organization.rb
55
56
  - lib/dyte/objects/participant.rb
56
57
  - lib/dyte/objects/preset.rb
57
58
  - lib/dyte/objects/recording.rb
58
59
  - lib/dyte/objects/session.rb
60
+ - lib/dyte/objects/webhook.rb
59
61
  - lib/dyte/resource.rb
60
62
  - lib/dyte/resources/active_sessions.rb
61
63
  - lib/dyte/resources/meetings.rb
64
+ - lib/dyte/resources/organizations.rb
62
65
  - lib/dyte/resources/participants.rb
63
66
  - lib/dyte/resources/presets.rb
64
67
  - lib/dyte/resources/recordings.rb
65
68
  - lib/dyte/resources/sessions.rb
69
+ - lib/dyte/resources/webhooks.rb
66
70
  - lib/dyte/version.rb
67
71
  - sig/dyte.rbs
68
72
  homepage: https://github.com/nwarwick/dyte
@@ -87,7 +91,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
87
91
  - !ruby/object:Gem::Version
88
92
  version: '0'
89
93
  requirements: []
90
- rubygems_version: 3.4.19
94
+ rubygems_version: 3.5.3
91
95
  signing_key:
92
96
  specification_version: 4
93
97
  summary: A simple wrapper for the Dyte API.