Class: KudagoClient::Entities::News
- Inherits:
-
Object
- Object
- KudagoClient::Entities::News
- Defined in:
- lib/kudago_client/entities/news.rb
Instance Attribute Summary collapse
-
#body_text ⇒ Object
Returns the value of attribute body_text.
-
#comments_count ⇒ Object
Returns the value of attribute comments_count.
-
#description ⇒ Object
Returns the value of attribute description.
-
#disable_comments ⇒ Object
Returns the value of attribute disable_comments.
-
#favorites_count ⇒ Object
Returns the value of attribute favorites_count.
-
#id ⇒ Object
Returns the value of attribute id.
-
#images ⇒ Object
Returns the value of attribute images.
-
#lang ⇒ Object
Returns the value of attribute lang.
-
#place ⇒ Object
Returns the value of attribute place.
-
#publication_date ⇒ Object
Returns the value of attribute publication_date.
-
#site_url ⇒ Object
Returns the value of attribute site_url.
-
#slug ⇒ Object
Returns the value of attribute slug.
-
#title ⇒ Object
Returns the value of attribute title.
Instance Method Summary collapse
-
#initialize(lang:, id: nil, title: nil, publication_date: nil, slug: nil, place: nil, description: nil, body_text: nil, images: [], site_url: nil, favorites_count: 0, comments_count: 0, disable_comments: false) ⇒ News
constructor
A new instance of News.
Constructor Details
#initialize(lang:, id: nil, title: nil, publication_date: nil, slug: nil, place: nil, description: nil, body_text: nil, images: [], site_url: nil, favorites_count: 0, comments_count: 0, disable_comments: false) ⇒ News
Returns a new instance of News.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/kudago_client/entities/news.rb', line 13 def initialize(lang:, id: nil, title: nil, publication_date: nil, slug: nil, place: nil, description: nil, body_text: nil, images: [], site_url: nil, favorites_count: 0, comments_count: 0, disable_comments: false) @lang = lang @id = id @title = title @slug = slug @description = description @body_text = body_text @site_url = site_url @favorites_count = favorites_count @comments_count = comments_count @disable_comments = disable_comments @publication_date = Time.at(publication_date).to_date if publication_date @place = KudagoClient::Entities::Place.new(**place, lang: lang) if place.present? @images = images.map { |img| KudagoClient::Entities::Image.new(**img) } if images.present? end |
Instance Attribute Details
#body_text ⇒ Object
Returns the value of attribute body_text.
10 11 12 |
# File 'lib/kudago_client/entities/news.rb', line 10 def body_text @body_text end |
#comments_count ⇒ Object
Returns the value of attribute comments_count.
10 11 12 |
# File 'lib/kudago_client/entities/news.rb', line 10 def comments_count @comments_count end |
#description ⇒ Object
Returns the value of attribute description.
10 11 12 |
# File 'lib/kudago_client/entities/news.rb', line 10 def description @description end |
#disable_comments ⇒ Object
Returns the value of attribute disable_comments.
10 11 12 |
# File 'lib/kudago_client/entities/news.rb', line 10 def disable_comments @disable_comments end |
#favorites_count ⇒ Object
Returns the value of attribute favorites_count.
10 11 12 |
# File 'lib/kudago_client/entities/news.rb', line 10 def favorites_count @favorites_count end |
#id ⇒ Object
Returns the value of attribute id.
10 11 12 |
# File 'lib/kudago_client/entities/news.rb', line 10 def id @id end |
#images ⇒ Object
Returns the value of attribute images.
10 11 12 |
# File 'lib/kudago_client/entities/news.rb', line 10 def images @images end |
#lang ⇒ Object
Returns the value of attribute lang.
10 11 12 |
# File 'lib/kudago_client/entities/news.rb', line 10 def lang @lang end |
#place ⇒ Object
Returns the value of attribute place.
10 11 12 |
# File 'lib/kudago_client/entities/news.rb', line 10 def place @place end |
#publication_date ⇒ Object
Returns the value of attribute publication_date.
10 11 12 |
# File 'lib/kudago_client/entities/news.rb', line 10 def publication_date @publication_date end |
#site_url ⇒ Object
Returns the value of attribute site_url.
10 11 12 |
# File 'lib/kudago_client/entities/news.rb', line 10 def site_url @site_url end |
#slug ⇒ Object
Returns the value of attribute slug.
10 11 12 |
# File 'lib/kudago_client/entities/news.rb', line 10 def slug @slug end |
#title ⇒ Object
Returns the value of attribute title.
10 11 12 |
# File 'lib/kudago_client/entities/news.rb', line 10 def title @title end |