pastebin 1.0.2 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (6) hide show
  1. data/Gemfile +0 -1
  2. data/Gemfile.lock +0 -2
  3. data/VERSION +1 -1
  4. data/lib/pastebin.rb +5 -7
  5. metadata +11 -27
  6. data/spec/isgd_spec.rb +0 -11
data/Gemfile CHANGED
@@ -5,7 +5,6 @@ source "http://rubygems.org"
5
5
 
6
6
  # Add dependencies to develop your gem here.
7
7
  # Include everything needed to run rake, tests, features, etc.
8
- gem "httpclient"
9
8
 
10
9
  group :development do
11
10
  gem "rspec", "~> 2.1.0"
@@ -3,7 +3,6 @@ GEM
3
3
  specs:
4
4
  diff-lcs (1.1.2)
5
5
  git (1.2.5)
6
- httpclient (2.1.5.2)
7
6
  jeweler (1.5.1)
8
7
  bundler (~> 1.0.0)
9
8
  git (>= 1.2.5)
@@ -24,7 +23,6 @@ PLATFORMS
24
23
 
25
24
  DEPENDENCIES
26
25
  bundler (~> 1.0.0)
27
- httpclient
28
26
  jeweler (~> 1.5.1)
29
27
  rcov
30
28
  rspec (~> 2.1.0)
data/VERSION CHANGED
@@ -1 +1 @@
1
- 1.0.2
1
+ 1.1.0
@@ -2,9 +2,8 @@
2
2
  #
3
3
  # Class to work with http://pastebin.com
4
4
  #
5
-
6
- require 'rubygems'
7
- require 'httpclient'
5
+ require 'net/http'
6
+ require 'uri'
8
7
  require 'rexml/document'
9
8
 
10
9
  class Pastebin
@@ -33,8 +32,8 @@ class Pastebin
33
32
  # puts "You must specify a file or '-' for STDIN"
34
33
  # exit
35
34
  end
36
- clnt = HTTPClient.new
37
- clnt.post("http://pastebin.com/api_public.php", @options).content
35
+ Net::HTTP.post_form(URI.parse('http://pastebin.com/api_public.php'),
36
+ @options).body
38
37
  end
39
38
 
40
39
  # This method takes a link from a previous paste and returns the raw
@@ -43,8 +42,7 @@ class Pastebin
43
42
  # pbin.get_raw("http://pastebin.com/xxxxxxx") #=> "some text"
44
43
  #
45
44
  def get_raw(link)
46
- clnt = HTTPClient.new(:agent_name => 'ruby pastebin gem')
47
- paste = clnt.get_content("http://pastebin.com/raw.php?i=#{link[/[\w\d]+$/]}")
45
+ paste = Net::HTTP.get_response(URI.parse("http://pastebin.com/raw.php?i=#{link[/[\w\d]+$/]}")).body
48
46
  doc = Document.new(paste)
49
47
  doc.elements.to_a("//pre")[0].text
50
48
  end
metadata CHANGED
@@ -5,9 +5,9 @@ version: !ruby/object:Gem::Version
5
5
  prerelease: false
6
6
  segments:
7
7
  - 1
8
+ - 1
8
9
  - 0
9
- - 2
10
- version: 1.0.2
10
+ version: 1.1.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - dougsko
@@ -15,27 +15,13 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-01-31 00:00:00 -05:00
18
+ date: 2011-02-17 00:00:00 -05:00
19
19
  default_executable: pastebin
20
20
  dependencies:
21
- - !ruby/object:Gem::Dependency
22
- name: httpclient
23
- prerelease: false
24
- requirement: &id001 !ruby/object:Gem::Requirement
25
- none: false
26
- requirements:
27
- - - ">="
28
- - !ruby/object:Gem::Version
29
- hash: 3
30
- segments:
31
- - 0
32
- version: "0"
33
- type: :runtime
34
- version_requirements: *id001
35
21
  - !ruby/object:Gem::Dependency
36
22
  name: rspec
37
23
  prerelease: false
38
- requirement: &id002 !ruby/object:Gem::Requirement
24
+ requirement: &id001 !ruby/object:Gem::Requirement
39
25
  none: false
40
26
  requirements:
41
27
  - - ~>
@@ -47,11 +33,11 @@ dependencies:
47
33
  - 0
48
34
  version: 2.1.0
49
35
  type: :development
50
- version_requirements: *id002
36
+ version_requirements: *id001
51
37
  - !ruby/object:Gem::Dependency
52
38
  name: bundler
53
39
  prerelease: false
54
- requirement: &id003 !ruby/object:Gem::Requirement
40
+ requirement: &id002 !ruby/object:Gem::Requirement
55
41
  none: false
56
42
  requirements:
57
43
  - - ~>
@@ -63,11 +49,11 @@ dependencies:
63
49
  - 0
64
50
  version: 1.0.0
65
51
  type: :development
66
- version_requirements: *id003
52
+ version_requirements: *id002
67
53
  - !ruby/object:Gem::Dependency
68
54
  name: jeweler
69
55
  prerelease: false
70
- requirement: &id004 !ruby/object:Gem::Requirement
56
+ requirement: &id003 !ruby/object:Gem::Requirement
71
57
  none: false
72
58
  requirements:
73
59
  - - ~>
@@ -79,11 +65,11 @@ dependencies:
79
65
  - 1
80
66
  version: 1.5.1
81
67
  type: :development
82
- version_requirements: *id004
68
+ version_requirements: *id003
83
69
  - !ruby/object:Gem::Dependency
84
70
  name: rcov
85
71
  prerelease: false
86
- requirement: &id005 !ruby/object:Gem::Requirement
72
+ requirement: &id004 !ruby/object:Gem::Requirement
87
73
  none: false
88
74
  requirements:
89
75
  - - ">="
@@ -93,7 +79,7 @@ dependencies:
93
79
  - 0
94
80
  version: "0"
95
81
  type: :development
96
- version_requirements: *id005
82
+ version_requirements: *id004
97
83
  description: CLI tool and library to work with pastebin.com
98
84
  email: dougtko@gmail.com
99
85
  executables:
@@ -113,7 +99,6 @@ files:
113
99
  - VERSION
114
100
  - bin/pastebin
115
101
  - lib/pastebin.rb
116
- - spec/isgd_spec.rb
117
102
  - spec/pastebin_spec.rb
118
103
  - spec/spec_helper.rb
119
104
  has_rdoc: true
@@ -151,6 +136,5 @@ signing_key:
151
136
  specification_version: 3
152
137
  summary: CLI tool and library to work with pastebin.com
153
138
  test_files:
154
- - spec/isgd_spec.rb
155
139
  - spec/pastebin_spec.rb
156
140
  - spec/spec_helper.rb
@@ -1,11 +0,0 @@
1
- require File.expand_path(File.dirname(__FILE__) + '/spec_helper')
2
-
3
- describe "Shortlink" do
4
- it "creates a Shortlink object" do
5
- Shortlink.new.class.to_s.should == "Shortlink"
6
- end
7
-
8
- it "Shorten a link" do
9
- Shortlink.new.isgd("http://google.com").should match(/http:.*\/[\d|\w]+/)
10
- end
11
- end