Class: Lingq::Word

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client, language_code, json) ⇒ Word

Returns a new instance of Word.



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

def initialize(client,language_code,json)
  @lingq_client = client
  @language = language_code
  @hint = json["hint"]
  @term = json["term"]
  @id = json["id"]
  @fragment = json["fragment"]
  @status = json["status"]
end

Instance Attribute Details

#fragmentObject

Returns the value of attribute fragment.



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

def fragment
  @fragment
end

#hintObject

Returns the value of attribute hint.



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

def hint
  @hint
end

#idObject

Returns the value of attribute id.



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

def id
  @id
end

#languageObject

Returns the value of attribute language.



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

def language
  @language
end

#statusObject

Returns the value of attribute status.



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

def status
  @status
end

#termObject

Returns the value of attribute term.



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

def term
  @term
end

Instance Method Details

#increment_status!Object



18
19
20
21
# File 'lib/lingq/word.rb', line 18

def increment_status!
  @status += 1
  @lingq_client.update_word!(self)
end

#paramsObject



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

def params
  {:id=>@id,:hint=>@hint,:fragment=>@fragment,:status=>@status}
end