usd 0.1.8 → 0.1.9

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: dd923f3b1814841074968b4308bed67f1103d612445254ffad801f762ddbc6bf
4
- data.tar.gz: 531ef12b97b305293082b3252c00625529c1f79a47f2bd06505f9b0e1f3f78b9
3
+ metadata.gz: 6d94c304443320d3205ae4b734dbf236bec892f3dff927e98d902e584c76099b
4
+ data.tar.gz: a9dcbf0faf5798169948c08590556fbb4da405ed8a6a77f616caacf8ffedc54e
5
5
  SHA512:
6
- metadata.gz: d2ffbea196cef1e974dd9f8bafb43b6076c807e24caa81a96a733bc2062aec830f6956de00bbda984fe7320e1fd756a829b63214cf9b32dfe11159d5b2f496fe
7
- data.tar.gz: 77531ebb77a005a9dba2f9954faa8dafafc05c68df97c9e7824b2fe964fcc5526f2243e6407eda4544d9704370031b5decb1c774f65bfdc53157881a0c55d549
6
+ metadata.gz: 0ffd4b1fa7f5cf03667b0c1523958945e2e1dbd1b65386ab05cd4abfd095b474e149d5db055c8845b57a9c44131339a1251d0a4849701d03b43675f983a5b8cd
7
+ data.tar.gz: 352ea30499ce9a4f2d8b26cb6c0ee002a707dca331ad25f3eec694bf36a91d3ff442c3bb2c23557f54ceab8ea47cbe2224aa3c6a58b7b73f335703c5f2741f13
data/LICENSE.md ADDED
@@ -0,0 +1,20 @@
1
+ Copyright (c) 2019 Oliver Gaida
2
+
3
+ Permission is hereby granted, free of charge, to any person obtaining
4
+ a copy of this software and associated documentation files (the
5
+ "Software"), to deal in the Software without restriction, including
6
+ without limitation the rights to use, copy, modify, merge, publish,
7
+ distribute, sublicense, and/or sell copies of the Software, and to
8
+ permit persons to whom the Software is furnished to do so, subject to
9
+ the following conditions:
10
+
11
+ The above copyright notice and this permission notice shall be
12
+ included in all copies or substantial portions of the Software.
13
+
14
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
15
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
16
+ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
17
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
18
+ LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
19
+ OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
20
+ WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
data/README.md CHANGED
@@ -8,7 +8,7 @@ There is a ruby class and a commandline tool rusdc.
8
8
  just install the gem:
9
9
 
10
10
  ```bash
11
- sudo gem install usd
11
+ gem install usd
12
12
  ```
13
13
 
14
14
  Be aware that you need some compiler-tools and the ruby headers:
data/bin/rusdc CHANGED
@@ -153,6 +153,22 @@ class Rusdc < Thor
153
153
  end
154
154
  end
155
155
 
156
+ desc "get_all_attachments_of_co <co_name>", "get all attachments of a changeorder and save all these to current folder"
157
+ def get_all_attachments_of_co(coname)
158
+ # todo : care more about eml-multipart: https://github.com/mikel/mail
159
+ chg_id=loadcon.request("/caisd-rest/chg/COMMON_NAME-#{coname}")["chg"]["@id"]
160
+ att_nr = loadcon.search("lrel_attachments_changes",{'fields' => "attmnt","wc" => "chg = #{chg_id}"})
161
+ att_nr.each do |att|
162
+ attmnt = loadcon.request("/caisd-rest/attmnt/COMMON_NAME-#{att["attmnt"]["@COMMON_NAME"]}")["attmnt"]
163
+ filename = attmnt["orig_file_name"]
164
+ puts "save #{filename}"
165
+ f = File.open(filename, 'w')
166
+ f.write(loadcon.request("/caisd-rest/attmnt/#{attmnt["@id"]}/file-resource",{:unchanged => true}))
167
+ f.close
168
+ end
169
+ puts "all attachments were saved"
170
+ end
171
+
156
172
  desc "get_attachment_of_ci <ci_name> <filename>", "download an attachment of a CI and print it out on stdout"
157
173
  def get_attachment_of_ci(ciname, filename)
158
174
  att_nr = loadcon.search("lrel_attachments_nr",{'fields' => "attmnt","wc" => "nr.name = '#{ciname}'"})
@@ -259,6 +275,9 @@ class Rusdc < Thor
259
275
 
260
276
  desc "update_attr <obj> <common_name> <key> <value>", "updates a direct (not referenced) attribute of one object."
261
277
  def update_attr(obj, cn, k, v)
278
+ if k =~ /(date|last_mod|warranty_start|warranty_end|time_stamp)$/
279
+ v=Time.parse(v).to_i
280
+ end
262
281
  template = ERB.new <<-EOF
263
282
  {
264
283
  "<%= obj %>": {
data/change_log.md CHANGED
@@ -1,5 +1,17 @@
1
1
  # changelog
2
2
 
3
+ ## 0.1.9 (noch nicht gepushed)
4
+
5
+ - function update_attr will parse with Time-Module if the key match the regular expression: `(date|last_mod|warranty_start|warranty_end|time_stamp)`. And then the value will be change to epoche-seconds
6
+
7
+ Example:
8
+
9
+ ```
10
+ rusdc update_attr chg CO000001 call_back_date "2020-01-01 11:11:11 +0100"
11
+ ```
12
+
13
+ - new function in rusdc `get_all_attachments_of_co`. In the first implementation it will save all attachments with its original name in the current folder. existing files may be overwritten. Caution!
14
+
3
15
  ## 0.1.8
4
16
 
5
17
  - new function in rusdc `update_attr`
data/lib/usd.rb CHANGED
@@ -21,8 +21,9 @@ class Usd
21
21
  @base_url = base_url
22
22
  @user = user
23
23
  @debug = false
24
- if File.exist?(".usd") and hash[:save_access_key]
25
- tt = YAML.load(File.open(".usd","r"))
24
+ remfile = "#{ENV["HOME"]}/.usd"
25
+ if File.exist?(remfile) and hash[:save_access_key]
26
+ tt = YAML.load(File.open(remfile,"r"))
26
27
  if (tt.expiration_date - Time.now.to_i ) > 900 and tt.base_url == base_url
27
28
  @access_key = tt.access_key
28
29
  @expiration_date = tt.expiration_date
@@ -56,7 +57,7 @@ class Usd
56
57
  @access_key = authData['rest_access']['access_key']
57
58
  @expiration_date = authData['rest_access']['expiration_date']
58
59
  if hash[:save_access_key]
59
- f=File.open(".usd","w")
60
+ f=File.open(remfile,"w")
60
61
  f.puts self.to_yaml
61
62
  f.close
62
63
  end
data/usd.gemspec CHANGED
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |spec|
2
2
  spec.name = 'usd'
3
- spec.version = '0.1.8'
4
- spec.date = '2019-11-04'
3
+ spec.version = '0.1.9'
4
+ spec.date = '2019-11-07'
5
5
  spec.summary = "SDM REST-API-Calls"
6
6
  spec.description = "a Ruby class and a commandlinetool for SDM REST-API-Calls"
7
7
  spec.authors = ["Oliver Gaida"]
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: usd
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.8
4
+ version: 0.1.9
5
5
  platform: ruby
6
6
  authors:
7
7
  - Oliver Gaida
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2019-11-04 00:00:00.000000000 Z
11
+ date: 2019-11-07 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -77,6 +77,7 @@ executables:
77
77
  extensions: []
78
78
  extra_rdoc_files: []
79
79
  files:
80
+ - LICENSE.md
80
81
  - README.md
81
82
  - bin/rusdc
82
83
  - bin/set_env