create_channel.rb
# Function that create channel with rest_api and check if channel exsists first
Function that create channel with rest_api and check if channel exsists first
Function that create channel with rest_api and check if channel exsists first
def create_channel(channel)
  puts "running create_channel, channel = #{channel.inspect}"
  key_check =  RestClient.get "#{$base_url}/channels/#{channel["key"]}" 
  if  key_check.nil? || key_check['key'].nil?
    result = RestClient.post "#{$base_url}/channels/create", channel.to_json, :content_type => :json
    puts result.inspect 
  else 
    puts "Error, Channel is already exsists - #{key_check.inspect}"
  end
end
def create_channel ( channel ) puts "running create_channel, channel = #{channel.inspect}" key_check = RestClient . get "#{$base_url}/channels/#{channel["key"]}" if key_check . nil? || key_check [ 'key' ] . nil? result = RestClient . post "#{$base_url}/channels/create" , channel . to_json , :content_type => :json puts result . inspect else puts "Error, Channel is already exsists - #{key_check.inspect}" end end
Function that create channel with rest_api and check if channel exsists first
Function that create channel with rest_api and check if channel exsists first
#space should be escaped :) #params = { 'key' => channel["key"], 'name' => channel["name"], 'description' => channel["description"] }, # Test for checking that request is valid
channel
<not_specific>