Class: Cowordinate::Word
- Inherits:
-
Object
- Object
- Cowordinate::Word
- Defined in:
- lib/cowordinate/word.rb
Instance Attribute Summary collapse
-
#name ⇒ Object
Returns the value of attribute name.
-
#parts ⇒ Object
Returns the value of attribute parts.
-
#updated_at ⇒ Object
Returns the value of attribute updated_at.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(options) ⇒ Word
constructor
A new instance of Word.
Constructor Details
#initialize(options) ⇒ Word
Returns a new instance of Word.
24 25 26 27 28 |
# File 'lib/cowordinate/word.rb', line 24 def initialize() self.name = ["name"] self.parts = ["parts"] self.updated_at = ["updated_at"] end |
Instance Attribute Details
#name ⇒ Object
Returns the value of attribute name.
14 15 16 |
# File 'lib/cowordinate/word.rb', line 14 def name @name end |
#parts ⇒ Object
Returns the value of attribute parts.
14 15 16 |
# File 'lib/cowordinate/word.rb', line 14 def parts @parts end |
#updated_at ⇒ Object
Returns the value of attribute updated_at.
14 15 16 |
# File 'lib/cowordinate/word.rb', line 14 def updated_at @updated_at end |
Class Method Details
.search(name) ⇒ Object
16 17 18 19 20 21 22 |
# File 'lib/cowordinate/word.rb', line 16 def self.search(name) raw_json = HTTParty.get("http://cowordinate.com/words/#{name}.json") attrs = JSON.parse(raw_json.body) Cowordinate::Word.new(attrs["word"]) rescue nil end |