Class: PartnerService::Inventories::ChartService

Inherits:
ApplicationService show all
Defined in:
app/services/partner_service/inventories/chart_service.rb

Instance Attribute Summary

Attributes inherited from ApplicationService

#object

Instance Method Summary collapse

Methods inherited from ApplicationService

#execute, #execute!

Constructor Details

#initialize(inventories, restaurant) ⇒ ChartService

Returns a new instance of ChartService.



6
7
8
9
10
# File 'app/services/partner_service/inventories/chart_service.rb', line 6

def initialize(inventories, restaurant)
  @time = Time.current
  @inventories = inventories
  @restaurant = restaurant
end

Instance Method Details

#callObject



12
13
14
15
16
17
18
19
# File 'app/services/partner_service/inventories/chart_service.rb', line 12

def call
  this_month = chart_calculate(@time.beginning_of_month, @time.end_of_month)
  previous_month = chart_calculate(@time.prev_month, @time.prev_month.end_of_month)
  {
    this_month: this_month,
    previous_month: previous_month
  }
end