Giter Club home page Giter Club logo

correios's Introduction

Correios

Gem para cálculo de frete usando o e rastreamento dos correios usando webservices. www.correios.com.br/webservices/

Instalação

$ gem install correios

Como Usar

> require 'correios'

# Para calcular apenas um serviço
> correios = Correios.new(76410000, 74932180)
> correios.calcular_frete(Correios::Servico::PAC, 0.4, 17, 16, 16)

# Para calcular mais de um serviço
# Neste caso o retorno será um hash.
> correios = Correios.new(76410000, 74932180)
> frete = correios.calcular_frete([Correios::Servico::PAC, Correios::Servico::SEDEX], 0.4, 17, 16, 16)

> frete[:pac]
=> #<Correios::Servico:0x10189ad08 @message="", @servico=:pac, @erro="0", @prazo=5, @valor=11.5>
> frete[:sedex]
=> #<Correios::Servico:0x10189a948 @message="", @servico=:sedex, @erro="0", @prazo=4, @valor=14.7>

Outras informações

Definição do método calcula frete:

calcular_frete(servicos, peso, comprimento,
              altura, largura, diametro = 0, mao_propria = NAO,
              valor_declarado = 0, aviso_recebimento = NAO)

Serviços:

Correios::Servico::PAC
Correios::Servico::SEDEX
Correios::Servico::SEDEX10
Correios::Servico::SEDEX_HOJE
Correios::Servico::ESEDEX

Rastreamento

require "correios"

rastreamento = Correios::Rastreamento.new "SS987654321BR"
rastreamento.buscar

#=> [{ :data => "21/04/2012 14:21", :local => "CTE SAUDE - SAO PAULO/SP", :descricao => "", :detalhes => "Entrega Efetuada" }]

rastreamento.chegou?

#=> true

Contato

Caso tenha alguma dúvida ou sugestão entre em contato: bfscordeiro (em) gmail.com

Copyright © 2010 Bruno Cordeiro, released under the MIT license

correios's People

Contributors

brunofrank avatar kurko avatar rogeriozambon avatar

Stargazers

Heitor Salazar Baldelli avatar Daniel avatar Leandro Canabarro avatar  avatar Fernão Paes Leme avatar Rogério Oliveira avatar  avatar Rodrigo Manhães avatar  avatar Warlley avatar

Watchers

 avatar  avatar James Cloos avatar Carlos Figueiredo avatar

correios's Issues

License missing from gemspec

Some companies will only use gems with a certain license.
The canonical and easy way to check is via the gemspec
via e.g.

spec.license = 'MIT'
# or
spec.licenses = ['MIT', 'GPL-2']

There is even a License Finder to help companies ensure all gems they use
meet their licensing needs. This tool depends on license information being available in the gemspec.
Including a license in your gemspec is a good practice, in any case.

How did I find you?

I'm using a script to collect stats on gems, originally looking for download data, but decided to collect licenses too,
and make issues for missing ones as a public service :)
https://gist.github.com/bf4/5952053#file-license_issue-rb-L13 So far it's going pretty well

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.