sharefile_connect 0.1.1 → 0.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/sharefile_connect/data.rb +13 -6
- data/lib/sharefile_connect/version.rb +1 -1
- metadata +4 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 2525f795b89b4786db578dc2f9d683a71294dc32
|
4
|
+
data.tar.gz: a7f28ebc7f513c3da51a5c270dfd9ecf99330bac
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 83470fe81aaab07117daa49d58417c40673678b6dcbb5e579c2721f2738eeef997cc37322d84a9c8e0648f106394aed3649f6f1c9301a96bdffd21c17cefecaa
|
7
|
+
data.tar.gz: cc3699bbc5a94c1f76c5b930ef0b07b241891e9ec4c2fbe566ef0c84048994312d68a7fb3b50bfca517722a666cd6b8d242d28c7433fd90806dfcf805bb2a37a
|
data/CHANGELOG.md
ADDED
@@ -49,11 +49,11 @@ module SharefileConnect
|
|
49
49
|
JSON.parse(r.body)['Id'] if r.kind_of?(Net::HTTPOK)
|
50
50
|
end
|
51
51
|
|
52
|
-
def
|
52
|
+
def upload_file_from_path(folder_id, file_path)
|
53
53
|
path = "/Items(#{folder_id})/Upload"
|
54
|
-
response =
|
54
|
+
response = get(path)
|
55
55
|
upload_config = JSON.parse response.body
|
56
|
-
multipart_form_post upload_config['ChunkUri'], file_path
|
56
|
+
multipart_form_post upload_config['ChunkUri'], File.read(file_path), File.basename(file_path)
|
57
57
|
# HTTMultiParty.post(upload_config["ChunkUri"], body: { file1: File.new(file_path) } )
|
58
58
|
# File.open(file_path) do |transfile|
|
59
59
|
# # HTTMultiParty.post(upload_config["ChunkUri"], query: { file1: File.read(transfile) })
|
@@ -62,6 +62,13 @@ module SharefileConnect
|
|
62
62
|
# end
|
63
63
|
end
|
64
64
|
|
65
|
+
def upload_file(folder_id, file, file_name)
|
66
|
+
path = "/Items(#{folder_id})/Upload"
|
67
|
+
response = get(path)
|
68
|
+
upload_config = JSON.parse response.body
|
69
|
+
multipart_form_post upload_config['ChunkUri'], file, file_name
|
70
|
+
end
|
71
|
+
|
65
72
|
def zones
|
66
73
|
get("/Zones")
|
67
74
|
end
|
@@ -72,9 +79,9 @@ module SharefileConnect
|
|
72
79
|
|
73
80
|
private
|
74
81
|
|
75
|
-
def multipart_form_post
|
82
|
+
def multipart_form_post(url, file, file_name)
|
76
83
|
newline = "\r\n"
|
77
|
-
filename =
|
84
|
+
filename = file_name
|
78
85
|
boundary = "----------#{Time.now.nsec}"
|
79
86
|
|
80
87
|
uri = URI.parse(url)
|
@@ -84,7 +91,7 @@ module SharefileConnect
|
|
84
91
|
post_body << "Content-Disposition: form-data; name=\"File1\"; filename=\"#{filename}\"#{newline}"
|
85
92
|
post_body << "Content-Type: application/octet-stream#{newline}"
|
86
93
|
post_body << "#{newline}"
|
87
|
-
post_body <<
|
94
|
+
post_body << file
|
88
95
|
post_body << "#{newline}--#{boundary}--#{newline}"
|
89
96
|
|
90
97
|
request = Net::HTTP::Post.new(uri.request_uri)
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sharefile_connect
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- tubedude
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-
|
11
|
+
date: 2015-11-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: httparty
|
@@ -97,6 +97,7 @@ files:
|
|
97
97
|
- ".idea/workspace.xml"
|
98
98
|
- ".rspec"
|
99
99
|
- ".travis.yml"
|
100
|
+
- CHANGELOG.md
|
100
101
|
- Gemfile
|
101
102
|
- LICENSE.txt
|
102
103
|
- README.md
|
@@ -129,7 +130,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
129
130
|
version: '0'
|
130
131
|
requirements: []
|
131
132
|
rubyforge_project:
|
132
|
-
rubygems_version: 2.4.
|
133
|
+
rubygems_version: 2.4.5.1
|
133
134
|
signing_key:
|
134
135
|
specification_version: 4
|
135
136
|
summary: Another Sharefile Ruby Wrapper
|