Class: Xtb::Http::Calendar

Inherits:
Command
  • Object
show all
Defined in:
lib/xtb/http/calendar.rb

Overview

Constant Summary collapse

IMPACT =
{
  1 => 'low',
  2 => 'medium',
  3 => 'high'
}.freeze
CalendarRecord =
Data.define(:country, :current, :forecast, :impact, :period, :previous, :time, :title) do
  def initialize(country:, current:, forecast:, impact:, period:, previous:, time:, title:)
    super(country:, current:, forecast:, impact: IMPACT[impact.to_i], period:, previous:, time:, title:)
  end
end

Instance Method Summary collapse

Methods inherited from Command

call, #initialize

Constructor Details

This class inherits a constructor from Xtb::Http::Command

Instance Method Details

#callObject



19
20
21
# File 'lib/xtb/http/calendar.rb', line 19

def call
  super.return_data.map { |record| CalendarRecord.new(**record) }
end