class RelatedWord::Service::SemanticService
Constants
- LINK
Attributes
word[R]
Public Class Methods
new(word)
click to toggle source
# File lib/related_word/service/semantic_service.rb, line 15 def initialize(word) @word = word end
Public Instance Methods
find()
click to toggle source
# File lib/related_word/service/semantic_service.rb, line 19 def find Timeout::timeout(Configure.timeout) do resp = Net::HTTP.get_response(word_uri) json_resp = JSON.parse(resp.body) Formatter::SemanticFormatter.new(json_resp).format end end
Private Instance Methods
word_uri()
click to toggle source
# File lib/related_word/service/semantic_service.rb, line 29 def word_uri @word_uri ||= URI.parse("#{LINK}#{word}") end