trak3r-ereiamjh 0.1.0

Sign up to get free protection for your applications and to get access to all the features.
data/LICENSE ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2008 Teflon Ted
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README ADDED
@@ -0,0 +1,13 @@
1
+ ereiamjh========
2
+
3
+ Ruby library and command-line tool to announce your geographic location to Twitter.
4
+
5
+ From the command line:
6
+
7
+ > ereiamjh twitter_login twitter_password
8
+
9
+
10
+ COPYRIGHT
11
+ =========
12
+
13
+ Copyright (c) 2008 Thomas 'Ted' Davis. See LICENSE for details.
@@ -0,0 +1,51 @@
1
+ require 'rake'
2
+
3
+ begin
4
+ require 'jeweler'
5
+ Jeweler::Tasks.new do |s|
6
+ s.name = "ereiamjh"
7
+ s.summary = %Q{Ruby library and command-line tool to announce your geographic location to Twitter.}
8
+ s.email = "github@rudiment.net"
9
+ s.homepage = "http://github.com/trak3r/ereiamjh"
10
+ s.description = "Ruby library and command-line tool to announce your geographic location to Twitter."
11
+ s.authors = ["Thomas 'Ted' Davis"]
12
+ end
13
+ rescue LoadError
14
+ puts "Jeweler not available. Install it with: sudo gem install technicalpickles-jeweler -s http://gems.github.com"
15
+ end
16
+
17
+ require 'rake/rdoctask'
18
+ Rake::RDocTask.new do |rdoc|
19
+ rdoc.rdoc_dir = 'rdoc'
20
+ rdoc.title = 'ereiamjh'
21
+ rdoc.options << '--line-numbers' << '--inline-source'
22
+ rdoc.rdoc_files.include('README*')
23
+ rdoc.rdoc_files.include('lib/**/*.rb')
24
+ end
25
+
26
+ require 'rake/testtask'
27
+ Rake::TestTask.new(:test) do |t|
28
+ t.libs << 'lib' << 'test'
29
+ t.pattern = 'test/**/*_test.rb'
30
+ t.verbose = false
31
+ end
32
+
33
+ begin
34
+ require 'rcov/rcovtask'
35
+ Rcov::RcovTask.new do |t|
36
+ t.libs << 'test'
37
+ t.test_files = FileList['test/**/*_test.rb']
38
+ t.verbose = true
39
+ end
40
+ rescue LoadError
41
+ puts "RCov is not available. In order to run rcov, you must: sudo gem install spicycode-rcov"
42
+ end
43
+
44
+ begin
45
+ require 'cucumber/rake/task'
46
+ Cucumber::Rake::Task.new(:features)
47
+ rescue LoadError
48
+ puts "Cucumber is not available. In order to run features, you must: sudo gem install cucumber"
49
+ end
50
+
51
+ task :default => :test
@@ -0,0 +1,4 @@
1
+ ---
2
+ :patch: 0
3
+ :major: 0
4
+ :minor: 1
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env ruby
2
+ require 'lib/ereiamjh'
3
+ EreIAmJH.new(ARGV[0], ARGV[1]).announce
@@ -0,0 +1,57 @@
1
+ require 'rubygems'
2
+ require 'httparty'
3
+ require 'twitter'
4
+
5
+ class EreIAmJH
6
+ include HTTParty
7
+ base_uri 'ip-address.domaintools.com'
8
+
9
+ def initialize(username, password)
10
+ @username = username
11
+ @password = password
12
+ end
13
+
14
+ # {"dnstools"=>{
15
+ # "city"=>"Ft. Lauderdale",
16
+ # "connection"=>"close",
17
+ # "accepted_types"=>nil,
18
+ # "accepted_encodings"=>nil,
19
+ # "protocol"=>"HTTP/1.1",
20
+ # "region"=>"Florida",
21
+ # "language"=>nil,
22
+ # "accepted_charsets"=>nil,
23
+ # "date"=>"Thu, 12 Feb 2009 20:39:56 GMT",
24
+ # "proxy_isp"=>nil,
25
+ # "unix_time"=>"1234471196",
26
+ # "country"=>"United States(US)",
27
+ # "proxy_type"=>"None / Highly Anonymous",
28
+ # "service_provider"=>"Domain Tools",
29
+ # "provider_url"=>"http://www.domaintools.com/",
30
+ # "proxy_region"=>nil,
31
+ # "isp"=>"Comcast Cable Communications Inc",
32
+ # "proxy_country_flag"=>nil,
33
+ # "user_agent"=>nil,
34
+ # "referer"=>nil,
35
+ # "hostname"=>"c-76-111-239-225.hsd1.fl.comcast.net",
36
+ # "remote_port"=>"55330",
37
+ # "keep_alive"=>nil,
38
+ # "blacklist_status"=>"Clear",
39
+ # "proxy_country"=>nil,
40
+ # "ip_address"=>"76.111.239.225",
41
+ # "country_flag"=>"http://img.domaintools.com/flags/us.gif",
42
+ # "proxy_city"=>nil}}
43
+
44
+ def announce
45
+ response = self.class.get('/myip.xml')
46
+ dnstools = response['dnstools']
47
+ city = dnstools['city']
48
+ state = dnstools['region']
49
+ isp = dnstools['isp']
50
+ ip = dnstools['ip_address']
51
+ location = "#{city}, #{state}"
52
+ msg = "Hello from #{location}! I'm on #{isp} as #{ip}"
53
+ twitter = Twitter::Base.new(Twitter::HTTPAuth.new(@username, @password))
54
+ twitter.update(msg)
55
+ twitter.update_profile(:location => location)
56
+ end
57
+ end
@@ -0,0 +1,7 @@
1
+ require File.dirname(__FILE__) + '/test_helper'
2
+
3
+ class EreiamjhTest < Test::Unit::TestCase
4
+ should "probably rename this file and start testing for real" do
5
+ flunk "hey buddy, you should probably rename this file and start testing for real"
6
+ end
7
+ end
@@ -0,0 +1,10 @@
1
+ require 'rubygems'
2
+ require 'test/unit'
3
+ require 'shoulda'
4
+ require 'mocha'
5
+
6
+ $LOAD_PATH.unshift(File.dirname(__FILE__))
7
+ require 'ereiamjh'
8
+
9
+ class Test::Unit::TestCase
10
+ end
metadata ADDED
@@ -0,0 +1,62 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: trak3r-ereiamjh
3
+ version: !ruby/object:Gem::Version
4
+ version: 0.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Thomas 'Ted' Davis
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-04-25 00:00:00 -07:00
13
+ default_executable: ereiamjh
14
+ dependencies: []
15
+
16
+ description: Ruby library and command-line tool to announce your geographic location to Twitter.
17
+ email: github@rudiment.net
18
+ executables:
19
+ - ereiamjh
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - LICENSE
24
+ - README
25
+ files:
26
+ - LICENSE
27
+ - Rakefile
28
+ - VERSION.yml
29
+ - bin/ereiamjh
30
+ - lib/ereiamjh.rb
31
+ - test/ereiamjh_test.rb
32
+ - test/test_helper.rb
33
+ - README
34
+ has_rdoc: true
35
+ homepage: http://github.com/trak3r/ereiamjh
36
+ post_install_message:
37
+ rdoc_options:
38
+ - --charset=UTF-8
39
+ require_paths:
40
+ - lib
41
+ required_ruby_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: "0"
46
+ version:
47
+ required_rubygems_version: !ruby/object:Gem::Requirement
48
+ requirements:
49
+ - - ">="
50
+ - !ruby/object:Gem::Version
51
+ version: "0"
52
+ version:
53
+ requirements: []
54
+
55
+ rubyforge_project:
56
+ rubygems_version: 1.2.0
57
+ signing_key:
58
+ specification_version: 2
59
+ summary: Ruby library and command-line tool to announce your geographic location to Twitter.
60
+ test_files:
61
+ - test/ereiamjh_test.rb
62
+ - test/test_helper.rb