class FactIsFact

Constants

BASE_URI
TYPE

Public Class Methods

return(type:, number:, **options) click to toggle source
# File lib/fact_is_fact.rb, line 8
def return(type:, number:, **options)
  return 'not a valid type' unless TYPE.include?(type)

  query_params = URI.encode_www_form(options)
  number_facts_uri = URI("#{BASE_URI}/#{number}/#{type}?#{query_params}")
  Net::HTTP.get(number_facts_uri)
end