-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
0 parents
commit 26c9846
Showing
9 changed files
with
244 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
name: build | ||
|
||
on: [push, pull_request] | ||
jobs: | ||
wollok-ts: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v4 | ||
- run: | | ||
wget -O wollok-ts-cli https://github.com/uqbar-project/wollok-ts-cli/releases/latest/download/wollok-ts-cli-linux-x64 | ||
chmod a+x ./wollok-ts-cli | ||
./wollok-ts-cli test --skipValidations -p ./ | ||
shell: bash |
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,6 @@ | ||
|
||
# Local history | ||
.history | ||
|
||
# Wollok Log | ||
*.log |
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,6 @@ | ||
|
||
|
||
## dolarito | ||
|
||
TODO | ||
|
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,43 @@ | ||
let resultado:string | undefined | ||
|
||
const dolarApi = { | ||
*request(this: any, self: any) : any { | ||
resultado = undefined | ||
try { | ||
buscarCotizacion((res: string) => { | ||
resultado = res | ||
}) | ||
} | ||
catch (error) { | ||
resultado = `Error: ${error}` | ||
} | ||
}, | ||
|
||
*response(this:any, self:any): any { | ||
return this.reify(resultado) | ||
}, | ||
} | ||
|
||
function buscarCotizacion(callback: (resultado: string) => void): void { | ||
const apiUrl = 'https://api.bluelytics.com.ar/v2/latest' | ||
|
||
fetch(apiUrl) | ||
.then(response => { | ||
if (!response.ok) { | ||
callback(`Error ${response}`) | ||
return | ||
} | ||
return response.json() | ||
}) | ||
.then(data => { | ||
const compraBlue = data.blue.value_buy | ||
const ventaBlue = data.blue.value_sell | ||
callback(`Dólar Blue - Compra: $${compraBlue}, Venta: $${ventaBlue}`) | ||
}) | ||
.catch(error => { | ||
callback(`Error: ${error}`) | ||
}) | ||
} | ||
|
||
|
||
export { dolarApi } |
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,43 @@ | ||
import wollok.game.* | ||
|
||
object buscando { | ||
method text() = "BUSCANDO" | ||
method buscar(owner) { self.error ("Ya estoy buscando")} | ||
|
||
method buscarResultado(owner) { | ||
const r = dolarApi.response() | ||
if (r != null) { | ||
game.removeTickEvent("RESULTADO") | ||
owner.estado(new Libre(text=r)) | ||
} | ||
} | ||
|
||
} | ||
|
||
class Libre { | ||
var property text = "Apretá enter!" | ||
method buscar(owner) { | ||
owner.estado(buscando) | ||
dolarApi.request() | ||
game.onTick(1,"RESULTADO", { buscando.buscarResultado(owner) } ) | ||
} | ||
|
||
} | ||
|
||
object dolarito { | ||
|
||
var property estado = new Libre() | ||
var property position = game.center() | ||
|
||
method image() = "dolarito.gif" | ||
method text() = estado.text() | ||
|
||
method buscar() { | ||
estado.buscar(self) | ||
} | ||
} | ||
|
||
object dolarApi { | ||
method request() native | ||
method response() native | ||
} |
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 @@ | ||
import wollok.game.* | ||
|
||
import dolarito.dolarito | ||
|
||
program Doralito { | ||
game.title("Dolarito") | ||
game.height(10) | ||
game.width(10) | ||
|
||
game.addVisualCharacter(dolarito) | ||
|
||
keyboard.enter().onPressDo({ | ||
dolarito.buscar() | ||
}) | ||
|
||
|
||
game.start() | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
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,8 @@ | ||
{ | ||
"name": "dolarito", | ||
"version": "1.0.0", | ||
"resourceFolder": "assets", | ||
"wollokVersion": "4.0.0", | ||
"author": "leo", | ||
"license": "ISC" | ||
} |