Class: PartnerService::Ranking::CalculateService

Inherits:
ApplicationService show all
Defined in:
app/services/partner_service/ranking/calculate_service.rb

Instance Attribute Summary collapse

Attributes inherited from ApplicationService

#object

Instance Method Summary collapse

Methods inherited from ApplicationService

#execute, #execute!

Constructor Details

#initialize(restaurant) ⇒ CalculateService

Returns a new instance of CalculateService.



7
8
9
10
11
# File 'app/services/partner_service/ranking/calculate_service.rb', line 7

def initialize(restaurant)
  @today = Time.current.to_date
  @yesterday = @today - 1.days
  @restaurant = restaurant
end

Instance Attribute Details

#cuisineObject

Returns the value of attribute cuisine.



5
6
7
# File 'app/services/partner_service/ranking/calculate_service.rb', line 5

def cuisine
  @cuisine
end

#locationObject

Returns the value of attribute location.



5
6
7
# File 'app/services/partner_service/ranking/calculate_service.rb', line 5

def location
  @location
end

#packageObject

Returns the value of attribute package.



5
6
7
# File 'app/services/partner_service/ranking/calculate_service.rb', line 5

def package
  @package
end

#restaurants_cuisineObject

Returns the value of attribute restaurants_cuisine.



5
6
7
# File 'app/services/partner_service/ranking/calculate_service.rb', line 5

def restaurants_cuisine
  @restaurants_cuisine
end

#restaurants_locationObject

Returns the value of attribute restaurants_location.



5
6
7
# File 'app/services/partner_service/ranking/calculate_service.rb', line 5

def restaurants_location
  @restaurants_location
end

Instance Method Details

#callObject



13
14
15
16
17
18
19
20
# File 'app/services/partner_service/ranking/calculate_service.rb', line 13

def call
  restaurant_tag_location = restaurant_tag(type: :location)
  restaurant_tag_cuisine = restaurant_tag(type: :cuisine)
  @restaurants_location = calculate('location', restaurant_tag_location)
  @restaurants_cuisine = calculate('cuisine', restaurant_tag_cuisine)
  @package = calculate_packages
  return self
end