Class: KudagoClient::Entities::News

Inherits:
Object
  • Object
show all
Defined in:
lib/kudago_client/entities/news.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

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_textObject

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_countObject

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

#descriptionObject

Returns the value of attribute description.



10
11
12
# File 'lib/kudago_client/entities/news.rb', line 10

def description
  @description
end

#disable_commentsObject

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_countObject

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

#idObject

Returns the value of attribute id.



10
11
12
# File 'lib/kudago_client/entities/news.rb', line 10

def id
  @id
end

#imagesObject

Returns the value of attribute images.



10
11
12
# File 'lib/kudago_client/entities/news.rb', line 10

def images
  @images
end

#langObject

Returns the value of attribute lang.



10
11
12
# File 'lib/kudago_client/entities/news.rb', line 10

def lang
  @lang
end

#placeObject

Returns the value of attribute place.



10
11
12
# File 'lib/kudago_client/entities/news.rb', line 10

def place
  @place
end

#publication_dateObject

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_urlObject

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

#slugObject

Returns the value of attribute slug.



10
11
12
# File 'lib/kudago_client/entities/news.rb', line 10

def slug
  @slug
end

#titleObject

Returns the value of attribute title.



10
11
12
# File 'lib/kudago_client/entities/news.rb', line 10

def title
  @title
end