arbarlow-rubycurl 1.7.0 → 1.7.3
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/rubycurl.rb +10 -10
- data/rubycurl.gemspec +2 -2
- data/version.yml +1 -1
- metadata +4 -3
data/lib/rubycurl.rb
CHANGED
@@ -1,37 +1,37 @@
|
|
1
1
|
class RubyCurl
|
2
|
-
|
2
|
+
|
3
3
|
# Takes url and returns result with .body and follows redirect if any.
|
4
4
|
#
|
5
5
|
# Example RubyCurl.new ('http://apple.com')
|
6
6
|
def initialize(url)
|
7
|
-
@result = %x"curl #{url} -L"
|
7
|
+
@result = %x"curl '#{url}' -L"
|
8
8
|
end
|
9
|
-
|
9
|
+
|
10
10
|
# Takes username, password, url , then returns result and follows redirect if any.
|
11
11
|
#
|
12
12
|
# Example RubyCurl.auth ('username', 'password', "http://twitter.com/statuses/friends_timeline.xml" )
|
13
13
|
def self.auth(username, password, url)
|
14
|
-
@result = %x"curl -u #{username}:#{password} #{url} -L"
|
14
|
+
@result = %x"curl -u #{username}:#{password} '#{url}' -L"
|
15
15
|
end
|
16
|
-
|
16
|
+
|
17
17
|
# Uses HTTP post to post a form using params and returns the html, text or xml and follows redirect if any.
|
18
18
|
#
|
19
19
|
# Example RubyCurl.post({'param1' => 'param1text','param2' => 'param2text'}, 'http://example.com' )
|
20
20
|
def self.post(params, url)
|
21
21
|
curlparam = ""
|
22
22
|
params.each_pair {|key, value| curlparam << "#{key}=#{value}" }
|
23
|
-
@result = %x"curl -d #{curlparam} #{url} -L"
|
23
|
+
@result = %x"curl -d #{curlparam} '#{url}' -L"
|
24
24
|
end
|
25
|
-
|
25
|
+
|
26
26
|
#Uses HTTP post to post a form using params and authentication
|
27
27
|
#
|
28
28
|
# Example RubyCurl.post_with_auth({'username' => 'yourusername', 'password' => 'yourpassword'}, {'param1' => 'param1text','param2' => 'param2text'}, 'http://example.com' )
|
29
29
|
def self.post_with_auth(auth, params, url)
|
30
30
|
curlparam = ""
|
31
31
|
params.each_pair {|key, value| curlparam << "#{key}=#{value}" }
|
32
|
-
@result = %x"curl -u #{auth['username']
|
32
|
+
@result = %x"curl -u #{auth['username']}:#{auth['password']} -d #{curlparam} '#{url}' -L"
|
33
33
|
end
|
34
|
-
|
34
|
+
|
35
35
|
# Returns result of .new in string
|
36
36
|
#
|
37
37
|
# Example @test = RubyCurl.new ('http://apple.com')
|
@@ -39,5 +39,5 @@ class RubyCurl
|
|
39
39
|
def body
|
40
40
|
"#{@result}"
|
41
41
|
end
|
42
|
-
|
42
|
+
|
43
43
|
end
|
data/rubycurl.gemspec
CHANGED
@@ -5,11 +5,11 @@
|
|
5
5
|
|
6
6
|
Gem::Specification.new do |s|
|
7
7
|
s.name = %q{rubycurl}
|
8
|
-
s.version = "1.7.
|
8
|
+
s.version = "1.7.3"
|
9
9
|
|
10
10
|
s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
|
11
11
|
s.authors = ["arbarlow"]
|
12
|
-
s.date = %q{2009-09-
|
12
|
+
s.date = %q{2009-09-17}
|
13
13
|
s.description = %q{Easy use of curl for getting html, xml, etc}
|
14
14
|
s.email = %q{alexbarlowis@me.com}
|
15
15
|
s.extra_rdoc_files = [
|
data/version.yml
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: arbarlow-rubycurl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.7.
|
4
|
+
version: 1.7.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- arbarlow
|
@@ -9,7 +9,7 @@ autorequire:
|
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
11
|
|
12
|
-
date: 2009-09-
|
12
|
+
date: 2009-09-17 00:00:00 -07:00
|
13
13
|
default_executable:
|
14
14
|
dependencies: []
|
15
15
|
|
@@ -35,6 +35,7 @@ files:
|
|
35
35
|
- version.yml
|
36
36
|
has_rdoc: false
|
37
37
|
homepage: http://github.com/arbalrow/rubycurl/
|
38
|
+
licenses:
|
38
39
|
post_install_message:
|
39
40
|
rdoc_options:
|
40
41
|
- --charset=UTF-8
|
@@ -55,7 +56,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
55
56
|
requirements: []
|
56
57
|
|
57
58
|
rubyforge_project:
|
58
|
-
rubygems_version: 1.
|
59
|
+
rubygems_version: 1.3.5
|
59
60
|
signing_key:
|
60
61
|
specification_version: 3
|
61
62
|
summary: Easy use of curl for getting html, xml, etc
|