ujihisa-net-https-wrapper 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 (3) hide show
  1. data/README.md +15 -0
  2. data/net-https-wrapper.rb +21 -0
  3. metadata +55 -0
data/README.md ADDED
@@ -0,0 +1,15 @@
1
+ # net/https wrapper
2
+
3
+ require 'net-https-wrapper'
4
+
5
+ a = Net::HTTP.post(
6
+ 'https://www.google.com/accounts/ClientLogin',
7
+ {
8
+ 'Email' => email,
9
+ 'Passwd' => pass,
10
+ 'service' => 'blogger',
11
+ 'accountType' => 'HOSTED_OR_GOOGLE',
12
+ 'source' => 'ujihisa-bloggervim-1'
13
+ }.map {|i, j| "#{i}=#{j}" }.join('&'),
14
+ {'Content-Type' => 'application/x-www-form-urlencoded'})
15
+ a.body.lines.to_a.maph {|i| i.split('=') }['Auth'].chomp
@@ -0,0 +1,21 @@
1
+ require 'net/https'
2
+
3
+ class Net::HTTP
4
+ def self.post(uri, data, header)
5
+ __post_or_put__(:post, uri, data, header)
6
+ end
7
+
8
+ def self.put(uri, data, header)
9
+ __post_or_put__(:put, uri, data, header)
10
+ end
11
+
12
+ def self.__post_or_put__(method, uri, data, header)
13
+ uri = URI.parse(uri)
14
+ i = new(uri.host, uri.port)
15
+ unless uri.port == 80
16
+ i.use_ssl = true
17
+ i.verify_mode = OpenSSL::SSL::VERIFY_NONE
18
+ end
19
+ i.__send__(method, uri.path, data, header)
20
+ end
21
+ end
metadata ADDED
@@ -0,0 +1,55 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: ujihisa-net-https-wrapper
3
+ version: !ruby/object:Gem::Version
4
+ version: "1.0"
5
+ platform: ruby
6
+ authors:
7
+ - ujihisa
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+
12
+ date: 2009-08-15 00:00:00 -07:00
13
+ default_executable:
14
+ dependencies: []
15
+
16
+ description: For a programmer who thinks net/https of ruby standard library sucks.
17
+ email: ujihisa at gmail.com
18
+ executables: []
19
+
20
+ extensions: []
21
+
22
+ extra_rdoc_files:
23
+ - README.md
24
+ files:
25
+ - net-https-wrapper.rb
26
+ - README.md
27
+ has_rdoc: false
28
+ homepage: https://github.com/ujihisa/net-https-wrapper
29
+ licenses:
30
+ post_install_message:
31
+ rdoc_options: []
32
+
33
+ require_paths:
34
+ - .
35
+ required_ruby_version: !ruby/object:Gem::Requirement
36
+ requirements:
37
+ - - ">="
38
+ - !ruby/object:Gem::Version
39
+ version: "0"
40
+ version:
41
+ required_rubygems_version: !ruby/object:Gem::Requirement
42
+ requirements:
43
+ - - ">="
44
+ - !ruby/object:Gem::Version
45
+ version: "0"
46
+ version:
47
+ requirements: []
48
+
49
+ rubyforge_project:
50
+ rubygems_version: 1.3.5
51
+ signing_key:
52
+ specification_version: 2
53
+ summary: For a programmer who thinks net/https of ruby standard library sucks.
54
+ test_files: []
55
+