-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from wistia/jz-endpoints
Add methods for nsqd and nsqlookupd HTTP endpoints
- Loading branch information
Showing
11 changed files
with
461 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
PATH | ||
remote: . | ||
specs: | ||
nsq-cluster (0.0.0) | ||
nsq-cluster (0.1.1) | ||
nsq-cluster | ||
|
||
GEM | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
0.1.0 | ||
0.1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
require 'net/http' | ||
require 'uri' | ||
|
||
module HTTPWrapper | ||
|
||
|
||
def post(path, params = {}, body = nil) | ||
uri = uri("#{path}?#{URI.encode_www_form(params)}") | ||
request = Net::HTTP::Post.new(uri) | ||
request.body = body | ||
|
||
Net::HTTP.start(uri.hostname, uri.port) do |http| | ||
http.request(request) | ||
end | ||
end | ||
|
||
|
||
def get(path, params = {}) | ||
uri = uri(path) | ||
uri.query = URI.encode_www_form(params) | ||
Net::HTTP.get_response(uri) | ||
end | ||
|
||
|
||
private | ||
|
||
|
||
def uri(path) | ||
URI("http://#{@host}:#{@http_port}/#{path}") | ||
end | ||
|
||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,16 +2,16 @@ | |
# DO NOT EDIT THIS FILE DIRECTLY | ||
# Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec' | ||
# -*- encoding: utf-8 -*- | ||
# stub: nsq-cluster 0.1.0 ruby lib | ||
# stub: nsq-cluster 0.1.1 ruby lib | ||
|
||
Gem::Specification.new do |s| | ||
s.name = "nsq-cluster" | ||
s.version = "0.1.0" | ||
s.version = "0.1.1" | ||
|
||
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version= | ||
s.require_paths = ["lib"] | ||
s.authors = ["Brendan Schwartz"] | ||
s.date = "2014-04-14" | ||
s.date = "2014-06-26" | ||
s.description = "Setup nsqd, nsqlookupd, and nsqadmin in a jiffy. Great for testing!" | ||
s.email = "[email protected]" | ||
s.executables = ["nsq-cluster"] | ||
|
@@ -31,13 +31,16 @@ Gem::Specification.new do |s| | |
"VERSION", | ||
"bin/nsq-cluster", | ||
"lib/nsq-cluster.rb", | ||
"lib/nsq-cluster/http_wrapper.rb", | ||
"lib/nsq-cluster/nsqadmin.rb", | ||
"lib/nsq-cluster/nsqd.rb", | ||
"lib/nsq-cluster/nsqlookupd.rb", | ||
"lib/nsq-cluster/process_wrapper.rb", | ||
"nsq-cluster.gemspec", | ||
"test/helper.rb", | ||
"test/nsq_cluster_spec.rb" | ||
"test/nsq_cluster_spec.rb", | ||
"test/nsqd_spec.rb", | ||
"test/nsqlookupd_spec.rb" | ||
] | ||
s.homepage = "http://github.com/wistia/nsq-cluster" | ||
s.licenses = ["MIT"] | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
require 'json' | ||
require 'simplecov' | ||
require 'minitest/autorun' | ||
require 'minitest/pride' | ||
|
Oops, something went wrong.