{"id":15502034,"url":"https://github.com/prodis/correios-sro-xml","last_synced_at":"2025-07-05T21:37:03.970Z","repository":{"id":2330428,"uuid":"3291962","full_name":"prodis/correios-sro-xml","owner":"prodis","description":"Tracking Objects System from Correios - SRO (Sistema de Rastreamento de Objetos dos Correios)","archived":false,"fork":false,"pushed_at":"2017-03-18T18:11:14.000Z","size":692,"stargazers_count":30,"open_issues_count":2,"forks_count":13,"subscribers_count":7,"default_branch":"master","last_synced_at":"2024-05-14T03:01:50.372Z","etag":null,"topics":["correios","correios-sro","correios-sro-xml","prodis","ruby","tracking"],"latest_commit_sha":null,"homepage":"http://prodis.blog.br/2012/08/17/correios-sro-xml-gem-para-rastreamento-de-objetos-dos-correios","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":"CHANGELOG.rdoc","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":"2012-01-28T17:22:26.000Z","updated_at":"2023-12-30T17:04:46.000Z","dependencies_parsed_at":"2022-08-06T12:15:11.758Z","dependency_job_id":null,"html_url":"https://github.com/prodis/correios-sro-xml","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%2Fcorreios-sro-xml","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prodis%2Fcorreios-sro-xml/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prodis%2Fcorreios-sro-xml/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prodis%2Fcorreios-sro-xml/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prodis","download_url":"https://codeload.github.com/prodis/correios-sro-xml/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246155984,"owners_count":20732355,"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":["correios","correios-sro","correios-sro-xml","prodis","ruby","tracking"],"created_at":"2024-10-02T09:07:17.021Z","updated_at":"2025-03-30T21:31:46.400Z","avatar_url":"https://github.com/prodis.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"= correios-sro-xml\n\nTracking Objects System from Correios - SRO (Sistema de Rastreamento de Objetos dos Correios), using SRO XML Web Service, that allows to query up to 50 orders simultaneously.\n\nhttp://prodis.net.br/images/ruby/2011/correios_logo.png\n\n{\u003cimg src=\"https://badge.fury.io/rb/correios-sro-xml.png\" alt=\"Gem Version\" /\u003e}[http://badge.fury.io/rb/correios-sro-xml]\n{\u003cimg src=\"https://travis-ci.org/prodis/correios-sro-xml.png?branch=master\" alt=\"Build Status\" /\u003e}[https://travis-ci.org/prodis/correios-sro-xml]\n{\u003cimg src=\"https://coveralls.io/repos/prodis/correios-sro-xml/badge.png\" alt=\"Coverage Status\" /\u003e}[https://coveralls.io/r/prodis/correios-sro-xml]\n{\u003cimg src=\"https://codeclimate.com/github/prodis/correios-sro-xml.png\" alt=\"Code Climate\" /\u003e}[https://codeclimate.com/github/prodis/correios-sro-xml]\n{\u003cimg src=\"https://gemnasium.com/prodis/correios-sro-xml.png\" alt=\"Dependency Status\" /\u003e}[https://gemnasium.com/prodis/correios-sro-xml]\n\n== Warning\n  Previous versions of version 0.4.0 don't work anymore. See issue #4 for more details.\n\nIn order to use SRO XML in production environment, it is necessary to request to Correios access data (user and password) for your company, as described in {Correios' Blog}[http://blog.correios.com.br/comercioeletronico/?p=218].\n\nFor development environment you can use follow access data:\n  user: ECT\n  password: SRO\n\n== Installing\n\n=== Gemfile\n  gem 'correios-sro-xml'\n\n=== Direct installation\n  $ gem install correios-sro-xml\n\n\n== Using\n\n  require 'correios-sro-xml'\n\n  sro = Correios::SRO::Tracker.new(user: \"ECT\", password: \"SRO\")\n\nTracking a single object:\n  object = sro.get(\"SI047624825BR\")\n  object.number                   # =\u003e \"SI047624825BR\"\n  object.events.first.date        # =\u003e \"26/12/2011\"\n  object.events.first.hour        # =\u003e \"15:22\"\n  object.events.first.place       # =\u003e \"AC CENTRAL DE SAO PAULO\"\n  object.events.first.description # =\u003e \"Entregue\"\n\nTracking many objects:\n  objects = sro.get(\"SI047624825BR\", \"SX104110463BR\")\n\n  objects[\"SI047624825BR\"].number                   # =\u003e \"SI047624825BR\"\n  objects[\"SI047624825BR\"].events.first.date        # =\u003e \"26/12/2011\"\n  objects[\"SI047624825BR\"].events.first.hour        # =\u003e \"15:22\"\n  objects[\"SI047624825BR\"].events.first.place       # =\u003e \"AC CENTRAL DE SAO PAULO\"\n  objects[\"SI047624825BR\"].events.first.description # =\u003e \"Entregue\"\n\n  objects[\"SX104110463BR\"].number                   # =\u003e \"SX104110463BR\"\n  objects[\"SX104110463BR\"].events.first.date        # =\u003e \"08/12/2011\"\n  objects[\"SX104110463BR\"].events.first.hour        # =\u003e \"09:30\"\n  objects[\"SX104110463BR\"].events.first.place       # =\u003e \"CEE JUNDIAI\"\n  objects[\"SX104110463BR\"].events.first.description # =\u003e \"Entregue\"\n\n=== Tracker result mode\n\nOne object can have one or more events.\nFor \u003cb\u003edefault\u003c/b\u003e, the tracker result mode will be return the \u003cb\u003elast object event\u003c/b\u003e.\n  sro.result_mode # =\u003e :last\n\n  object = sro.get(\"SI047624825BR\")\n  object.events.size # =\u003e 1\n\nYou can configure to return \u003cb\u003eall\u003c/b\u003e events in the object.\n  sro.result_mode = :all\n\n  object = sro.get(\"SI047624825BR\")\n  object.events.size # =\u003e 5\n\n=== Tracker query type\n\nThere are two ways to query objects in tracker:\n\n==== List of objects\nWhere all the object numbers will be requested (the default).\n  sro.query_type # =\u003e :list\n\n  objects = sro.get(\"PB996681660BR\", \"PB996681700BR\")\n  objects.keys # =\u003e [\"PB996681660BR\", \"PB996681700BR\"]\n\n==== Range of objects\nIn which you supplie the first and last objects numbers of an interval.\n  sro.query_type = :range\n\n  objects = sro.get(\"PB996681660BR\", \"PB996681700BR\")\n  objects.keys # =\u003e [\"PB996681660BR\", \"PB996681673BR\", \"PB996681687BR\", \"PB996681695BR\", \"PB996681700BR\"]\n\n\n== Configurations\n\nUse \u003cb\u003eCorreios::SRO\u003c/b\u003e module to set all available gem configuration.\n\n=== Access data\n\nYou can supply SRO XML Web Service user and password in configuration instead of each instance of \u003cb\u003eCorreios::SRO::Tracker\u003c/b\u003e class.\n  Correios::SRO.configure do |config|\n    config.user = \"ECT\"\n    config.password = \"SRO\"\n  end\n\n=== Timeout\n\nFor default, the timeout for a request to SRO XML Web Service is \u003cb\u003e5 seconds\u003c/b\u003e. If SRO XML Web Service does not respond, a \u003cb\u003eTimeout::Error\u003c/b\u003e exception will be raised.\n  Correios::SRO.configure do |config|\n    config.request_timeout = 3 # It configures timeout to 3 seconds\n  end\n\n=== Log\n\nFor default, each request to SRO XML Web service is logged to STDOUT, with \u003cb\u003e:info\u003c/b\u003e log level, using the gem {LogMe}[http://github.com/prodis/log-me].\n\nLog example:\n  I, [2012-08-17T00:55:10.531780 #22692]  INFO -- : [Correios::SRO] Request:\n  POST http://websro.correios.com.br/sro_bin/sroii_xml.eventos\n  Usuario=ECT\u0026Senha=SRO\u0026Tipo=L\u0026Resultado=U\u0026Objetos=PB996681660BR\n\n  I, [2012-08-17T00:55:10.750308 #22692]  INFO -- : [Correios::SRO] Response:\n  HTTP/1.1 200 OK\n  \u003c?xml version=\"1.0\" encoding=\"iso-8859-1\" ?\u003e\n  \u003csroxml\u003e\n     \u003cversao\u003e1.0\u003c/versao\u003e\n     \u003cqtd\u003e1\u003c/qtd\u003e\n     \u003cTipoPesquisa\u003eLista de Objetos\u003c/TipoPesquisa\u003e\n     \u003cTipoResultado\u003eÚltimo evento\u003c/TipoResultado\u003e\n       \u003cobjeto\u003e\n         \u003cnumero\u003ePB996681660BR\u003c/numero\u003e\n         \u003cevento\u003e\n            \u003ctipo\u003eBDE\u003c/tipo\u003e\n            \u003cstatus\u003e01\u003c/status\u003e\n            \u003cdata\u003e05/07/2012\u003c/data\u003e\n            \u003chora\u003e21:11\u003c/hora\u003e\n            \u003cdescricao\u003eEntregue\u003c/descricao\u003e\n            \u003crecebedor\u003e                         \u003c/recebedor\u003e\n            \u003cdocumento\u003e                         \u003c/documento\u003e\n            \u003ccomentario\u003e                         \u003c/comentario\u003e\n            \u003clocal\u003eCDD VILA ANDRADE\u003c/local\u003e\n            \u003ccodigo\u003e05724970\u003c/codigo\u003e\n            \u003ccidade\u003eSAO PAULO\u003c/cidade\u003e\n            \u003cuf\u003eSP\u003c/uf\u003e\n            \u003csto\u003e72824000\u003c/sto\u003e\n        \u003c/evento\u003e\n       \u003c/objeto\u003e\n  \u003c/sroxml\u003e\n\nYou can disable the log and configure other log output.\n  Correios::SRO.configure do |config|\n    config.log_enabled = false   # It disables the log\n    config.logger = Rails.logger # It uses Rails logger\n  end\n\n=== Configuration example\n\n  Correios::SRO.configure do |config|\n    config.user = \"ECT\"\n    config.password = \"SRO\"\n    config.logger = Rails.logger\n    config.request_timeout = 3\n  end\n\n== Author\n- {Fernando Hamasaki de Amorim (prodis)}[http://prodis.blog.br]\n\n== Collaborators\n- {Lennon Manchester (lemanchester)}[https://github.com/lemanchester]\n- {Rinaldi Fonseca (rinaldifonseca)}[https://github.com/rinaldifonseca]\n- {Thiago Ganzarolli (tganzarolli)}[https://github.com/tganzarolli]\n\n== Contributing to correios-sro-xml\n\n* Check out the latest master to make sure the feature hasn't been implemented or the bug hasn't been fixed yet.\n* Check out the issue tracker to make sure someone already hasn't requested it and/or contributed it.\n* Fork the project.\n* Start a feature/bugfix branch.\n* Commit and push until you are happy with your contribution.\n* Don't forget to rebase with branch master in main project before submit the pull request.\n* Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.\n* Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.\n\n\n== Copyright\n\n(The MIT License)\n\n{Prodis a.k.a. Fernando Hamasaki}[http://prodis.blog.br]\n\nhttp://prodis.net.br/images/prodis_150.gif\n\nCopyright (c) 2012-2014 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%2Fcorreios-sro-xml","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprodis%2Fcorreios-sro-xml","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprodis%2Fcorreios-sro-xml/lists"}