Project

arest

0.0
No commit activity in last 3 years
No release in over 3 years
A Very Simple REST client
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.8
>= 3.2.0, ~> 3.2

Runtime

>= 4.2.1, ~> 4.2
>= 1.8.3, ~> 1.8
 Project Readme

ARest Ruby Gem

Very simple REST client. Provides basic REST operations: get, post, put and delete

>> client = ARest.new 'http://jsonplaceholder.typicode.com'
=> <ARest http://jsonplaceholder.typicode.com>
>> res = client.post('posts', form_data: { title: 'foo', body: 'bar', userId: 1 })
=> #<Net::HTTPOK 200 OK readbody=true>
>> res.ok?
=> true
>> res.deserialize
=> {"title"=>"foo", "body"=>"bar", "userId"=>1, "id"=>101}

Basic http authentication

>> auth = ARest.new 'http://tarkin.tg.pl/_api/v1', username: 'user@example.com', password: 'password0'
=> <ARest http://tarkin.tg.pl/_api/v1, authenticating as user@example.com>
>> token = auth.get('_authorize').deserialize
=> "jbYjX0_Ofx2Okoj9XVnOJvFD-PujbRFTleATUK..."

Token authentication

>> client = ARest.new 'http://tarkin.tg.pl/_api/v1', token: token
=> <ARest http://tarkin.tg.pl/_api/v1>
>> pass = client.get('/db/prod/oracle/scott').deserialize
=> "t1ger"

More examples

Take a look on spec folder

License

MIT

Author

Tomek 'Grych' Gryszkiewicz grych@tg.pl http://www.tg.pl