:::
+::: tab JRuby
+
+```ruby
+eds = things["energidataservice:service:energidataservice"]
+result = eds.calculate_cheapest_period(Instant.now, 2.hours.from_now.to_instant, 90.minutes)
+```
+
+:::
+
::::
#### `calculateCheapestPeriod` from Duration and Power
:::
+::: tab JRuby
+
+```ruby
+eds = things["energidataservice:service:energidataservice"]
+result = eds.calculate_cheapest_period(Instant.now, 12.hours.from_now.to_instant, 90.minutes, 250 | "W")
+```
+
+:::
+
::::
#### `calculateCheapestPeriod` from Power Phases
:::
+::: tabs JRuby
+
+```ruby
+duration_phases = [37, 8, 4, 2, 4, 36, 41, 104].map { |duration| duration.minutes }
+power_phases = [
+ 162.162 | "W",
+ 750 | "W",
+ 1500 | "W",
+ 3000 | "W",
+ 1500 | "W",
+ 166.666 | "W",
+ 146.341 | "W",
+ 0 | "W"
+]
+
+eds = things["energidataservice:service:energidataservice"]
+result = eds.calculate_cheapest_period(Instant.now, 12.hours.from_now.to_instant, duration_phases, power_phases)
+```
+
+:::
+
::::
Please note that the total duration will be calculated automatically as a sum of provided duration phases.
:::
+::: tabs JRuby
+
+```ruby
+duration_phases = [37, 8, 4, 2, 4, 36, 41].map { |duration| duration.minutes }
+
+eds = things["energidataservice:service:energidataservice"]
+result = eds.calculate_cheapest_period(Instant.now, 12.hours.from_now.to_instant, 236.minutes, duration_phases, 0.1 | "kWh")
+```
+
+:::
+
::::
### `calculatePrice`
:::
+::: tab JRuby
+
+```ruby
+eds = things["energidataservice:service:energidataservice"]
+price = eds.calculate_price(Instant.now, 4.hours.from_now.to_instant, 200 | "W")
+```
+
+:::
+
::::
### `getPrices`
:::
+::: tab JRuby
+
+```ruby
+eds = things["energidataservice:service:energidataservice"]
+price_map = eds.get_prices("SpotPrice,GridTariff")
+```
+
+:::
+
::::
## Full Example