umanni-multipart-post 0.0.0.1 → 0.0.0.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -17,4 +17,24 @@ module FileUploadIO
17
17
  EOS
18
18
  file_io
19
19
  end
20
+
21
+ def self.new(file_path, content_type, file_content)
22
+ raise ArgumentError, "File content type required" unless content_type
23
+ File.open(file_path, "w") {|f| f << file_content}
24
+ file_io = File.open(file_path, "rb")
25
+ file_io.instance_eval(<<-EOS, __FILE__, __LINE__)
26
+ def content_type
27
+ "#{content_type}"
28
+ end
29
+
30
+ def file_name
31
+ "#{File.basename(file_path)}"
32
+ end
33
+
34
+ def file_size
35
+ "#{File.size(file_path)}".to_i
36
+ end
37
+ EOS
38
+ file_io
39
+ end
20
40
  end
@@ -1,6 +1,6 @@
1
1
  require 'net/http'
2
- require "parts"
3
- require "stream"
2
+ require "multi_part/parts"
3
+ require "multi_part/stream"
4
4
 
5
5
  module MultiPart
6
6
  class Post
@@ -14,7 +14,7 @@ module MultiPart
14
14
  end
15
15
 
16
16
  def self.pre
17
- 1 #nil
17
+ 2 #nil
18
18
  end
19
19
 
20
20
  def self.to_s
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: umanni-multipart-post
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.0.1
4
+ version: 0.0.0.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: