This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Use this file to easily define all of your cron jobs. | |
# | |
# It's helpful, but not entirely necessary to understand cron before proceeding. | |
# http://en.wikipedia.org/wiki/Cron | |
# Example: | |
# | |
# set :output, "/path/to/my/cron_log.log" | |
# | |
every 1.minute do |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
module Exchange | |
module QuotationWorker | |
class QuotationParsingTimeWorker | |
include Sidekiq::Worker | |
def perform(*args) | |
Integrations::Exchange::QuotationParser::Parsing.new.parsing_quotation.perform_now | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sidekiq.configure_server do |config| | |
config.redis = { | |
db: 1, url: ENV.fetch('REDIS_URL'), namespace: "sidekiq_eagro_#{Rails.env}", size: Sidekiq.options[:concurrency] + 2 | |
} | |
config.on(:startup) do | |
Sidekiq.schedule = YAML.load_file(File.expand_path('../../sidekiq_scheduler.yml', __FILE__)) | |
SidekiqScheduler::Scheduler.instance.reload_schedule! | |
end | |
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<div class='row p-10'> | |
<div class='form-group'> | |
<div class='col-xs-6'> | |
<span class='form-control-static'>Produto</span> | |
<br> | |
<%- if d.object.id %> | |
<h4 class='m-t-10'><%= "#{d.object.input.commercial} " %> </h4> | |
<% else %> | |
<span class='select'> | |
<%= d.select :input_group_id, |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<%= js "app/adjust-stock-form" %> | |
<div class='row p-10'> | |
<%= nested_form_for(@adjust_stock, html: { role: 'form' }) do |f| %> | |
<%= render 'shared/errors', :resource => @adjust_stock %> | |
<%= f.hidden_field :kind %> | |
<div class='col-md-4'> | |
<div class='form-group col-md-8'> | |
<%= f.label :date %> | |
<%= f.text_field :date, class: 'form-control', 'data-mask' => 'date'%> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def create | |
@operation = Supply::SupplyCreator.new(permitted_params[:supply]) | |
@operation.company = current_company | |
@operation.user = current_user | |
@operation.perform | |
if @operation.succeeded? | |
redirect_to edit_bank_debit_path(@operation.supply.bank_debits.first, file: @file) | |
else | |
@supply = @operation.validator | |
render action: :new |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Supply::SupplyCreator < ComposableOperations::Operation | |
processes :params | |
attr_accessor :company, :user | |
attr_reader :validator, :supply | |
delegate :errors, to: :validator |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Classe base de validações auxiliares | |
class BaseValidator < SimpleDelegator | |
include ActiveModel::Model | |
include ActiveModel::Validations | |
def build_error_list(prefix, list, indexes = nil) | |
error_list = list.each_with_index.map do |item, i| | |
index = coalesce_index(item, i, indexes) | |
key = [prefix, index].compact.join '.' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Supply::SupplyCreateValidator < BaseValidator | |
MODEL = Supply | |
attr_reader :supply, :company, :stock_group | |
validates :supply, presence: true | |
#validate :validate_group_zprovider | |
#validate :check_invoice | |
validate :validate_date |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class NfeioController < InheritedResources::Base | |
before_action :authenticate_user!, :except => [:webhook] | |
before_filter :resource | |
skip_before_action :verify_authenticity_token | |
def webhook | |
event = JSON.parse(request.body.read) | |
case event['action'] |
NewerOlder