Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/danteay/easy-ruby-request
Make easy request in ruby apps
https://github.com/danteay/easy-ruby-request
http json request ruby
Last synced: about 1 month ago
JSON representation
Make easy request in ruby apps
- Host: GitHub
- URL: https://github.com/danteay/easy-ruby-request
- Owner: danteay
- License: apache-2.0
- Created: 2017-03-08T18:27:16.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2021-08-25T02:35:28.000Z (over 3 years ago)
- Last Synced: 2024-11-18T00:45:27.344Z (about 2 months ago)
- Topics: http, json, request, ruby
- Language: Ruby
- Size: 12.7 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# easy-ruby-request
Make easy request in ruby apps## GET Request - All params example
```ruby
require 'easy_request'url = 'https://api.mysite.com/some/endpoint'
headers = {
'cache-control' => 'no-cache'
'Content-Type' => 'application/x-www-form-urlencoded'
}basic_auth = {
user: 'myuser',
pass: 'mypass'
}response = EasyRequest.get(url, basic_auth, headers)
puts response
```## GET Request - Basic example
```ruby
require 'easy_request'url = 'https://api.mysite.com/some/endpoint'
response = EasyRequest.get(url)
puts response
```## POST Request - All params example
```ruby
require 'easy_request'url = 'https://api.mysite.com/some/endpoint'
data = {
some: 'json',
id: 123,
name: 'John'
}headers = {
'cache-control' => 'no-cache'
'Content-Type' => 'application/json'
}basic_auth = {
user: 'myuser',
pass: 'mypass'
}response = EasyRequest.post(url, data, basic_auth, headers)
puts response
```## POST Request - Basic example
```ruby
require 'easy_request'url = 'https://api.mysite.com/some/endpoint'
response = EasyRequest.post(url)
puts response
```## PUT Request - All params example
```ruby
require 'easy_request'url = 'https://api.mysite.com/some/endpoint'
data = {
some: 'json',
id: 123,
name: 'John'
}headers = {
'cache-control' => 'no-cache'
'Content-Type' => 'application/json'
}basic_auth = {
user: 'myuser',
pass: 'mypass'
}response = EasyRequest.put(url, data, basic_auth, headers)
puts response
```## PUT Request - Basic example
```ruby
require 'easy_request'url = 'https://api.mysite.com/some/endpoint'
response = EasyRequest.put(url)
puts response
```
## DELETE Request - All params example
```ruby
require 'easy_request'url = 'https://api.mysite.com/some/endpoint'
data = {
some: 'json',
id: 123,
name: 'John'
}headers = {
'cache-control' => 'no-cache'
'Content-Type' => 'application/json'
}basic_auth = {
user: 'myuser',
pass: 'mypass'
}response = EasyRequest.delete(url, data, basic_auth, headers)
puts response
```
## DELETE Request - Basic example
```ruby
require 'easy_request'url = 'https://api.mysite.com/some/endpoint'
response = EasyRequest.post(url, data, basic_auth, headers)
puts response
```