Module: LibTAD::Client::OnThisDayService
- Included in:
- LibTAD::Client
- Defined in:
- lib/services/onthisday.rb
Overview
On This Day API.
Instance Method Summary collapse
-
#get_events_on_this_day(month: nil, day: nil, lang: nil, types: nil) ⇒ Array<::LibTAD::OnThisDay::Event>, Array<::LibTAD::OnThisDay::Person>
The On This Day service can be used to retrieve events, births and deaths for a specific date.
Instance Method Details
#get_events_on_this_day(month: nil, day: nil, lang: nil, types: nil) ⇒ Array<::LibTAD::OnThisDay::Event>, Array<::LibTAD::OnThisDay::Person>
The On This Day service can be used to retrieve events, births and deaths for a specific date.
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 |
# File 'lib/services/onthisday.rb', line 13 def get_events_on_this_day(month: nil, day: nil, lang: nil, types: nil) args = { month: month, day: day, lang: lang, types: (types unless ![*types].all? { |e| ::LibTAD::OnThisDay::EVENT_TYPE.include?(e) }), }.compact response = get('onthisday', args) events = response.fetch('events', []) births = response.fetch('births', []) deaths = response.fetch('deaths', []) events = events.collect do |e| ::LibTAD::OnThisDay::Event.new(e) end births = births.collect do |e| ::LibTAD::OnThisDay::Person.new(e) end deaths = deaths.collect do |e| ::LibTAD::OnThisDay::Person.new(e) end return events, births, deaths end |