irb(main):001:0> %w(rubygems wordnik).each {|lib| require lib}
=> ["rubygems", "wordnik"]
irb(main):002:0> Wordnik.configure do |config|
irb(main):003:1* config.api_key = 'myapikey'
irb(main):004:1> config.username =
irb(main):005:1* 'username'
irb(main):006:1> config.password =
irb(main):007:1* 'password'
irb(main):008:1> end
=> ["account", "analytics", "corpus", "document", "feeds", "health", "partner", "partners", "suggest", "system", "tag", "user", "users", "word", "wordList", "wordLists", "words"]
irb(main):009:0> Wordnik.words.get_word_list_words('23456')
D, [2018-02-24T22:14:19.543421 #33135] DEBUG -- :
GET http://api.wordnik.com/v4/wordList.json/23456/words
body: {}
ClientError: user does not have access to word list 630014
from /Library/Ruby/Gems/2.3.0/gems/wordnik-4.12/lib/wordnik/response.rb:28:in `catch_errors'
from /Library/Ruby/Gems/2.3.0/gems/wordnik-4.12/lib/wordnik/response.rb:18:in `initialize'
from /Library/Ruby/Gems/2.3.0/gems/wordnik-4.12/lib/wordnik/request.rb:181:in `new'
from /Library/Ruby/Gems/2.3.0/gems/wordnik-4.12/lib/wordnik/request.rb:181:in `make'
from /Library/Ruby/Gems/2.3.0/gems/wordnik-4.12/lib/wordnik/request.rb:185:in `response'
from /Library/Ruby/Gems/2.3.0/gems/wordnik-4.12/lib/wordnik/resource_modules/word_list.rb:138:in `get_word_list_words'
from (irb):9
from /usr/bin/irb:11:in `<main>'
irb(main):010:0>
query = {
"api_key" => "$APIKEY"
}
headers = {
"auth_token" => "$TOKEN",
}
response = HTTParty.get(
"http://api.wordnik.com/v4/wordList.json/$listPermalink/words",
:query => query,
:headers => headers
)
puts response.body
Wordnik.account.authenticate('$USERNAME', :password => '$PASSWORD')