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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 826656073a36a2206d67bfb25a586353fe037f4d
4
- data.tar.gz: b80644bc3ec0e90fd6b41b2900266137f9aee92e
3
+ metadata.gz: 34cb84935c7dfc866a85a00a79dc191843eec0a6
4
+ data.tar.gz: 5b1264ddd22c8c5a92b6bd12bfe6c31cc406b879
5
5
  SHA512:
6
- metadata.gz: 3de130a1d80a50a2294cf7edd4d48ea77f8672c8c1245326e3ccf4f9908c3298c01b985fdebb7949dc9cf11835dd755d624af91e634a24a3f6391ff66168f0fc
7
- data.tar.gz: bd06115c6bf563d984ef37447670d564d0b1c1a1abe948914af0306f78f1e8a6e40a150ac073ddc0ea7111fe350d76e00a04e51c23f19a39901d2bac4363f245
6
+ metadata.gz: 6b347274ad026c9bd0935e18a765a903f86ee9294c12ac58eeca524041a0677e3c1b44a0a938f40af707b31d95acebfcbdc7514a2f5dacc88ce7cbc004362eed
7
+ data.tar.gz: cfce4044f6fc0202803c538748a96022a595db2c0de69cefac7a869d1cd69ca5d7bab4b1406a2d93838c6de8e8c0b94fabe7b633687c91e67837b7ab93fd60a6
@@ -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
 
@@ -8,9 +8,16 @@ module Namesies
8
8
  @title = title
9
9
  end
10
10
 
11
- def result(result, color)
12
- color ||= 'white'
13
- puts " #{@title}: " + result.send(color)
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)
@@ -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
@@ -1,3 +1,3 @@
1
1
  module Namesies
2
- VERSION = "0.2.0"
2
+ VERSION = "0.2.1"
3
3
  end
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.0
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-08-30 00:00:00.000000000 Z
11
+ date: 2013-09-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor