Class: Lingq::Lesson

Inherits:
Object
  • Object
show all
Defined in:
lib/lingq/lesson.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, language_code, json) ⇒ Lesson

Returns a new instance of Lesson.



4
5
6
7
8
9
10
11
12
# File 'lib/lingq/lesson.rb', line 4

def initialize(client,language_code,json)
  @lingq_client = client
  @language = language_code
  @audio_url = json["audio_url"]
  @image_url = json["image_url"]
  @id = json["id"]
  @cards_count = json["cards_count"]
  @title = json["title"]
end

Instance Attribute Details

#audio_urlObject (readonly)

Returns the value of attribute audio_url.



3
4
5
# File 'lib/lingq/lesson.rb', line 3

def audio_url
  @audio_url
end

#cards_countObject (readonly)

Returns the value of attribute cards_count.



3
4
5
# File 'lib/lingq/lesson.rb', line 3

def cards_count
  @cards_count
end

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/lingq/lesson.rb', line 3

def id
  @id
end

#image_urlObject (readonly)

Returns the value of attribute image_url.



3
4
5
# File 'lib/lingq/lesson.rb', line 3

def image_url
  @image_url
end

#languageObject (readonly)

Returns the value of attribute language.



3
4
5
# File 'lib/lingq/lesson.rb', line 3

def language
  @language
end

#lingq_clientObject (readonly)

Returns the value of attribute lingq_client.



3
4
5
# File 'lib/lingq/lesson.rb', line 3

def lingq_client
  @lingq_client
end

#titleObject (readonly)

Returns the value of attribute title.



3
4
5
# File 'lib/lingq/lesson.rb', line 3

def title
  @title
end

Instance Method Details

#wordsObject



14
15
16
17
# File 'lib/lingq/lesson.rb', line 14

def words
  return @words if @words
  @words = @lingq_client.words_for_lesson(self)
end