class Tuling

Constants

TULING_URL

Public Class Methods

api() click to toggle source
# File lib/tuling.rb, line 26
def self.api
  return "#{ENV['tuling123']}"
end
new() click to toggle source
# File lib/tuling.rb, line 18
def initialize
      if Tuling.api.nil? || Tuling.api == ""
              raise TulingError, 'Cannot find api keys'
      else
              puts ("Tuling Gem reads apis")
      end
end

Public Instance Methods

input(content, userid) click to toggle source
# File lib/tuling.rb, line 30
def input(content, userid)
      parsed_response =  get_response(full_url(content,userid))
      return parsed_response
end

Private Instance Methods

full_url(content , userid) click to toggle source
# File lib/tuling.rb, line 44
def full_url(content , userid)

     api_key = Tuling.api

     url =  "#{TULING_URL}?key=#{api_key}&info=#{content}&userid=#{userid}"
     url = URI::escape(url)
     url = URI::parse(url)
     return url
end
get_response(url) click to toggle source
# File lib/tuling.rb, line 38
def get_response(url)
     response = HTTParty.get(url)
     parsed_response = response.parsed_response
     parsed_response
end