Class: Theysaidso::QOD
- Inherits:
-
Object
- Object
- Theysaidso::QOD
- Defined in:
- lib/theysaidso/qod.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
readonly
Returns the value of attribute author.
-
#category ⇒ Object
readonly
Returns the value of attribute category.
-
#id ⇒ Object
readonly
Returns the value of attribute id.
-
#length ⇒ Object
readonly
Returns the value of attribute length.
-
#quote ⇒ Object
readonly
Returns the value of attribute quote.
-
#success ⇒ Object
readonly
Returns the value of attribute success.
-
#tags ⇒ Object
readonly
Returns the value of attribute tags.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(attrs) ⇒ QOD
constructor
A new instance of QOD.
Constructor Details
#initialize(attrs) ⇒ QOD
Returns a new instance of QOD.
9 10 11 12 13 14 15 16 17 |
# File 'lib/theysaidso/qod.rb', line 9 def initialize(attrs) @id = attrs['contents']['id'] @quote = attrs['contents']['quote'] = attrs['contents']['author'] @length = attrs['contents']['length'] = attrs['contents']['tags'] @success = attrs['success']['total'] @category = attrs['category'] end |
Instance Attribute Details
#author ⇒ Object (readonly)
Returns the value of attribute author.
7 8 9 |
# File 'lib/theysaidso/qod.rb', line 7 def end |
#category ⇒ Object (readonly)
Returns the value of attribute category.
7 8 9 |
# File 'lib/theysaidso/qod.rb', line 7 def category @category end |
#id ⇒ Object (readonly)
Returns the value of attribute id.
7 8 9 |
# File 'lib/theysaidso/qod.rb', line 7 def id @id end |
#length ⇒ Object (readonly)
Returns the value of attribute length.
7 8 9 |
# File 'lib/theysaidso/qod.rb', line 7 def length @length end |
#quote ⇒ Object (readonly)
Returns the value of attribute quote.
7 8 9 |
# File 'lib/theysaidso/qod.rb', line 7 def quote @quote end |
#success ⇒ Object (readonly)
Returns the value of attribute success.
7 8 9 |
# File 'lib/theysaidso/qod.rb', line 7 def success @success end |
#tags ⇒ Object (readonly)
Returns the value of attribute tags.
7 8 9 |
# File 'lib/theysaidso/qod.rb', line 7 def end |
Class Method Details
.fetch ⇒ Object
19 20 21 22 23 |
# File 'lib/theysaidso/qod.rb', line 19 def self.fetch response = Faraday.get(API_URL) attrs = JSON.parse(response.body) new(attrs) end |