lmgtfy 0.0.3 → 0.0.4

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -3,6 +3,10 @@ lmgtfy-gem
3
3
 
4
4
  Ruby gem for http://lmgtfy.com/ - command line tool for http://lmgtfy.com/
5
5
 
6
+ ## Features
7
+
8
+ Get original as well as shortened lmgtfy url for your query from command line
9
+
6
10
  ## Status
7
11
 
8
12
  [![Build Status](https://travis-ci.org/prathamesh-sonpatki/lmgtfy-gem.png?branch=master)](https://travis-ci.org/prathamesh-sonpatki/lmgtfy-gem)
data/bin/lmgtfy CHANGED
@@ -3,4 +3,8 @@
3
3
 
4
4
  require 'lmgtfy/runner'
5
5
 
6
- STDOUT.puts Lmgtfy::Runner.new.generate_lmgtfy_url
6
+ lmgt = Lmgtfy::Runner.new.generate_lmgtfy_url
7
+ shrt = Lmgtfy::Runner.new.generate_short_url
8
+
9
+ puts "lmgtfy_url => #{lmgt}"
10
+ puts "short_url => #{shrt}"
@@ -1,9 +1,9 @@
1
+ require 'json'
2
+ require 'net/http'
1
3
  require 'uri'
2
4
 
3
5
  module Lmgtfy
4
-
5
6
  class Runner
6
-
7
7
  attr_reader :query
8
8
 
9
9
  def initialize
@@ -14,6 +14,13 @@ module Lmgtfy
14
14
  "http://lmgtfy.com/?#{@query}"
15
15
  end
16
16
 
17
+ def generate_short_url
18
+ base_url = "http://is.gd/create.php?format=json&url="
19
+ string = "http://lmgtfy.com/?#{@query}"
20
+ response = Net::HTTP.get_response(URI.parse(base_url + string))
21
+ JSON.parse(response.body)["shorturl"]
22
+ end
23
+
17
24
  end
18
25
 
19
26
  end
@@ -1,3 +1,3 @@
1
1
  module Lmgtfy
2
- VERSION = "0.0.3"
2
+ VERSION = "0.0.4"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lmgtfy
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.3
4
+ version: 0.0.4
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-12-29 00:00:00.000000000 Z
12
+ date: 2013-01-01 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: rspec