{"id":15502028,"url":"https://github.com/prodis/paypal-frete-facil","last_synced_at":"2025-04-22T22:30:15.836Z","repository":{"id":56887627,"uuid":"2244979","full_name":"prodis/paypal-frete-facil","owner":"prodis","description":"Cálculo de frete através do PayPal Frete Fácil.","archived":false,"fork":false,"pushed_at":"2012-08-09T02:12:40.000Z","size":168,"stargazers_count":4,"open_issues_count":0,"forks_count":3,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-04-11T23:07:47.687Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"http://prodis.blog.br/paypal-frete-facil-gem-para-calculo-de-frete-do-paypal-frete-facil","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prodis.png","metadata":{"files":{"readme":"README.rdoc","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2011-08-21T20:16:06.000Z","updated_at":"2016-04-26T16:47:34.000Z","dependencies_parsed_at":"2022-08-20T16:00:13.945Z","dependency_job_id":null,"html_url":"https://github.com/prodis/paypal-frete-facil","commit_stats":null,"previous_names":[],"tags_count":12,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prodis%2Fpaypal-frete-facil","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prodis%2Fpaypal-frete-facil/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prodis%2Fpaypal-frete-facil/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prodis%2Fpaypal-frete-facil/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prodis","download_url":"https://codeload.github.com/prodis/paypal-frete-facil/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250333820,"owners_count":21413465,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-10-02T09:07:12.283Z","updated_at":"2025-04-22T22:30:15.815Z","avatar_url":"https://github.com/prodis.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"= paypal-frete-facil\n\nCálculo de frete através do PayPal Frete Fácil (http://www.paypal-brasil.com.br/fretefacil).\n\n== Instalando\n\n=== Gemfile\n  gem 'paypal-frete-facil'\n\n=== Instalação direta\n  $ gem install paypal-frete-facil\n\n\n== Usando\n\n  require 'paypal-frete-facil'\n\n  shipping = PayPal::FreteFacil::Shipping.new :from_zip =\u003e \"04094-050\",\n                                              :to_zip =\u003e \"90619-900\",\n                                              :width =\u003e 15,\n                                              :height =\u003e 2,\n                                              :length =\u003e 30,\n                                              :weight =\u003e 0.3\n\n  result = shipping.calculate\n  result.value # =\u003e 14.77\n\nVerificação de sucesso e erro:\n\n  shipping.height = 200\n\n  result = shipping.calculate\n  result.success? # =\u003e false\n  result.error?   # =\u003e true\n  result.error_message # =\u003e \"Não foi possível calcular o frete.\"\n  result.value # =\u003e 0\n\nUsando a interface pública em português:\n\n  frete = PayPal::FreteFacil::Frete.new :cep_origem =\u003e \"04094-050\",\n                                        :cep_destino =\u003e \"90619-900\",\n                                        :largura =\u003e 15,\n                                        :altura =\u003e 2,\n                                        :comprimento =\u003e 30,\n                                        :peso =\u003e 0.3\n\n  resultado = frete.calcular\n  resultado.valor # =\u003e 14.77\n  resultado.sucesso? # =\u003e true\n  resultado.erro?    # =\u003e false\n  resultado.mensagem_erro # =\u003e \"\"\n\n\n== Log\n\nPor padrão, cada chamada ao Web Service do PayPal Frete Fácil é logada em STDOUT, com nível de log :info, usando a gem {LogMe}[http://github.com/prodis/log-me].\n\nExemplo de log:\n  I, [2011-08-29T22:00:52.624430 #2186]  INFO -- : PayPal-Frete-Facil Request:\n  POST https://ff.paypal-brasil.com.br/FretesPayPalWS/WSFretesPayPal\n  \u003csoapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:frete=\"https://ff.paypal-brasil.com.br/FretesPayPalWS\"\u003e\u003csoapenv:Header /\u003e\u003csoapenv:Body\u003e\u003cfrete:getPreco\u003e\u003ccepOrigem\u003e04094-050\u003c/cepOrigem\u003e\u003ccepDestino\u003e90619-900\u003c/cepDestino\u003e\u003clargura\u003e15\u003c/largura\u003e\u003caltura\u003e2\u003c/altura\u003e\u003cprofundidade\u003e30\u003c/profundidade\u003e\u003cpeso\u003e0.3\u003c/peso\u003e\u003c/frete:getPreco\u003e\u003c/soapenv:Body\u003e\u003c/soapenv:Envelope\u003e\n\n  I, [2011-08-29T22:00:53.917895 #2186]  INFO -- : PayPal-Frete-Facil Response:\n  HTTP/1.1 200 OK\n  \u003c?xml version='1.0' encoding='UTF-8'?\u003e\u003cS:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"\u003e\u003cS:Body\u003e\u003cns2:getPrecoResponse xmlns:ns2=\"https://ff.paypal-brasil.com.br/FretesPayPalWS\"\u003e\u003creturn\u003e13.873999999999999\u003c/return\u003e\u003c/ns2:getPrecoResponse\u003e\u003c/S:Body\u003e\u003c/S:Envelope\u003e\n\nSe você configurar o nível de log como :debug, serão logados também todos os cabeçalhos HTTP da requisição e da resposta:\n  D, [2011-08-29T22:00:52.624430 #2186]  DEBUG -- : PayPal-Frete-Facil Request:\n  POST https://ff.paypal-brasil.com.br/FretesPayPalWS/WSFretesPayPal\n  accept: */*\n  user-agent: Ruby\n  content-type: text/xml; charset=utf-8\n  soapaction: https://ff.paypal-brasil.com.br/FretesPayPalWS/WSFretesPayPal/getPreco\n  \u003csoapenv:Envelope xmlns:soapenv=\"http://schemas.xmlsoap.org/soap/envelope/\" xmlns:frete=\"https://ff.paypal-brasil.com.br/FretesPayPalWS\"\u003e\u003csoapenv:Header /\u003e\u003csoapenv:Body\u003e\u003cfrete:getPreco\u003e\u003ccepOrigem\u003e04094-050\u003c/cepOrigem\u003e\u003ccepDestino\u003e90619-900\u003c/cepDestino\u003e\u003clargura\u003e15\u003c/largura\u003e\u003caltura\u003e2\u003c/altura\u003e\u003cprofundidade\u003e30\u003c/profundidade\u003e\u003cpeso\u003e0.3\u003c/peso\u003e\u003c/frete:getPreco\u003e\u003c/soapenv:Body\u003e\u003c/soapenv:Envelope\u003e\n\n  D, [2011-08-29T22:00:53.917895 #2186]  DEBUG -- : PayPal-Frete-Facil Response:\n  HTTP/1.1 200 OK\n  date: Tue, 30 Aug 2011 01:00:52 GMT\n  server: Apache/2.2.17 (Unix) mod_ssl/2.2.17 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_jk/1.2.30\n  content-length: 271\n  content-type: text/xml;charset=utf-8\n  set-cookie: ROUTEID=.2; path=/\n  connection: close\n  \u003c?xml version='1.0' encoding='UTF-8'?\u003e\u003cS:Envelope xmlns:S=\"http://schemas.xmlsoap.org/soap/envelope/\"\u003e\u003cS:Body\u003e\u003cns2:getPrecoResponse xmlns:ns2=\"https://ff.paypal-brasil.com.br/FretesPayPalWS\"\u003e\u003creturn\u003e13.873999999999999\u003c/return\u003e\u003c/ns2:getPrecoResponse\u003e\u003c/S:Body\u003e\u003c/S:Envelope\u003e\n\nPara desabilitar o log, mudar o nível do log ou configurar um outro mecanismo de log, use o módulo PayPal::FreteFacil.\n\n  PayPal::FreteFacil.configure do |config|\n    config.log_enabled = false   # Desabilita o log\n    config.log_level = :debug    # Altera o nível do log\n    config.logger = Rails.logger # Usa o logger do Rails\n  end\n\n== Informações adicionais\n\n=== Maneiras de configurar atributos no construtor de PayPal::FreteFacil::Shipping (o mesmo vale para a classe PayPal::FreteFacil::Frete)\n\n==== Com um hash\n  shipping = PayPal::FreteFacil::Shipping.new :from_zip =\u003e \"04094-050\",\n                                              :to_zip =\u003e \"90619-900\",\n                                              :width =\u003e 15,\n                                              :height =\u003e 2,\n                                              :length =\u003e 30,\n                                              :weight =\u003e 0.3\n\n==== Com um bloco\n  shipping = PayPal::FreteFacil::Shipping.new do |s|\n    s.from_zip = \"04094-050\"\n    s.to_zip = \"90619-900\"\n    s.width = 15\n    s.height = 2\n    s.length = 30\n    s.weight = 0.3\n  end\n\n=== Atributos de PayPal::FreteFacil::Shipping\n\n==== String\n  from_zip, to_zip\n==== Fixnum\n  width, height, length\n==== Float\n  weight\n\n=== Observações da classe PayPal::FreteFacil::Shipping\n* Os atributos *width*, *height* e *length* também aceitam valores com casas decimais (\u003cem\u003efloat\u003c/em\u003e), mas para fazer o cálculo do frete será feito um \u003cem\u003eround\u003c/em\u003e de seus valores.\n\n\n=== Atributos de PayPal::FreteFacil::Frete\n\n==== String\n  cep_origem, cep_destino\n==== Fixnum\n  largura, altura, comprimento\n==== Float\n  peso\n\n=== Observações da classe PayPal::FreteFacil::Frete\n* Os atributos *largura*, *altura* e *comprimento* também aceitam valores com casas decimais (\u003cem\u003efloat\u003c/em\u003e), mas para fazer o cálculo do frete será feito um \u003cem\u003eround\u003c/em\u003e de seus valores.\n\n\n== Copyright\n\n(The MIT License)\n\n{Prodis a.k.a. Fernando Hamasaki}[http://prodis.blog.br]\n\nCopyright (c) 2011-2012 Prodis\n\nPermission is hereby granted, free of charge, to any person obtaining\na copy of this software and associated documentation files (the\n\"Software\"), to deal in the Software without restriction, including\nwithout limitation the rights to use, copy, modify, merge, publish,\ndistribute, sublicense, and/or sell copies of the Software, and to\npermit persons to whom the Software is furnished to do so, subject to\nthe following conditions:\n\nThe above copyright notice and this permission notice shall be\nincluded in all copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND,\nEXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF\nMERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND\nNONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE\nLIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION\nOF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION\nWITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprodis%2Fpaypal-frete-facil","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprodis%2Fpaypal-frete-facil","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprodis%2Fpaypal-frete-facil/lists"}