Class: JAPI::Clue

Inherits:
Object
  • Object
show all
Defined in:
lib/japi/clue.rb

Overview

Clue object with a question, answer and other details.

Author:

  • Dean Silfen

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ Clue

Returns a new instance of Clue.

Parameters:

  • options (Hash{String, Symbol => Fixnum, String, DateTime, Hash}) (defaults to: {})

Options Hash (options):

  • :value (Fixnum)

    amount in dollars of question

  • :id (Fixnum)

    clue id

  • :category_id (Fixnum)

    id of the clue’s category

  • :game_id (Fixnum)

    id of the game where the clue appeared

  • :category (Hash)

    Hash containing Category info. see JAPI::Category

  • :question (String)

    the question text

  • :answer (String)

    the answer text



16
17
18
# File 'lib/japi/clue.rb', line 16

def initialize(options = {})
  @options = options
end

Instance Method Details

#answerString

Returns answer text for this clue.

Returns:

  • (String)

    answer text for this clue



51
52
53
# File 'lib/japi/clue.rb', line 51

def answer
  @options["answer"]
end

#categoryCategory

Returns category associated with this Clue.

Returns:

  • (Category)

    category associated with this Clue



36
37
38
# File 'lib/japi/clue.rb', line 36

def category
  Category.new(@options["category"])
end

#category_idFixnum

Returns category id.

Returns:

  • (Fixnum)

    category id



31
32
33
# File 'lib/japi/clue.rb', line 31

def category_id
  @options["category_id"]
end

#clue_idFixnum

Returns clue id.

Returns:

  • (Fixnum)

    clue id



26
27
28
# File 'lib/japi/clue.rb', line 26

def clue_id
  @options["id"]
end

#game_idFixnum

Returns id of the game this clue initially aired on.

Returns:

  • (Fixnum)

    id of the game this clue initially aired on



41
42
43
# File 'lib/japi/clue.rb', line 41

def game_id
  @options["game_id"]
end

#questionString

Returns question text for this clue.

Returns:

  • (String)

    question text for this clue



46
47
48
# File 'lib/japi/clue.rb', line 46

def question
  @options["question"]
end

#valueFixnum

Returns amount in dollars of question.

Returns:

  • (Fixnum)

    amount in dollars of question



21
22
23
# File 'lib/japi/clue.rb', line 21

def value
  @options["value"]
end