hobos 0.0.4 → 0.0.6

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: 0c72117b8b61d65636a41eb0ce8e514caf2b8429
4
- data.tar.gz: 2673312800731ada999827354338da323ea3b91e
3
+ metadata.gz: 5f29bddcb4e06fe7a1dce9845922a1351fbce5a5
4
+ data.tar.gz: 12d4b6c91ca247757a387a91de5789537fa503a7
5
5
  SHA512:
6
- metadata.gz: fb5f6ee4a776e5540a4a5c3e019dc2a6b89acd68ecee014d48329a98fbe2c3719cc0d094a2f3d618d6c531bf9b63ffffbd6622b97c1c1ebc5089d30b1a8dc212
7
- data.tar.gz: 3e1f611b9cb7a6e21ef4855db30a2b8c199c74692a03e09dd0cbee35d0a5e6c28036d57890e46b486a8ab95890f84c1a4c3a47e86aca0a9c611218de95d273ba
6
+ metadata.gz: d88e662ebb5ed1ea5775b794efdc574ba620e24fa818695836de739bedbccf6b6187e51275c89306c779da804eca25a42438bae2079a165dc42d56aba0fe7844
7
+ data.tar.gz: 355f66aa5912a00caf2aa5d1a6c25d5c4979906ad746a21536ccc3bf14b200418ef7ddc2545a4c61aeff7fd3715a0db746cd9c9fd16701331fb085918c890a08
data/README.md CHANGED
@@ -9,18 +9,12 @@ Fuck off and read a hobo name.
9
9
  ## Installation:
10
10
 
11
11
  ```BASH
12
- git clone https://www.github.com/rhgraysonii/hobos.git
13
- cd hobos
14
- gem build hobos.gemspec
15
- gem install hobos-0.0.2.gem
16
- cd ..
12
+ gem install hobos -v 0.0.5
17
13
  ```
18
14
 
19
- And now you can simply look them up by id or at random.
15
+ And now...
20
16
 
21
17
  ```bash
22
18
  $ hobos
23
19
  #=> Big-Tipper Silas Fake-Nickel
24
- $ hobos 1
25
- # => 'Stewbuilder Dennis'
26
20
  ```
data/bin/hobos CHANGED
@@ -4,21 +4,8 @@ require 'hobos'
4
4
 
5
5
  $api = Hobos::Api.new
6
6
 
7
-
8
- def try_hobo found_hobo
9
- resp = $api.hobo rand(0..700)
10
- while !found_hobo
11
- if resp != "{ 'error': { 'message': 'bad UID' } }"
12
- found_hobo = true
13
- else
14
- try_hobo(found_hobo)
15
- end
16
- end
17
- puts resp
18
- end
19
-
20
7
  if ARGV[0]
21
8
  puts $api.hobo ARGV[0]
22
9
  else
23
- try_hobo false
10
+ puts $api.hobo
24
11
  end
data/lib/hobos/version.rb CHANGED
@@ -1,3 +1,3 @@
1
1
  module Hobos
2
- VERSION = "0.0.4"
2
+ VERSION = "0.0.6"
3
3
  end
data/lib/hobos.rb CHANGED
@@ -6,15 +6,23 @@ module Hobos
6
6
  @browser = Browser.new.browser
7
7
  end
8
8
 
9
- def hobo uid
10
- begin
11
- clean_name(@browser.get("http://www.e-hobo.com/hoboes/#{uid}").at('span').children.last.to_s)
12
- rescue
13
- "{ 'error': { 'message': 'bad UID' } }"
14
- end
9
+ def hobo
10
+ clean_name(try_hobo(false))
15
11
  end
16
12
 
17
13
  private
14
+ def try_hobo found_hobo
15
+ while !found_hobo
16
+ resp = @browser.get("http://www.e-hobo.com/hoboes/#{rand(1..700)}").at('span').children.last.to_s
17
+ if resp == "{ 'error': { 'message': 'bad UID' } }"
18
+ try_hobo false
19
+ else
20
+ found_hobo = true
21
+ end
22
+ end
23
+ resp
24
+ end
25
+
18
26
  def clean_name hobo_name
19
27
  hobo_name.gsub!(/\d/, '')
20
28
  hobo_name.gsub!('#', '')
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hobos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.4
4
+ version: 0.0.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert H Grayson II
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2015-04-05 00:00:00.000000000 Z
11
+ date: 2015-04-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler