Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ So you're probably wondering how using Unirest makes creating requests in Ruby e
```ruby
response = Unirest.post "http://httpbin.org/post",
headers:{ "Accept" => "application/json" },
parameters:{ :age => 23, :foo => "bar" }
params:{ :age => 23, :foo => "bar" }

response.code # Status code
response.headers # Response headers
Expand All @@ -58,7 +58,7 @@ Unirest-Ruby also supports asynchronous requests with a callback function specif
```ruby
response = Unirest.post "http://httpbin.org/post",
headers:{ "Accept" => "application/json" },
parameters:{ :age => 23, :foo => "bar" } {|response|
params:{ :age => 23, :foo => "bar" } {|response|
response.code # Status code
response.headers # Response headers
response.body # Parsed body
Expand All @@ -70,14 +70,14 @@ response = Unirest.post "http://httpbin.org/post",
```ruby
response = Unirest.post "http://httpbin.org/post",
headers:{ "Accept" => "application/json" },
parameters:{ :age => 23, :file => File.new("/path/to/file", 'rb') }
params:{ :age => 23, :file => File.new("/path/to/file", 'rb') }
```

## Custom Entity Body
```ruby
response = Unirest.post "http://httpbin.org/post",
headers:{ "Accept" => "application/json" },
parameters:{ :age => "value", :foo => "bar" }.to_json # Converting the Hash to a JSON string
params:{ :age => "value", :foo => "bar" }.to_json # Converting the Hash to a JSON string
```

### Basic Authentication
Expand All @@ -90,11 +90,11 @@ response = Unirest.get "http://httpbin.org/get", auth:{:user=>"username", :passw

# Request
```ruby
Unirest.get(url, headers: {}, parameters: nil, auth:nil, &callback)
Unirest.post(url, headers: {}, parameters: nil, auth:nil, &callback)
Unirest.delete(url, headers: {}, parameters: nil, auth:nil, &callback)
Unirest.put(url, headers: {}, parameters: nil, auth:nil, &callback)
Unirest.patch(url, headers: {}, parameters: nil, auth:nil, &callback)
Unirest.get(url, headers: {}, params: nil, auth:nil, &callback)
Unirest.post(url, headers: {}, params: nil, auth:nil, &callback)
Unirest.delete(url, headers: {}, params: nil, auth:nil, &callback)
Unirest.put(url, headers: {}, params: nil, auth:nil, &callback)
Unirest.patch(url, headers: {}, params: nil, auth:nil, &callback)
```

- `url` (`String`) - Endpoint, address, or uri to be acted upon and requested information from.
Expand Down
2 changes: 1 addition & 1 deletion unirest.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ Gem::Specification.new do |s|
s.add_development_dependency('test-unit')
s.add_development_dependency('rake')

s.required_ruby_version = '~> 2.0'
s.required_ruby_version = '~> 2.2.2'

s.files = `git ls-files`.split("\n")
s.test_files = `git ls-files -- test/*`.split("\n")
Expand Down