class Client

Attributes

api_key[RW]

Public Class Methods

new(dict, thes) click to toggle source
# File lib/client/client.rb, line 4
def initialize(dict, thes)
  @api_key = {
    dict: dict,
    thes: thes
  }
end

Public Instance Methods

request(url, thes) click to toggle source
# File lib/client/client.rb, line 11
def request(url, thes)
  api_key = @api_key[thes ? :thes : :dict]
  if !api_key
    puts "Please provide the API Key...\n"
    exit(1)
  end

  uri = URI("#{url}?key=#{api_key}")
  response = Net::HTTP.get_response(uri)
  json = JSON.parse(response.body)
  [response, json]
end