{"id":15608930,"url":"https://github.com/serradura/request_via","last_synced_at":"2025-08-09T06:04:26.366Z","repository":{"id":56891852,"uuid":"108891092","full_name":"serradura/request_via","owner":"serradura","description":"RequestVia: A Functional HTTP Client That Wraps Net::HTTP","archived":false,"fork":false,"pushed_at":"2018-07-20T17:16:47.000Z","size":58,"stargazers_count":74,"open_issues_count":5,"forks_count":2,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-07-28T12:46:41.482Z","etag":null,"topics":["functional","functional-programming","http","http-client","nethttp","ruby","uri"],"latest_commit_sha":null,"homepage":"https://rubygems.org/gems/request_via","language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/serradura.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.txt","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2017-10-30T18:23:26.000Z","updated_at":"2024-12-29T02:53:06.000Z","dependencies_parsed_at":"2022-08-21T00:20:57.116Z","dependency_job_id":null,"html_url":"https://github.com/serradura/request_via","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"purl":"pkg:github/serradura/request_via","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serradura%2Frequest_via","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serradura%2Frequest_via/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serradura%2Frequest_via/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serradura%2Frequest_via/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/serradura","download_url":"https://codeload.github.com/serradura/request_via/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/serradura%2Frequest_via/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":269537452,"owners_count":24434166,"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","status":"online","status_checked_at":"2025-08-09T02:00:10.424Z","response_time":111,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["functional","functional-programming","http","http-client","nethttp","ruby","uri"],"created_at":"2024-10-03T05:40:30.844Z","updated_at":"2025-08-09T06:04:26.333Z","avatar_url":"https://github.com/serradura.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"# RequestVia\n\nA fast and functional (API and paradigm) HTTP client, using only Ruby's standard library as dependency. e.g: Net::HTTP and URI.\n\n![gif](http://g.recordit.co/S6EPTX5hHH.gif)\n\nList of all commands shown in the GIF:\n```ruby\nrequire 'request_via'\n\n# Thanks to @ElliottLandsborough Dog CEO API (https://github.com/ElliottLandsborough/dog-ceo-api)\n\n# --- Single request\n\nresponse = RequestVia::Get.('https://dog.ceo/api/breed/boxer/images/random')\nresponse.body\n\n# --- Make requests over a map iteration\n\ndogs = [ 'akita', 'chihuahua', 'beagle' ]\ndog_images = dogs.map { |breed_name| \"https://dog.ceo/api/breed/#{breed_name}/images/random\" }\ndog_images.map(\u0026RequestVia::Get).map(\u0026:body)\n\n# If do you want to pass common arguments for each request use the GetR function (R = reversed arguments)\n# Available options: port, params, headers, open_timeout read_timeout, response_and_request, net_http\ndog_images.map(\u0026RequestVia::GetR.(open_timeout: 10)).map(\u0026:body)\n\n# --- Make requests over an ASYNC map iteration\n\nrequire 'parallel' # https://rubygems.org/gems/parallel\n\nParallel.map(dog_images, \u0026RequestVia::Get).map(\u0026:body)\n\n# Apply common options for each request\nParallel.map(dog_images, \u0026RequestVia::GetR.(open_timeout: 10)).map(\u0026:body)\n```\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n```ruby\ngem 'request_via'\n```\n\nAnd then execute:\n\n    $ bundle\n\nOr install it yourself as:\n\n    $ gem install request_via\n\n## Usage\n\nMaking a HTTP GET request\n```ruby\n# Use http:// as the protocol when there is no one defined.\nRequestVia::Get.call('example.com')\n\nRequestVia::Get.call('http://example.com')\n\n# We recommend to use the `.()` syntax to invoke/make the HTTP requests.\n# Read more about this: https://ruby-doc.org/core-2.2.2/Proc.html#method-i-call\nRequestVia::Get.('example.com')\n\n# Request with params\nRequestVia::Get.('example.com', params: { foo: 'bar' })\n\n# Request with headers\nRequestVia::Get.('example.com/foo', headers: { 'X-Requested-With': 'RequestVia gem' })\n\n# Return the response and request objects\nresponse, request = RequestVia::Get.('example.com/foo', response_and_request: true)\n\n# Request with the reversed arguments order\n%w[\n  example.com/foo example.com/bar\n].map \u0026RequestVia::GetR.(headers: { 'X-Requested-With': 'RequestVia gem' })\n\n# Other options\nRequestVia::Get.('example.io', port: 2000,\n                               open_timeout: 10,  # Default: 60\n                               read_timeout: 120, # Default: 60\n                               net_http: -\u003e (host, port) {\n                                   net_http = Net::HTTP.new(host, port)\n                                   # Make your customizations\n                                   net_http\n                               })\n```\n\nSupported HTTP methods.\n(**NOTE:** you can use all arguments of previous examples)\n```ruby\nRequestVia::Head.()    # RequestVia::HeadR.()\n\nRequestVia::Post.()    # RequestVia::PostR.()\n\nRequestVia::Put.()     # RequestVia::PutR.()\n\nRequestVia::Delete.()  # RequestVia::DeleteR.()\n\nRequestVia::Options.() # RequestVia::OptionsR.()\n\nRequestVia::Trace.()   # RequestVia::TraceR.()\n\nRequestVia::Patch.()   # RequestVia::PatchR.()\n```\n\nMaking a HTTPS request.\n```ruby\nRequestVia::Get.('https://example.com')\n```\n\nCreate a HTTP(S) client for REST resources.\n```ruby\nclient = RequestVia::Client.('https://example.com')\n\nclient.get # same of client.get('/')\n\n# Supported arguments: params:, headers:\nclient.get(params: { a: 1 }, headers: { 'Header-Name' =\u003e 'Header-Value' })\n\nclient.get('foo', params: { a: 1 })\n\nclient.get('/bar', headers: { 'User-Agent' =\u003e 'REST Example' })\n\n# Supported HTTP methods:\n# client.get\n# client.head\n# client.post\n# client.put\n# client.delete\n# client.options\n# client.trace\n# client.patch\n\n# Supported options\nRequestVia::Client.('example.com/foo/bar', port: 3000,\n                                           open_timeout: 10,\n                                           read_timeout: 100)\n```\n\n## Development\n\nAfter checking out the repo, run `bin/setup` to install dependencies. Then, run `rake test` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.\n\nTo install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).\n\n## Contributing\n\nBug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/request_via. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the [Contributor Covenant](http://contributor-covenant.org) code of conduct.\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n\n## Code of Conduct\n\nEveryone interacting in the RequestVia project’s codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/request_via/blob/master/CODE_OF_CONDUCT.md).\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserradura%2Frequest_via","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fserradura%2Frequest_via","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fserradura%2Frequest_via/lists"}