Project

rest_uri

0.0
No commit activity in last 3 years
No release in over 3 years
Retrieve resource ID from REST URI
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.7
~> 10.0
>= 0

Runtime

 Project Readme

RestUri

Build Status Gem Version

Installation

Add this line to your application's Gemfile:

gem 'rest_uri'

And then execute:

$ bundle

Or install it yourself as:

$ gem install rest_uri

Usage

Simply,

tweet_url = RestUri.parse('https://twitter.com/jack/statuses/761304654147784704/photo/1')
tweet_url.status_id  #=> 761304654147784704
tweet_url.photo_id  #=> 1

To handle URL containing multibyte chars, run gem install addressable and

require 'addressable/uri'
require 'rest_uri'

rest_uri = RestUri.parse(
  'https://こんにちは.com/people/755950562227605504#foo',
  parser: Addressable::URI)
rest_uri.person_id  #=> 755950562227605504