Class: NewsApiAttributes

Inherits:
Object
  • Object
show all
Defined in:
lib/news_api_attributes.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(source, author, title, description, url, urlToImage, publishedAt) ⇒ NewsApiAttributes

Returns a new instance of NewsApiAttributes.



11
12
13
14
15
16
17
18
19
20
# File 'lib/news_api_attributes.rb', line 11

def initialize(source, author, title, description, url, urlToImage, publishedAt)
  @id = source["id"]
  @name = source["name"]
  @author = author
  @title = title
  @description = description
  @url = url
  @urlToImage = urlToImage
  @publishedAt = publishedAt
end

Instance Attribute Details

#authorObject

Returns the value of attribute author.



4
5
6
# File 'lib/news_api_attributes.rb', line 4

def author
  @author
end

#descriptionObject

Returns the value of attribute description.



6
7
8
# File 'lib/news_api_attributes.rb', line 6

def description
  @description
end

#idObject

Returns the value of attribute id.



2
3
4
# File 'lib/news_api_attributes.rb', line 2

def id
  @id
end

#nameObject

Returns the value of attribute name.



3
4
5
# File 'lib/news_api_attributes.rb', line 3

def name
  @name
end

#publishedAtObject

Returns the value of attribute publishedAt.



9
10
11
# File 'lib/news_api_attributes.rb', line 9

def publishedAt
  @publishedAt
end

#titleObject

Returns the value of attribute title.



5
6
7
# File 'lib/news_api_attributes.rb', line 5

def title
  @title
end

#urlObject

Returns the value of attribute url.



7
8
9
# File 'lib/news_api_attributes.rb', line 7

def url
  @url
end

#urlToImageObject

Returns the value of attribute urlToImage.



8
9
10
# File 'lib/news_api_attributes.rb', line 8

def urlToImage
  @urlToImage
end