Class: Dyte::Client
- Inherits:
-
Object
- Object
- Dyte::Client
- Defined in:
- lib/dyte/client.rb
Constant Summary collapse
- BASE_URL_V1 =
"https://api.cluster.dyte.in/v1/organizations"
- BASE_URL =
"https://api.cluster.dyte.in/v2"
Instance Attribute Summary collapse
-
#adapter ⇒ Object
Returns the value of attribute adapter.
-
#api_key ⇒ Object
Returns the value of attribute api_key.
-
#organization_id ⇒ Object
Returns the value of attribute organization_id.
Instance Method Summary collapse
- #active_sessions ⇒ Object
- #connection ⇒ Object
-
#initialize(organization_id:, api_key:, adapter: Faraday.default_adapter) ⇒ Client
constructor
A new instance of Client.
- #meetings ⇒ Object
- #organizations ⇒ Object
- #participants ⇒ Object
- #presets ⇒ Object
- #recordings ⇒ Object
- #sessions ⇒ Object
- #webhooks ⇒ Object
Constructor Details
#initialize(organization_id:, api_key:, adapter: Faraday.default_adapter) ⇒ Client
Returns a new instance of Client.
8 9 10 11 12 |
# File 'lib/dyte/client.rb', line 8 def initialize(organization_id:, api_key:, adapter: Faraday.default_adapter) @organization_id = organization_id @api_key = api_key @adapter = adapter end |
Instance Attribute Details
#adapter ⇒ Object
Returns the value of attribute adapter.
6 7 8 |
# File 'lib/dyte/client.rb', line 6 def adapter @adapter end |
#api_key ⇒ Object
Returns the value of attribute api_key.
6 7 8 |
# File 'lib/dyte/client.rb', line 6 def api_key @api_key end |
#organization_id ⇒ Object
Returns the value of attribute organization_id.
6 7 8 |
# File 'lib/dyte/client.rb', line 6 def organization_id @organization_id end |
Instance Method Details
#active_sessions ⇒ Object
34 35 36 |
# File 'lib/dyte/client.rb', line 34 def active_sessions ActiveSessionsResource.new(self) end |
#connection ⇒ Object
46 47 48 49 50 51 52 53 54 55 |
# File 'lib/dyte/client.rb', line 46 def connection auth_token = Base64.strict_encode64("#{@organization_id}:#{@api_key}") @connection ||= Faraday.new(BASE_URL) do |conn| conn.headers["Authorization"] = "Basic #{auth_token}" conn.request :json conn.response :json, content_type: "application/json" end end |
#meetings ⇒ Object
14 15 16 |
# File 'lib/dyte/client.rb', line 14 def meetings MeetingsResource.new(self) end |
#organizations ⇒ Object
38 39 40 |
# File 'lib/dyte/client.rb', line 38 def organizations OrganizationsResource.new(self) end |
#participants ⇒ Object
22 23 24 |
# File 'lib/dyte/client.rb', line 22 def participants ParticipantsResource.new(self) end |
#presets ⇒ Object
18 19 20 |
# File 'lib/dyte/client.rb', line 18 def presets PresetsResource.new(self) end |
#recordings ⇒ Object
30 31 32 |
# File 'lib/dyte/client.rb', line 30 def recordings RecordingsResource.new(self) end |
#sessions ⇒ Object
26 27 28 |
# File 'lib/dyte/client.rb', line 26 def sessions SessionsResource.new(self) end |
#webhooks ⇒ Object
42 43 44 |
# File 'lib/dyte/client.rb', line 42 def webhooks WebhooksResource.new(self) end |