Class: NewsApi::Article
- Inherits:
-
Struct
- Object
- Struct
- NewsApi::Article
- Defined in:
- lib/chid/news_api.rb
Instance Attribute Summary collapse
-
#author ⇒ Object
Returns the value of attribute author.
-
#description ⇒ Object
Returns the value of attribute description.
-
#publishedAt ⇒ Object
Returns the value of attribute publishedAt.
-
#source ⇒ Object
Returns the value of attribute source.
-
#title ⇒ Object
Returns the value of attribute title.
-
#url ⇒ Object
Returns the value of attribute url.
Instance Method Summary collapse
Instance Attribute Details
#author ⇒ Object
Returns the value of attribute author
6 7 8 |
# File 'lib/chid/news_api.rb', line 6 def @author end |
#description ⇒ Object
Returns the value of attribute description
6 7 8 |
# File 'lib/chid/news_api.rb', line 6 def description @description end |
#publishedAt ⇒ Object
Returns the value of attribute publishedAt
6 7 8 |
# File 'lib/chid/news_api.rb', line 6 def publishedAt @publishedAt end |
#source ⇒ Object
Returns the value of attribute source
6 7 8 |
# File 'lib/chid/news_api.rb', line 6 def source @source end |
#title ⇒ Object
Returns the value of attribute title
6 7 8 |
# File 'lib/chid/news_api.rb', line 6 def title @title end |
#url ⇒ Object
Returns the value of attribute url
6 7 8 |
# File 'lib/chid/news_api.rb', line 6 def url @url end |
Instance Method Details
#summary ⇒ Object
7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
# File 'lib/chid/news_api.rb', line 7 def summary published_at = publishedAt.nil? ? 'unkown' : publishedAt.strftime("%B %d, %Y") print "\n" print "--- #{title} ---".blue print "\n" print " Posted #{published_at} by ".brown print "#{}".green print "\n\n" print " #{description}" print "\n\n" print " Link: " print "#{url}".cyan.underline print "\n" end |