Class: Sync::ReceiptTemplatesWorker
- Inherits:
-
Object
- Object
- Sync::ReceiptTemplatesWorker
- Includes:
- Sidekiq::Worker
- Defined in:
- app/workers/sync/receipt_templates_worker.rb
Instance Method Summary collapse
Instance Method Details
#perform ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 |
# 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| ReceiptTemplate.find_or_create_by_keyword(entry[:keyword]). update_attributes :template => entry[:template] end nil end |