src/opentdb.rb
# Request a collection of questions based on criteria
# @param amount [Integer] amount of questions to return (up to 50)
# @param token [String] session token
# @param category [Integer] category ID to limit trivia to (omit for any category)
# @param difficulty [String] 'easy', 'medium', or 'hard' (omit for any difficulty)
# @param type [String] 'multiple' or 'boolean'
# @param encoding [String] 'default', 'urlLegacy', 'url3986', or 'base64'
# @return [Hash] API response
Request a collection of questions based on criteria
Request a collection of questions based on criteria
def questions(amount = nil, token = nil, category = nil, difficulty = nil, type = nil, encoding = nil)
      get('api.php', {
        amount: amount,
        token: token,
        category: category,
        difficulty: difficulty,
        type: type,
        encode: encoding
      }.compact)
    end
def questions ( amount = nil , token = nil , category = nil , difficulty = nil , type = nil , encoding = nil ) get ( 'api.php' , { amount : amount , token : token , category : category , difficulty : difficulty , type : type , encode : encoding } . compact ) end
Request a collection of questions based on criteria
Request a collection of questions based on criteria
None
Hash
amount
amount of questions to return (up to 50)
amount of questions to return ( up to 50 )
token
None
category
category ID to limit trivia to (omit for any category)
category ID to limit trivia to ( omit for any category )
difficulty
'easy', 'medium', or 'hard' (omit for any difficulty)
' easy ' ' medium ' or ' hard ' ( omit for any difficulty )
type
'multiple' or 'boolean'
' multiple ' or ' boolean '
encoding
None