usd 1.3.3 → 1.3.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +0 -2
- data/bin/rusdc +3 -23
- data/change_log.md +5 -1
- data/images/vcard.png +0 -0
- data/lib/usd.rb +20 -0
- data/usd.gemspec +1 -1
- metadata +2 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f324bd2fb86597239321dad232f442527502773a66fda4cf5096e9ebec7d30b1
|
4
|
+
data.tar.gz: 8376aa51f4e5ec5be644c452d93bb7b975c02368121cb7be2c80baa2ae14dac9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 03c0822a8e18840e2beda5b720fd9bb81fb64c8bf3bd17f6ee10db9af77c9bb97157fa5faad5ff31c7cd3976c64bf0f3d98994b6878e9527b6b986cebc3ff67a
|
7
|
+
data.tar.gz: bb0df905af199fa12e3abaa0e83debde076e9bc40a204dd75dd5c07d930f592ce2b4c34cf510dc4402592dc770ed898560ce628f34280a996e1b82a4b24ad4ca
|
data/README.md
CHANGED
@@ -40,8 +40,6 @@ If you use the `rusdc find` command with `--format mlr` option then you need `ml
|
|
40
40
|
|
41
41
|
Place the `mlr`-binary in a path, which is in your PATH-Environment. Download-Url for mlr-releases: [https://github.com/johnkerl/miller/releases](https://github.com/johnkerl/miller/releases).
|
42
42
|
|
43
|
-
For uloading attachments `unix2dos` and `base64` is used.
|
44
|
-
|
45
43
|
# functions from the commandline-tool `rusdc`
|
46
44
|
|
47
45
|
```
|
data/bin/rusdc
CHANGED
@@ -9,7 +9,7 @@ class Rusdc < Thor
|
|
9
9
|
|
10
10
|
desc "chg_add_attachment <co> <file>", "attach the file to co"
|
11
11
|
def chg_add_attachment(co, file)
|
12
|
-
response = upload_attachment(file
|
12
|
+
response = loadcon.upload_attachment(file)
|
13
13
|
puts response
|
14
14
|
data = JSON.parse(response)
|
15
15
|
template = ERB.new <<-EOF
|
@@ -242,7 +242,7 @@ class Rusdc < Thor
|
|
242
242
|
#lrel_attachments_requests",{'fields' => "attmnt","wc" => "cr.ref_num
|
243
243
|
desc "in_add_attachment <in> <file>", "attach the file to incident"
|
244
244
|
def in_add_attachment(incident, file)
|
245
|
-
response = upload_attachment(file
|
245
|
+
response = loadcon.upload_attachment(file)
|
246
246
|
puts response
|
247
247
|
data = JSON.parse(response)
|
248
248
|
template = ERB.new <<-EOF
|
@@ -302,7 +302,7 @@ class Rusdc < Thor
|
|
302
302
|
|
303
303
|
desc "nr_add_attachment <nr> <file>", "attach the file to nr"
|
304
304
|
def nr_add_attachment(nr, file)
|
305
|
-
response = upload_attachment(file
|
305
|
+
response = loadcon.upload_attachment(file)
|
306
306
|
puts response
|
307
307
|
data = JSON.parse(response)
|
308
308
|
nr_id = loadcon.search("nr",{'fields' => "@id","wc" => "name = '#{nr}'"})[0]["@id"]
|
@@ -569,26 +569,6 @@ END:VCARD
|
|
569
569
|
end
|
570
570
|
end
|
571
571
|
|
572
|
-
def upload_attachment(file, baseurl, ak)
|
573
|
-
baseurl =~ /^([^:]+):/
|
574
|
-
server = $1
|
575
|
-
filename = File.basename(file)
|
576
|
-
uri = "/caisd-rest/attmnt?repositoryId=1002&serverName=#{server}&mimeType=Text&description=#{filename}"
|
577
|
-
url = URI("#{baseurl}#{uri}")
|
578
|
-
http = Net::HTTP.new(url.host, url.port);
|
579
|
-
request = Net::HTTP::Post.new(url)
|
580
|
-
request["X-AccessKey"] = ak
|
581
|
-
request["Content-Type"] = "multipart/form-data; BOUNDARY=*****MessageBoundary*****"
|
582
|
-
request["accept"] = "application/json"
|
583
|
-
request["Cache-Control"] = "no-cache"
|
584
|
-
fileObj = File.open(file, "rb")
|
585
|
-
fileContent = fileObj.read
|
586
|
-
fileObj.close
|
587
|
-
request.body = "--*****MessageBoundary*****\r\n \r\nContent-Disposition: form-data; name=\"payload\" \r\nContent-Type: application/xml; CHARACTERSET=UTF-8 \r\n\r\n \r\n<attmnt> \r\n<repository id=\"1002\"></repository> \r\n<orig_file_name>#{filename}</orig_file_name> \r\n<attmnt_name>#{filename}</attmnt_name> \r\n<description>Uploaded with rusdc from rubygem usd</description> \r\n</attmnt> \r\n\r\n \r\n--*****MessageBoundary*****\r\n \r\nContent-Disposition: form-data; name=\"#{filename}\"; filename=\"#{filename}\" \r\nContent-Type: application/octet-stream \r\nContent-Transfer-Encoding: base64\r\n\r\n#{Base64.encode64(fileContent)}\r\n\r\n \r\n--*****MessageBoundary*****--\r\n"
|
588
|
-
response = http.request(request)
|
589
|
-
response.read_body
|
590
|
-
end
|
591
|
-
|
592
572
|
end
|
593
573
|
|
594
574
|
Rusdc.start(ARGV)
|
data/change_log.md
CHANGED
@@ -1,8 +1,12 @@
|
|
1
1
|
# rusdc changelog
|
2
2
|
|
3
|
+
## 1.3.4
|
4
|
+
|
5
|
+
- move function `upload_attachment` from `bin/rusdc` to `lib/usd`.
|
6
|
+
|
3
7
|
## 1.3.3
|
4
8
|
|
5
|
-
- private `
|
9
|
+
- private `rusdc`-funktion `upload_attachment` changed. Instead using `base64` and `unix2dos` binaries, we use Base64-Ruby-Class now. It is already required by usd.
|
6
10
|
|
7
11
|
## 1.3.2
|
8
12
|
|
data/images/vcard.png
ADDED
Binary file
|
data/lib/usd.rb
CHANGED
@@ -279,6 +279,26 @@ class Usd
|
|
279
279
|
end
|
280
280
|
end
|
281
281
|
|
282
|
+
def upload_attachment(file, baseurl = @base_url, ak = @access_key)
|
283
|
+
baseurl =~ /^([^:]+):/
|
284
|
+
server = $1
|
285
|
+
filename = File.basename(file)
|
286
|
+
uri = "/caisd-rest/attmnt?repositoryId=1002&serverName=#{server}&mimeType=Text&description=#{filename}"
|
287
|
+
url = URI("#{baseurl}#{uri}")
|
288
|
+
http = Net::HTTP.new(url.host, url.port);
|
289
|
+
request = Net::HTTP::Post.new(url)
|
290
|
+
request["X-AccessKey"] = ak
|
291
|
+
request["Content-Type"] = "multipart/form-data; BOUNDARY=*****MessageBoundary*****"
|
292
|
+
request["accept"] = "application/json"
|
293
|
+
request["Cache-Control"] = "no-cache"
|
294
|
+
fileObj = File.open(file, "rb")
|
295
|
+
fileContent = fileObj.read
|
296
|
+
fileObj.close
|
297
|
+
request.body = "--*****MessageBoundary*****\r\n \r\nContent-Disposition: form-data; name=\"payload\" \r\nContent-Type: application/xml; CHARACTERSET=UTF-8 \r\n\r\n \r\n<attmnt> \r\n<repository id=\"1002\"></repository> \r\n<orig_file_name>#{filename}</orig_file_name> \r\n<attmnt_name>#{filename}</attmnt_name> \r\n<description>Uploaded with rusdc from rubygem usd</description> \r\n</attmnt> \r\n\r\n \r\n--*****MessageBoundary*****\r\n \r\nContent-Disposition: form-data; name=\"#{filename}\"; filename=\"#{filename}\" \r\nContent-Type: application/octet-stream \r\nContent-Transfer-Encoding: base64\r\n\r\n#{Base64.encode64(fileContent)}\r\n\r\n \r\n--*****MessageBoundary*****--\r\n"
|
298
|
+
response = http.request(request)
|
299
|
+
response.read_body
|
300
|
+
end
|
301
|
+
|
282
302
|
end
|
283
303
|
|
284
304
|
module Jsonpretty
|
data/usd.gemspec
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: usd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.3.
|
4
|
+
version: 1.3.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Oliver Gaida
|
@@ -82,6 +82,7 @@ files:
|
|
82
82
|
- bin/rusdc
|
83
83
|
- bin/set_env
|
84
84
|
- change_log.md
|
85
|
+
- images/vcard.png
|
85
86
|
- lib/usd.rb
|
86
87
|
- usd.gemspec
|
87
88
|
homepage: https://github.com/ogaida/usd
|