https://github.com/blendle/excon-addressable
Sets Addressable as the default URI parser. Supports parsing templated uris.
https://github.com/blendle/excon-addressable
excon
Last synced: 2 months ago
JSON representation
Sets Addressable as the default URI parser. Supports parsing templated uris.
- Host: GitHub
- URL: https://github.com/blendle/excon-addressable
- Owner: blendle
- License: mit
- Created: 2016-05-17T17:11:59.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2018-06-08T12:50:46.000Z (about 7 years ago)
- Last Synced: 2025-04-04T13:38:37.609Z (2 months ago)
- Topics: excon
- Language: Ruby
- Homepage:
- Size: 25.4 KB
- Stars: 3
- Watchers: 7
- Forks: 1
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE.txt
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Excon::Addressable [](https://app.wercker.com/project/bykey/3868c162aa140566b830f517c45d528a)
Sets [Addressable][addressable] as the default URI parser. Supports parsing
[templated uris][].## Installation
Add this line to your application's Gemfile:
```ruby
gem 'excon-addressable'
```And then execute:
```shell
bundle
```Or install it yourself as:
```shell
gem install excon-addressable
```## Usage
Be sure to add `Excon::Addressable::Middleware` to the top of the middleware
stack, so that the variables get expanded as early as possible. This prevents
other middleware from choking on non-valid URIs.```ruby
Excon.defaults[:middlewares].unshift(Excon::Addressable::Middleware)
```Then simply provide a templated variable, and the values with which to expand
the template:```ruby
conn = Excon.new('http://www.example.com/{uid}', expand: { uid: 'hello' })
conn.request.path # => '/hello'
```## License
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
[addressable]: https://github.com/sporkmonger/addressable
[templated uris]: https://github.com/sporkmonger/addressable#uri-templates