Skip to content

Commit 7238460

Browse files
author
Montana Flynn
committed
Add Ruby to README and update reference link
1 parent b04c0ad commit 7238460

3 files changed

Lines changed: 14 additions & 12 deletions

File tree

README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ Currently the following output [targets](/src/targets) are supported:
3636
- [Native](http://nodejs.org/api/http.html#http_http_request_options_callback)
3737
- [Request](https://github.com/request/request)
3838
- [Unirest](http://unirest.io/nodejs.html)
39-
- OCaml
40-
- [CoHTTP](https://github.com/mirage/ocaml-cohttp)
39+
- Ruby
40+
- [Native](http://ruby-doc.org/stdlib-2.2.1/libdoc/net/http/rdoc/Net/HTTP.html)
4141
- PHP
4242
- [ext-curl](http://php.net/manual/en/book.curl.php)
4343
- [pecl/http v1](http://php.net/manual/en/book.http.php)
@@ -46,7 +46,10 @@ Currently the following output [targets](/src/targets) are supported:
4646
- [Python 3](https://docs.python.org/3/library/http.client.html)
4747
- Objective-C
4848
- [NSURLSession](https://developer.apple.com/library/mac/documentation/Foundation/Reference/NSURLSession_class/index.html)
49-
- [Go](http://golang.org/pkg/net/http/#NewRequest)
49+
- Go
50+
- [Native](http://golang.org/pkg/net/http/#NewRequest)
51+
- OCaml
52+
- [CoHTTP](https://github.com/mirage/ocaml-cohttp)
5053

5154
## Installation
5255

src/targets/ruby/native.js

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,8 @@ var util = require('util')
55
module.exports = function (source, options) {
66
var self = this
77
var code = []
8-
code.push('require \'uri\'')
9-
code.push('require \'net/http\'')
8+
code.push("require 'uri'")
9+
code.push("require 'net/http'")
1010
code.push(null)
1111

1212
// To support custom methods we check for the supported methods
@@ -15,10 +15,9 @@ module.exports = function (source, options) {
1515
var methods = ['GET', 'POST', 'HEAD', 'DELETE', 'PATCH', 'PUT', 'OPTIONS', 'COPY', 'LOCK', 'UNLOCK', 'MOVE', 'TRACE']
1616
var capMethod = method.charAt(0) + method.substring(1).toLowerCase()
1717
if (methods.indexOf(method) < 0) {
18-
code.push('class Net::HTTP::%s < Net::HTTPRequest')
1918
code.push(util.format('class Net::HTTP::%s < Net::HTTPRequest', capMethod))
20-
code.push(util.format(' METHOD = \'%s\'', method.toUpperCase()))
21-
code.push(util.format(' REQUEST_HAS_BODY = \'%s\'', self.source.postData.text ? 'true' : 'false'))
19+
code.push(util.format(" METHOD = '%s'", method.toUpperCase()))
20+
code.push(util.format(" REQUEST_HAS_BODY = '%s'", self.source.postData.text ? 'true' : 'false'))
2221
code.push(' RESPONSE_HAS_BODY = true')
2322
code.push('end')
2423
code.push(null)
@@ -61,6 +60,6 @@ module.exports = function (source, options) {
6160
module.exports.info = {
6261
key: 'native',
6362
title: 'net::http',
64-
link: 'http://ruby-doc.org/stdlib-2.2.1/libdoc/net/http/rdoc/Net/HTTPGenericRequest.html',
65-
description: 'Ruby request client'
63+
link: 'http://ruby-doc.org/stdlib-2.2.1/libdoc/net/http/rdoc/Net/HTTP.html',
64+
description: 'Ruby HTTP client'
6665
}

test/fixtures/available-targets.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,8 @@
156156
{
157157
"key": "native",
158158
"title": "net::http",
159-
"link": "http://ruby-doc.org/stdlib-2.2.1/libdoc/net/http/rdoc/Net/HTTPGenericRequest.html",
160-
"description": "Ruby request client"
159+
"link": "http://ruby-doc.org/stdlib-2.2.1/libdoc/net/http/rdoc/Net/HTTP.html",
160+
"description": "Ruby HTTP client"
161161
}
162162
]
163163
}

0 commit comments

Comments
 (0)