class LibTAD::OnThisDay::Event
A historical event.
Attributes
categories[R]
@return [Array<String>] Event
categories.
countries[R]
@return [Array<::LibTAD::Places::Country>] Related countries.
date[R]
@return [::LibTAD::TADTime::TADTime] Date of the event.
description[R]
@return [Hash<String, String>] Languages with corresponding event description.
id[R]
@return [Integer] Identifier for the event.
location[R]
@return [String] Location of the event.
name[R]
@return [Hash<String, String>] Hash of languages with corresponding event name.
Public Class Methods
new(hash)
click to toggle source
# File lib/types/onthisday/event.rb, line 33 def initialize(hash) @id = hash.fetch('id', nil) @name = hash.fetch('name', nil) &.map { |e| [ e['lang'], e['text'] ] } .to_h @date = ::LibTAD::TADTime::TADTime.new hash.fetch('date', nil) @location = hash.fetch('location', nil) @categories = hash.fetch('categories', nil) @countries = hash.fetch('countries', nil) &.map { |e| ::LibTAD::Places::Country.new(e) } @description = hash.fetch('description', nil) &.map { |e| [ e['lang'], e['text'] ] } .to_h end