Class: Dyte::Client

Inherits:
Object
  • Object
show all
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

Instance Method Summary collapse

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

#adapterObject

Returns the value of attribute adapter.



6
7
8
# File 'lib/dyte/client.rb', line 6

def adapter
  @adapter
end

#api_keyObject

Returns the value of attribute api_key.



6
7
8
# File 'lib/dyte/client.rb', line 6

def api_key
  @api_key
end

#organization_idObject

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_sessionsObject



34
35
36
# File 'lib/dyte/client.rb', line 34

def active_sessions
  ActiveSessionsResource.new(self)
end

#connectionObject



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

#meetingsObject



14
15
16
# File 'lib/dyte/client.rb', line 14

def meetings
  MeetingsResource.new(self)
end

#organizationsObject



38
39
40
# File 'lib/dyte/client.rb', line 38

def organizations
  OrganizationsResource.new(self)
end

#participantsObject



22
23
24
# File 'lib/dyte/client.rb', line 22

def participants
  ParticipantsResource.new(self)
end

#presetsObject



18
19
20
# File 'lib/dyte/client.rb', line 18

def presets
  PresetsResource.new(self)
end

#recordingsObject



30
31
32
# File 'lib/dyte/client.rb', line 30

def recordings
  RecordingsResource.new(self)
end

#sessionsObject



26
27
28
# File 'lib/dyte/client.rb', line 26

def sessions
  SessionsResource.new(self)
end

#webhooksObject



42
43
44
# File 'lib/dyte/client.rb', line 42

def webhooks
  WebhooksResource.new(self)
end