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 SalvarRegistroVendasWorker | |
def salvar_no_banco () | |
arquivo_de_texto = BaixarArquivoServidorFtp.requisitar_servidor(arquivo) | |
LogVendas.ler_arquivo(arquivo) | |
end | |
end | |
class BaixarArquivoServidorFtp | |
attr_reader :host :porta :usuario :senha |
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 BaixarLogVendaWorker | |
def self requisitar_servidor(arquivo) | |
arquivo_de_texto =BaixarArquivoServidorFtp.requisitar_servidor(arquivo) | |
salvar_no_banco(arquivo_de_texto) | |
end | |
def slavar_no_banco(arquivo) | |
LogVendas.ler_arquivo(arquivo) | |
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
class BaixarArquivoServidorFtp | |
attr_reader :host, :porta, :usuario, :senha | |
def self.requisita_servidor(arquivo) | |
Net::FTP.open (@host) do |ftp| | |
ftp.login(@usuario,@senha) | |
ftp.gettextfile(arquivo) | |
end | |
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
class BaixarLogVendaWorker | |
attr_reader :host, :porta, :usuario, :senha | |
def self.requisita_servidor(arquivo) | |
Net::FTP.open(@host) do |ftp| | |
ftp.login(@usuario,@senha) | |
salvar_no_banco(ftp.gettextfile(arquivo) | |
end | |
end | |
def salvar_no_banco(arquivo) |
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 ContaCorrente | |
attr_accessor : taxa_juros | |
end | |
class ContaBancaria | |
def juros_por_dias(numero_de_dias, dias) | |
@contacorrente.taxa_juros * numero_de_dias * dias / 365; | |
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
class ContaBancaria | |
attr_accessor : taxa_juros | |
def juros_por_dias(numero_de_dias, dias) | |
@taxa_juros * numero_de_dias * dias / 365; | |
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
class InativarClientesWorker | |
def inativar_clientes | |
clientes = clientes_para_inativar | |
clientes.each(&:deactivate) | |
AvisarClientePorWpp.inativados(clientes) | |
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
class Clientes | |
def self.clientes_para_inativar | |
Clientes.all.select do |cliente| | |
cliente.ultima_compra > 1.month.ago && cliente.ativo? | |
end | |
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
def inativar_clientes | |
clientes= clientes_para_inativar | |
clientes.each(&:deactivate) | |
AvisarClientePorWpp.inativados(clientes) | |
end | |
def clientes_para_inativar | |
Clientes.all.select do |cliente| | |
cliente.ultima_compra > 1.month.ago && cliente.ativo? | |
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
def inativar_clientes | |
clientes =clientes_para_inativar | |
clientes.each(&:deactivate) | |
AvisarClientePorWpp.inativados(clientes) | |
end |