Class: RelatedWord::Service::SemanticService
- Inherits:
-
Object
- Object
- RelatedWord::Service::SemanticService
- Defined in:
- lib/related_word/service/semantic_service.rb
Constant Summary collapse
- LINK =
"http://semantic-link.com/related.php?word="
Instance Attribute Summary collapse
-
#word ⇒ Object
readonly
Returns the value of attribute word.
Instance Method Summary collapse
- #find ⇒ Object
-
#initialize(word) ⇒ SemanticService
constructor
A new instance of SemanticService.
Constructor Details
#initialize(word) ⇒ SemanticService
Returns a new instance of SemanticService.
15 16 17 |
# File 'lib/related_word/service/semantic_service.rb', line 15 def initialize(word) @word = word end |
Instance Attribute Details
#word ⇒ Object (readonly)
Returns the value of attribute word.
13 14 15 |
# File 'lib/related_word/service/semantic_service.rb', line 13 def word @word end |
Instance Method Details
#find ⇒ Object
19 20 21 22 23 24 25 |
# 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 |