9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
|
# File 'app/workers/sync/receipt_templates_worker.rb', line 9
def perform
params = {
:terminal => Terminal.config.keyword
}
response = RestClient.get "#{Terminal.config.host}/system_receipt_templates?#{params.to_query}"
templates = JSON.parse(response.to_s, :symbolize_names => true)
templates.each do |entry|
Sidekiq::Logging.logger.info "Got #{entry[:keyword]} receipt template"
ReceiptTemplate.find_or_create_by_keyword(entry[:keyword]).
update_attributes :template => entry[:template]
end
nil
end
|