namesies 0.2.0 → 0.2.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/namesies/domain.rb +1 -1
- data/lib/namesies/reporter.rb +10 -3
- data/lib/namesies/twitter.rb +6 -0
- data/lib/namesies/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 34cb84935c7dfc866a85a00a79dc191843eec0a6
|
4
|
+
data.tar.gz: 5b1264ddd22c8c5a92b6bd12bfe6c31cc406b879
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6b347274ad026c9bd0935e18a765a903f86ee9294c12ac58eeca524041a0677e3c1b44a0a938f40af707b31d95acebfcbdc7514a2f5dacc88ce7cbc004362eed
|
7
|
+
data.tar.gz: cfce4044f6fc0202803c538748a96022a595db2c0de69cefac7a869d1cd69ca5d7bab4b1406a2d93838c6de8e8c0b94fabe7b633687c91e67837b7ab93fd60a6
|
data/lib/namesies/domain.rb
CHANGED
@@ -7,7 +7,7 @@ module Namesies
|
|
7
7
|
def self.search(query)
|
8
8
|
reporter = Namesies::Reporter.new('Domains')
|
9
9
|
|
10
|
-
response = Net::HTTP.get(URI("https://domai.nr/api/json/search?q=#{query}"))
|
10
|
+
response = Net::HTTP.get(URI("https://domai.nr/api/json/search?q=#{URI.escape query}"))
|
11
11
|
results = JSON.parse(response)['results']
|
12
12
|
available = results.map{|d| d if d['availability'] == "available" }.compact
|
13
13
|
|
data/lib/namesies/reporter.rb
CHANGED
@@ -8,9 +8,16 @@ module Namesies
|
|
8
8
|
@title = title
|
9
9
|
end
|
10
10
|
|
11
|
-
def result(result, color)
|
12
|
-
|
13
|
-
|
11
|
+
def result(result, color = nil)
|
12
|
+
out = " #{@title}: "
|
13
|
+
|
14
|
+
if color
|
15
|
+
out += result.send(color)
|
16
|
+
else
|
17
|
+
out += result
|
18
|
+
end
|
19
|
+
|
20
|
+
puts out
|
14
21
|
end
|
15
22
|
|
16
23
|
def recommendation(rec)
|
data/lib/namesies/twitter.rb
CHANGED
@@ -5,6 +5,12 @@ module Namesies
|
|
5
5
|
|
6
6
|
def self.search(query)
|
7
7
|
reporter = Namesies::Reporter.new('Twitter')
|
8
|
+
|
9
|
+
if query.match(/\s/)
|
10
|
+
reporter.result "Can't search Twitter for usernames with spaces"
|
11
|
+
return
|
12
|
+
end
|
13
|
+
|
8
14
|
response = Net::HTTP.get_response(URI("https://twitter.com/#{query}"))
|
9
15
|
|
10
16
|
case response.code
|
data/lib/namesies/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: namesies
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.2.
|
4
|
+
version: 0.2.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Tony Dewan
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2013-
|
11
|
+
date: 2013-09-02 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: thor
|