Class: WiktionaryAPI::Client

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

Constant Summary collapse

BASE_URL =
'https://en.wiktionary.org/api/rest_v1/page/definition'.freeze

Class Method Summary collapse

Instance Method Summary collapse

Class Method Details

.lookup(word, lang: :en) ⇒ Object



15
16
17
# File 'lib/wiktionary_api.rb', line 15

def self.lookup word, lang: :en
  self.new.lookup word
end

.lookup!(word, lang: :en) ⇒ Object



19
20
21
# File 'lib/wiktionary_api.rb', line 19

def self.lookup! word, lang: :en
  self.new.lookup! word
end

Instance Method Details

#lookup(word, lang: :en) ⇒ Object



23
24
25
# File 'lib/wiktionary_api.rb', line 23

def lookup(word, lang: :en)
  look_up_internal word, raise_error: false, lang: lang
end

#lookup!(word, lang: :en) ⇒ Object



27
28
29
# File 'lib/wiktionary_api.rb', line 27

def lookup!(word, lang: :en)
  look_up_internal word, raise_error: true, lang: lang
end