class Celly::Team

Constants

BASE_URL

Public Instance Methods

all() click to toggle source
# File lib/celly/team.rb, line 7
def all
  end_point = "/teams"
  uri = URI("#{BASE_URL}#{end_point}")
  response = Net::HTTP.get_response(uri)

  if response.code == '200'
    json_response = JSON.parse(response.body)
    
    {status: response.code, message: response.message, data: json_response["teams"] }
  else
    {status: response.code, message: response.message}
  end
end
find(id) click to toggle source
# File lib/celly/team.rb, line 35
def find(id)
  end_point = "/teams/#{id}"
  uri = URI("#{BASE_URL}#{end_point}")
  response = Net::HTTP.get_response(uri)

  if response.code == '200'
    json_response = JSON.parse(response.body)
    
    {status: response.code, message: response.message, data: json_response["teams"]}
  else
    {status: response.code, message: response.message}
  end
end
roster(id) click to toggle source
# File lib/celly/team.rb, line 21
def roster(id)
  end_point = "/teams/#{id}/roster"
  uri = URI("#{BASE_URL}#{end_point}")
  response = Net::HTTP.get_response(uri)

  if response.code == '200'
    json_response = JSON.parse(response.body)
    
    {status: response.code, message: response.message, data: json_response["roster"]}
  else
    {status: response.code, message: response.message}
  end
end
stats(id) click to toggle source
# File lib/celly/team.rb, line 49
def stats(id)
  end_point = "/teams/#{id}/stats"
  uri = URI("#{BASE_URL}#{end_point}")
  response = Net::HTTP.get_response(uri)

  if response.code == '200'
    json_response = JSON.parse(response.body)
    
    {status: response.code, message: response.message, data: json_response["stats"]}
  else
    {status: response.code, message: response.message}
  end
end