-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Adiciona integração com API da Zamzar para conversão de PDF para TXT (#…
…118) * atualiza deps e cria app de crawler inicial * feat: adiciona repositório para app cotacoes * feat: adiciona handlers para entidade cotacao * feat: adiciona campo em cotacao para verificar se a mesma ja foi importada * feat: remove app crawler * feat: adiciona app cotacoes_etl * feat: cria integração com site da pesagro * feat: adiciona worker para buscar boletins na pesagro * testes basicos * feat: teste do fluxo principal do worker * corrige estrutura da tabela cotacao * remove lib req e adiciona tesla * adiciona schemas para API zamzar * adiciona integração com a API zamzar * pequenos ajustes na integração da API zamzar * add baixada? ao modelo de cotacao e implementa funções extras * funções extras na integração pesagro * testes para API zamzar * fix: corrige testes
- Loading branch information
Zoey de Souza Pessanha
committed
Jul 8, 2023
1 parent
1a172ee
commit 3493977
Showing
28 changed files
with
374 additions
and
46 deletions.
There are no files selected for viewing
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
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
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
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
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
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
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
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
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
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
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
defmodule CotacoesETL.Application do | ||
use Application | ||
|
||
alias CotacoesETL.Workers.Pesagro.BoletinsFetcher | ||
|
||
@impl true | ||
def start(_, _) do | ||
children = | ||
if config_env() != :test do | ||
[BoletinsFetcher, {Finch, name: PescarteHTTPClient}] | ||
else | ||
[{Finch, name: PescarteHTTPClient}] | ||
end | ||
|
||
opts = [strategy: :one_for_one] | ||
Supervisor.start_link(children, opts) | ||
end | ||
|
||
defp config_env do | ||
Application.get_env(:cotacoes_etl, :config_env) | ||
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,12 @@ | ||
defmodule CotacoesETL.Integrations do | ||
alias CotacoesETL.Integrations.PesagroAPI | ||
alias CotacoesETL.Integrations.ZamzarAPI | ||
|
||
def pesagro_api do | ||
Application.get_env(:cotacoes_etl, :pesagro_api, PesagroAPI) | ||
end | ||
|
||
def zamzar_api do | ||
Application.get_env(:cotacoes_etl, :zamzar_api, ZamzarAPI) | ||
end | ||
end |
2 changes: 2 additions & 0 deletions
2
apps/cotacoes_etl/lib/cotacoes_etl/integrations/i_manage_pesagro_integration.ex
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,5 @@ | ||
defmodule CotacoesETL.Integrations.IManagePesagroIntegration do | ||
@callback fetch_document! :: Floki.html_tree() | ||
@callback download_file!(link) :: binary | ||
when link: String.t() | ||
end |
18 changes: 18 additions & 0 deletions
18
apps/cotacoes_etl/lib/cotacoes_etl/integrations/i_manage_zamzar_integration.ex
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
defmodule CotacoesETL.Integrations.IManageZamzarIntegration do | ||
alias CotacoesETL.Schemas.Zamzar.File, as: FileEntry | ||
alias CotacoesETL.Schemas.Zamzar.Job | ||
|
||
@callback start_job!(source_path, target_format) :: Job.t() | ||
when source_path: Path.t(), | ||
target_format: String.t() | ||
|
||
@callback retrieve_job!(job_id) :: Job.t() | ||
when job_id: integer | ||
|
||
@callback download_converted_file!(file_id, target_path) :: FileEntry.t() | ||
when file_id: integer, | ||
target_path: Path.t() | ||
|
||
@callback retrieve_file_info!(file_id) :: FileEntry.t() | ||
when file_id: integer | ||
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
Oops, something went wrong.