ruby-multipart-post 0.3.0 → 0.4.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.
data/CHANGELOG ADDED
@@ -0,0 +1,6 @@
1
+ v0.4.0
2
+ - Added support for ssl
3
+ - conditional query string
4
+
5
+ v0.3.0
6
+ - better tests
data/Manifest CHANGED
@@ -1,4 +1,4 @@
1
- Manifest
1
+ CHANGELOG
2
2
  README
3
3
  README.rdoc
4
4
  Rakefile
@@ -7,7 +7,7 @@ lib/multi_part_post.rb
7
7
  lib/parts.rb
8
8
  lib/ruby-multipart-post.rb
9
9
  lib/stream.rb
10
- ruby-multipart-post.gemspec
11
10
  test/file_upload_io_test.rb
12
11
  test/files/file_0.txt
13
12
  test/parts_test.rb
13
+ Manifest
data/Rakefile CHANGED
@@ -2,7 +2,7 @@ require 'rubygems'
2
2
  require 'rake'
3
3
  require 'echoe'
4
4
 
5
- Echoe.new('ruby-multipart-post', '0.3.0') do |p|
5
+ Echoe.new('ruby-multipart-post', '0.4.0') do |p|
6
6
  p.description = "Multipart form post thru Ruby script, headers content-type and content-length properly set"
7
7
  p.url = "http://github.com/toamitkumar/ruby-multipart-post"
8
8
  p.author = "Amit Kumar"
@@ -33,13 +33,15 @@ module MultiPart
33
33
  def submit(to_url, query_string=nil)
34
34
  post_stream = Stream::MultiPart.new(@parts)
35
35
  url = URI.parse( to_url )
36
- post_url_with_query_string = "#{url.path}?#{query_string}"
36
+ post_url_with_query_string = "#{url.path}"
37
+ post_url_with_query_string = "#{post_url_with_query_string}?#{query_string}" unless(query_string.nil?)
37
38
  req = Net::HTTP::Post.new(post_url_with_query_string, @request_headers)
38
39
  req.content_length = post_stream.size
39
40
  req.content_type = 'multipart/form-data; boundary=' + multi_part_boundary
40
41
  req.body_stream = post_stream
41
- req.use_ssl = true if url.scheme == "https"
42
- res = Net::HTTP.new(url.host, url.port).start {|http| http.request(req) }
42
+ http_handle = Net::HTTP.new(url.host, url.port)
43
+ http_handle.use_ssl = true if(url.scheme == "https")
44
+ res = http_handle.start {|http| http.request(req)}
43
45
 
44
46
  #close all the open hooks to the file on file-system
45
47
  @streams.each do |local_stream|
@@ -2,28 +2,27 @@
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = %q{ruby-multipart-post}
5
- s.version = "0.3.0"
5
+ s.version = "0.4.0"
6
6
 
7
7
  s.required_rubygems_version = Gem::Requirement.new(">= 1.2") if s.respond_to? :required_rubygems_version=
8
8
  s.authors = ["Amit Kumar"]
9
- s.date = %q{2010-05-02}
9
+ s.date = %q{2011-03-23}
10
10
  s.description = %q{Multipart form post thru Ruby script, headers content-type and content-length properly set}
11
11
  s.email = %q{toamitkumar@gmail.com}
12
- s.extra_rdoc_files = ["README", "README.rdoc", "lib/file_upload_io.rb", "lib/multi_part_post.rb", "lib/parts.rb", "lib/ruby-multipart-post.rb", "lib/stream.rb"]
13
- s.files = ["Manifest", "README", "README.rdoc", "Rakefile", "lib/file_upload_io.rb", "lib/multi_part_post.rb", "lib/parts.rb", "lib/ruby-multipart-post.rb", "lib/stream.rb", "ruby-multipart-post.gemspec", "test/file_upload_io_test.rb", "test/files/file_0.txt", "test/parts_test.rb"]
12
+ s.extra_rdoc_files = ["CHANGELOG", "README", "README.rdoc", "lib/file_upload_io.rb", "lib/multi_part_post.rb", "lib/parts.rb", "lib/ruby-multipart-post.rb", "lib/stream.rb"]
13
+ s.files = ["CHANGELOG", "README", "README.rdoc", "Rakefile", "lib/file_upload_io.rb", "lib/multi_part_post.rb", "lib/parts.rb", "lib/ruby-multipart-post.rb", "lib/stream.rb", "test/file_upload_io_test.rb", "test/files/file_0.txt", "test/parts_test.rb", "Manifest", "ruby-multipart-post.gemspec"]
14
14
  s.homepage = %q{http://github.com/toamitkumar/ruby-multipart-post}
15
- s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Ruby-multipart-post", "--main", "README.rdoc"]
15
+ s.rdoc_options = ["--line-numbers", "--inline-source", "--title", "Ruby-multipart-post", "--main", "README"]
16
16
  s.require_paths = ["lib"]
17
17
  s.rubyforge_project = %q{ruby-multipart-post}
18
- s.rubygems_version = %q{1.3.5}
18
+ s.rubygems_version = %q{1.6.2}
19
19
  s.summary = %q{Multipart form post thru Ruby script, headers content-type and content-length properly set}
20
20
  s.test_files = ["test/file_upload_io_test.rb", "test/parts_test.rb"]
21
21
 
22
22
  if s.respond_to? :specification_version then
23
- current_version = Gem::Specification::CURRENT_SPECIFICATION_VERSION
24
23
  s.specification_version = 3
25
24
 
26
- if Gem::Version.new(Gem::RubyGemsVersion) >= Gem::Version.new('1.2.0') then
25
+ if Gem::Version.new(Gem::VERSION) >= Gem::Version.new('1.2.0') then
27
26
  else
28
27
  end
29
28
  else
data/test/parts_test.rb CHANGED
@@ -24,6 +24,6 @@ class PartsTest < Test::Unit::TestCase
24
24
  end
25
25
 
26
26
  def test_should_read_file_part
27
- assert_equal("Text\nhere\n", @file_part.read(5, 10))
27
+ assert_equal("Text\r\nhere", @file_part.read(5, 10))
28
28
  end
29
29
  end
metadata CHANGED
@@ -1,7 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ruby-multipart-post
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.0
4
+ hash: 15
5
+ prerelease:
6
+ segments:
7
+ - 0
8
+ - 4
9
+ - 0
10
+ version: 0.4.0
5
11
  platform: ruby
6
12
  authors:
7
13
  - Amit Kumar
@@ -9,7 +15,7 @@ autorequire:
9
15
  bindir: bin
10
16
  cert_chain: []
11
17
 
12
- date: 2010-05-02 00:00:00 -03:00
18
+ date: 2011-03-23 00:00:00 -04:00
13
19
  default_executable:
14
20
  dependencies: []
15
21
 
@@ -20,6 +26,7 @@ executables: []
20
26
  extensions: []
21
27
 
22
28
  extra_rdoc_files:
29
+ - CHANGELOG
23
30
  - README
24
31
  - README.rdoc
25
32
  - lib/file_upload_io.rb
@@ -28,7 +35,7 @@ extra_rdoc_files:
28
35
  - lib/ruby-multipart-post.rb
29
36
  - lib/stream.rb
30
37
  files:
31
- - Manifest
38
+ - CHANGELOG
32
39
  - README
33
40
  - README.rdoc
34
41
  - Rakefile
@@ -37,10 +44,11 @@ files:
37
44
  - lib/parts.rb
38
45
  - lib/ruby-multipart-post.rb
39
46
  - lib/stream.rb
40
- - ruby-multipart-post.gemspec
41
47
  - test/file_upload_io_test.rb
42
48
  - test/files/file_0.txt
43
49
  - test/parts_test.rb
50
+ - Manifest
51
+ - ruby-multipart-post.gemspec
44
52
  has_rdoc: true
45
53
  homepage: http://github.com/toamitkumar/ruby-multipart-post
46
54
  licenses: []
@@ -52,25 +60,32 @@ rdoc_options:
52
60
  - --title
53
61
  - Ruby-multipart-post
54
62
  - --main
55
- - README.rdoc
63
+ - README
56
64
  require_paths:
57
65
  - lib
58
66
  required_ruby_version: !ruby/object:Gem::Requirement
67
+ none: false
59
68
  requirements:
60
69
  - - ">="
61
70
  - !ruby/object:Gem::Version
71
+ hash: 3
72
+ segments:
73
+ - 0
62
74
  version: "0"
63
- version:
64
75
  required_rubygems_version: !ruby/object:Gem::Requirement
76
+ none: false
65
77
  requirements:
66
78
  - - ">="
67
79
  - !ruby/object:Gem::Version
80
+ hash: 11
81
+ segments:
82
+ - 1
83
+ - 2
68
84
  version: "1.2"
69
- version:
70
85
  requirements: []
71
86
 
72
87
  rubyforge_project: ruby-multipart-post
73
- rubygems_version: 1.3.5
88
+ rubygems_version: 1.6.2
74
89
  signing_key:
75
90
  specification_version: 3
76
91
  summary: Multipart form post thru Ruby script, headers content-type and content-length properly set