GithubHelp home page GithubHelp logo

rust-lang-ve / libcne-ve Goto Github PK

View Code? Open in Web Editor NEW
1.0 2.0 1.0 64 KB

Fetches data from a public endpoint in the CNE website and deserializes its contents

License: Other

Rust 100.00%
cne rust lib fullstack deserializes

libcne-ve's Introduction

libcne-ve

Fetches data from a public endpoint in the CNE website and deserializes its contents.

Installation

To install the latest release, add the crate as follows to your dependencies list in your Cargo.toml.

[dependencies]
libcne-ve = "0.1.0"

If you want to use a specific version, you must add the crate to your Cargo.toml as follows:

[dependencies]
libcne = { git = "https://github.com/rust-lang-ve/libcne-ve.git", tag = "v0.1.0" }

Motivation

The first motivation for this repository is to learn Rust. We have a very good feeling regarding the future of Rust so we decided to learn about the language in community.

libcne-ve is a hobbist project to gather public data available in the CNE website.

Basically this crate, makes a request to the endpoint available in the site used to fetch date about where a given ID (CID) belongs as voting center, scraps the HTML response into an Elector struct and returns it.

Example

The following sample is available in the libcne-ve/example directory:

use libcne_ve::request::find;
use libcne_ve::cne::{Citizenship, Elector};

#[tokio::main]
async fn main() {
  let elector_id: String = String::from("123123123");
  let elector: Elector = find(Citizenship::V, elector_id).await.unwrap();

  println!("{:?}", elector);
}

Releasing

To release a new version you must tag with git and push to the main branch.

git tag -a v0.1.0 -m "First Release"
git push origin main --follow-tags

Contributing

Every contribution to this project is welcome! Feel free to open a pull request or an issue.

License

Licensed under the GNU General Public License.

libcne-ve's People

Contributors

angel-afonso avatar estebanborai avatar

Stargazers

 avatar

Watchers

 avatar  avatar

Forkers

angel-afonso

libcne-ve's Issues

Instance `Elector` from HTML response

Requirement

The From trait which is already implemented for the Elector struct should return an Elector instance given the HTML document returned by:
http_client.get(&url).send().await?

Overview

Elector From trait Implementation

https://github.com/rust-lang-ve/libcne/blob/8461bc153bcbaf3448eb8ada2a06840e625a97d3/src/cne/elector.rs#L20

Request that returns HTML

https://github.com/rust-lang-ve/libcne/blob/8461bc153bcbaf3448eb8ada2a06840e625a97d3/src/request/request.rs#L11

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.