Class: WinewooCore::Repositories::ElasticSearch::FeedElasticRepo

Inherits:
Object
  • Object
show all
Defined in:
lib/winewoo_core/repositories/elastic_search/feed_elastic_repo.rb

Instance Method Summary collapse

Instance Method Details

#create(user_log) ⇒ Object



14
15
16
17
# File 'lib/winewoo_core/repositories/elastic_search/feed_elastic_repo.rb', line 14

def create(user_log)
  elastic_services = WinewooCore::Services::ElasticSearch::NewsServices.new
  elastic_services.post_news(news_entry_from_log(user_log))
end

#find(filters, with_error) ⇒ Object



5
6
7
8
9
10
11
# File 'lib/winewoo_core/repositories/elastic_search/feed_elastic_repo.rb', line 5

def find(filters, with_error)
  page = (filters.page || 1).to_i
  per_page = (filters.per_page || Kaminari::config.default_per_page).to_i

  elastic_services = WinewooCore::Services::ElasticSearch::NewsServices.new(with_error)
  elastic_services.fetch_news(page - 1, per_page)
end