crawlab_ruby_sdk 0.1.1 → 0.1.2
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.
- checksums.yaml +4 -4
- data/lib/client/oss_server_client.rb +7 -0
- data/lib/crawlab_ruby_sdk/version.rb +1 -1
- data/lib/crawlab_ruby_sdk.rb +4 -0
- data/test_grpc_client.rb +33 -9
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 7ab07d443a57759aabbf8fd96fd7f8d50fd8b540dcc3c21762cb775eb43b702d
|
4
|
+
data.tar.gz: c00cbf3d27a1121b83a24eb22cb62d477529d7ab4cb9c331653d9bd77ab50e3d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cef20ce95c9d77c6288f4c8b5a371d7204d0d701a5249626b40ab77ac04c90b90184240de55c4aff8a395d50f462054c0682f8306cec19578a04e3cbdcd77bf
|
7
|
+
data.tar.gz: f60a2a02e8b81258ed58dd32d129688006af5b8cb14666458bf322dd24ec7547d479de496d16e24fc8c80ad477b085b78921abb515ce21c10428374e1f3107d5
|
@@ -50,4 +50,11 @@ class OssServerClient
|
|
50
50
|
bucket_url = bucket.object_url(oss_path)
|
51
51
|
return bucket_url
|
52
52
|
end
|
53
|
+
|
54
|
+
def send_stream(oss_path,stream)
|
55
|
+
bucket.put_object(oss_path){ |a| a << stream }
|
56
|
+
|
57
|
+
bucket_url = bucket.object_url(oss_path)
|
58
|
+
return bucket_url
|
59
|
+
end
|
53
60
|
end
|
data/lib/crawlab_ruby_sdk.rb
CHANGED
data/test_grpc_client.rb
CHANGED
@@ -1,17 +1,41 @@
|
|
1
1
|
|
2
|
+
|
2
3
|
require 'crawlab_ruby_sdk'
|
4
|
+
require 'rest-client'
|
3
5
|
def main
|
4
|
-
CrawlabRubySdk.save_item({name: "haha",age:12})
|
6
|
+
# CrawlabRubySdk.save_item({name: "haha",age:12})
|
7
|
+
|
8
|
+
# CrawlabRubySdk.save_items([{name: "haha",age:12},{name:"456",age:34}])
|
9
|
+
# ENV.each do |k,v|
|
10
|
+
# puts "#{k}=#{v}"
|
11
|
+
# end
|
12
|
+
|
13
|
+
# oss_path = "thinkthank_files/files/1123123123.pdf"
|
14
|
+
# file_path = "/home/min/Downloads/RAND_RRA1218-2.pdf"
|
15
|
+
# bucket_url = CrawlabRubySdk.save_file_to_oss(oss_path,file_path)
|
16
|
+
# puts bucket_url
|
17
|
+
|
18
|
+
# oss_path = "thinkthank_files/files/456.pdf"
|
19
|
+
# res = RestClient.get("https://www.rand.org/content/dam/rand/pubs/research_reports/RRA1200/RRA1218-2/RAND_RRA1218-2.pdf")
|
20
|
+
# stream = res.body
|
21
|
+
|
22
|
+
# file = File.open("/home/min/Downloads/aa.pdf","w")
|
23
|
+
|
24
|
+
# file.write(stream)
|
25
|
+
# file.close
|
26
|
+
# bucket_url = CrawlabRubySdk.save_file_stream_to_oss(oss_path,stream)
|
27
|
+
# puts bucket_url
|
28
|
+
|
29
|
+
|
30
|
+
endpoint = ENV["CRAWLAB_OSS_ENDPOINT"] = ""
|
31
|
+
access_key_id = ENV["CRAWLAB_OSS_ACCESS_KEY"] = ""
|
32
|
+
access_key_secret = ENV["CRAWLAB_OSS_SECRET"] = ""
|
33
|
+
bucket = ENV["CRAWLAB_OSS_BUCKET"] = ""
|
34
|
+
|
35
|
+
a = OssServerClient.new
|
5
36
|
|
6
|
-
|
7
|
-
ENV.each do |k,v|
|
8
|
-
puts "#{k}=#{v}"
|
9
|
-
end
|
37
|
+
a.bucket.get_object("thinkthank_files/files/789.pdf", :file => "/home/min/Downloads/2-2.pdf")
|
10
38
|
|
11
|
-
oss_path = "thinkthank_files/files/1123123123.pdf"
|
12
|
-
file_path = "/home/min/Downloads/RAND_RRA1218-2.pdf"
|
13
|
-
bucket_url = CrawlabRubySdk.save_file_to_oss(oss_path,file_path)
|
14
|
-
puts bucket_url
|
15
39
|
end
|
16
40
|
|
17
41
|
main
|