Class: FlockOs::Api::Channels

Inherits:
Base
  • Object
show all
Defined in:
lib/flock_os/api/channels.rb

Constant Summary collapse

PATH =
'channels'

Instance Attribute Summary

Attributes inherited from Base

#client

Instance Method Summary collapse

Methods inherited from Base

#initialize

Constructor Details

This class inherits a constructor from FlockOs::Api::Base

Instance Method Details

#add_members(channel_id, members) ⇒ Object



6
7
8
9
10
11
12
13
# File 'lib/flock_os/api/channels.rb', line 6

def add_members(channel_id, members)
  response = @client.post("#{PATH}.addMembers", {
    channelId: channel_id, 
    members: members
  })
  
  FlockOs::Model::ModifyChannelMember.new(response)
end

#create(params) ⇒ Object



15
16
17
18
19
20
21
22
# File 'lib/flock_os/api/channels.rb', line 15

def create(params)
  response = @client.post("#{PATH}.create", {
    channel_id: channel_id,
    members: members
  })
  
  FlockOs::Model::CreateChannel.new(response)
end

#get_info(channel_id) ⇒ Object



24
25
26
27
28
29
30
# File 'lib/flock_os/api/channels.rb', line 24

def get_info(channel_id)
  response = @client.post("#{PATH}.getInfo", {
    channelId: channel_id
  })
  
  FlockOs::Model::Channel.new(response)
end

#listObject



32
33
34
35
36
# File 'lib/flock_os/api/channels.rb', line 32

def list
  response = @client.post("#{PATH}.list")
  
  FlockOs::Collection::Channel.new(response)
end

#list_members(params) ⇒ Object



38
39
40
41
42
# File 'lib/flock_os/api/channels.rb', line 38

def list_members(params)
  response = @client.post("#{PATH}.listMembers", params)
  
  FlockOs::Collection::ChannelMember.new(response)
end

#remove_members(channel_id, members) ⇒ Object



44
45
46
47
48
49
50
51
# File 'lib/flock_os/api/channels.rb', line 44

def remove_members(channel_id, members)
  response = @client.post("#{PATH}.removeMembers", {
    channelId: channel_id,
    members: members
  })
  
  FlockOs::Model::ModifyChannelMember.new(response)
end