sloop 0.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/LICENSE +18 -0
- data/Readme.mkd +1 -0
- data/bin/sloop +8 -0
- data/lib/sloop.rb +32 -0
- metadata +51 -0
data/LICENSE
ADDED
@@ -0,0 +1,18 @@
|
|
1
|
+
Copyright (c) 2011 Robert R Evans
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
4
|
+
this software and associated documentation files (the "Software"), to deal in
|
5
|
+
the Software without restriction, including without limitation the rights to
|
6
|
+
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
7
|
+
the Software, and to permit persons to whom the Software is furnished to do so,
|
8
|
+
subject to the following conditions:
|
9
|
+
|
10
|
+
The above copyright notice and this permission notice shall be included in all
|
11
|
+
copies or substantial portions of the Software.
|
12
|
+
|
13
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
14
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
15
|
+
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
16
|
+
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
17
|
+
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
18
|
+
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Readme.mkd
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
# Sloop
|
data/bin/sloop
ADDED
data/lib/sloop.rb
ADDED
@@ -0,0 +1,32 @@
|
|
1
|
+
require 'faraday'
|
2
|
+
require 'yajl'
|
3
|
+
require 'colored'
|
4
|
+
|
5
|
+
class Sloop
|
6
|
+
def self.name_vessel(shipname)
|
7
|
+
connection = Faraday.new(:url => 'http://domai.nr')
|
8
|
+
response = connection.get("/api/json/search?q=#{shipname}")
|
9
|
+
if response.status.to_i == 200
|
10
|
+
pretty_print(Yajl::Parser.new(:symbolize_keys => true).parse(response.body))
|
11
|
+
else
|
12
|
+
puts "Your query resulted in an error".red.bold
|
13
|
+
end
|
14
|
+
end
|
15
|
+
|
16
|
+
def self.pretty_print(body)
|
17
|
+
puts "You searched for '#{body[:query]}'\n".green.bold
|
18
|
+
puts ("Domain".ljust(20) + "Availability".ljust(20) + "Register").blue
|
19
|
+
body[:results].each do |domain|
|
20
|
+
msg = "#{domain[:domain]}".ljust(20) + "#{domain[:availability]}"
|
21
|
+
|
22
|
+
if domain[:availability] == 'taken' || domain[:availability] == 'unavailable'
|
23
|
+
puts msg.yellow
|
24
|
+
else
|
25
|
+
msg += msg.ljust(20) + domain[:register_url]
|
26
|
+
puts msg.green
|
27
|
+
end
|
28
|
+
|
29
|
+
end
|
30
|
+
puts "\n"
|
31
|
+
end
|
32
|
+
end
|
metadata
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: sloop
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.1
|
5
|
+
prerelease:
|
6
|
+
platform: ruby
|
7
|
+
authors:
|
8
|
+
- Robert R Evans
|
9
|
+
autorequire:
|
10
|
+
bindir: bin
|
11
|
+
cert_chain: []
|
12
|
+
date: 2011-07-25 00:00:00.000000000Z
|
13
|
+
dependencies: []
|
14
|
+
description: Name your latest project
|
15
|
+
email: robert@codewranglers.org
|
16
|
+
executables:
|
17
|
+
- sloop
|
18
|
+
extensions: []
|
19
|
+
extra_rdoc_files:
|
20
|
+
- Readme.mkd
|
21
|
+
- LICENSE
|
22
|
+
files:
|
23
|
+
- Readme.mkd
|
24
|
+
- LICENSE
|
25
|
+
- bin/sloop
|
26
|
+
- lib/sloop.rb
|
27
|
+
homepage: http://www.codewranglers.org
|
28
|
+
licenses: []
|
29
|
+
post_install_message:
|
30
|
+
rdoc_options: []
|
31
|
+
require_paths:
|
32
|
+
- lib
|
33
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
34
|
+
none: false
|
35
|
+
requirements:
|
36
|
+
- - ! '>='
|
37
|
+
- !ruby/object:Gem::Version
|
38
|
+
version: '0'
|
39
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
40
|
+
none: false
|
41
|
+
requirements:
|
42
|
+
- - ! '>='
|
43
|
+
- !ruby/object:Gem::Version
|
44
|
+
version: '0'
|
45
|
+
requirements: []
|
46
|
+
rubyforge_project: SLOOP
|
47
|
+
rubygems_version: 1.8.5
|
48
|
+
signing_key:
|
49
|
+
specification_version: 2
|
50
|
+
summary: Name your project
|
51
|
+
test_files: []
|