springcm-sdk 1.0.1 → 1.1.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 +6 -1
- data/lib/springcm-sdk/document.rb +28 -0
- data/lib/springcm-sdk/folder.rb +3 -0
- data/lib/springcm-sdk/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0e776f098d469fb41d0554adcb37d29bb5dbd0392a015e115f71cd9f78763d8
|
4
|
+
data.tar.gz: e2a606492c73f992a4529298f459be0e5ffc9301c1c8d0cc2e4385c77d5eab3f
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d8fff91dc985edf0cc4ec5108e7cedb5ab5d70c7ac84c8748e1809620ee91494f33b186e51ee954e68c2223d2a02a12d6ebe9437fa3c865aff273aa85ee10d83
|
7
|
+
data.tar.gz: 2786f445b350f4f00370042f8074f2a6d5ab7efbbbdba297d81669b7e94824594ccb5a7a066ec5a438bf882bdf2b8f1da53589ba4bb044e63fcf556c55e2c471
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,10 @@ All notable changes to springcm-sdk will be documented in this file.
|
|
4
4
|
|
5
5
|
## [Unreleased]
|
6
6
|
|
7
|
+
## [1.1.0] - 2020-03-06
|
8
|
+
### Added
|
9
|
+
* Document#upload_version method to check in a new version of a Document.
|
10
|
+
|
7
11
|
## [1.0.1] - 2020-02-14 ❤️
|
8
12
|
### Fixed
|
9
13
|
* Bug with retrieving set fields
|
@@ -143,7 +147,7 @@ All notable changes to springcm-sdk will be documented in this file.
|
|
143
147
|
### Added
|
144
148
|
* Initial release to reserve gem name
|
145
149
|
|
146
|
-
[Unreleased]: https://github.com/paulholden2/springcm-sdk/compare/1.0
|
150
|
+
[Unreleased]: https://github.com/paulholden2/springcm-sdk/compare/1.1.0...HEAD
|
147
151
|
[0.1.0]: https://github.com/paulholden2/springcm-sdk/releases/tag/0.1.0
|
148
152
|
[0.1.1]: https://github.com/paulholden2/springcm-sdk/releases/tag/0.1.1
|
149
153
|
[0.1.2]: https://github.com/paulholden2/springcm-sdk/releases/tag/0.1.2
|
@@ -161,3 +165,4 @@ All notable changes to springcm-sdk will be documented in this file.
|
|
161
165
|
[0.6.1]: https://github.com/paulholden2/springcm-sdk/releases/tag/0.6.1
|
162
166
|
[1.0.0]: https://github.com/paulholden2/springcm-sdk/releases/tag/1.0.0
|
163
167
|
[1.0.1]: https://github.com/paulholden2/springcm-sdk/releases/tag/1.0.1
|
168
|
+
[1.1.0]: https://github.com/paulholden2/springcm-sdk/releases/tag/1.1.0
|
@@ -66,6 +66,34 @@ module Springcm
|
|
66
66
|
end
|
67
67
|
end
|
68
68
|
|
69
|
+
def upload_version(file:, type: :binary)
|
70
|
+
# TODO: DRY Folder#upload
|
71
|
+
file_types = {
|
72
|
+
binary: "application/octet-stream",
|
73
|
+
pdf: "application/pdf",
|
74
|
+
csv: "text/csv",
|
75
|
+
txt: "text/plain"
|
76
|
+
}
|
77
|
+
if !type.nil? && !file_types.keys.include?(type)
|
78
|
+
raise ArgumentError.new("File type must be one of: nil, #{file_types.map(&:inspect).join(", ")}")
|
79
|
+
end
|
80
|
+
conn = @client.authorized_connection(url: @client.upload_api_url)
|
81
|
+
res = conn.post do |req|
|
82
|
+
req.headers["Content-Type"] = file_types[type]
|
83
|
+
req.headers["Content-Length"] = file.size.to_s
|
84
|
+
req.headers["Content-Disposition"] = "attachment; filename=\"#{name}\""
|
85
|
+
req.url "documents/#{uid}"
|
86
|
+
req.body = file
|
87
|
+
end
|
88
|
+
if res.success?
|
89
|
+
data = JSON.parse(res.body)
|
90
|
+
Document.new(data, @client)
|
91
|
+
else
|
92
|
+
nil
|
93
|
+
puts res.body
|
94
|
+
end
|
95
|
+
end
|
96
|
+
|
69
97
|
def delete!
|
70
98
|
unsafe_delete
|
71
99
|
end
|
data/lib/springcm-sdk/folder.rb
CHANGED
@@ -77,6 +77,7 @@ module Springcm
|
|
77
77
|
end
|
78
78
|
|
79
79
|
def upload(name:, file:, type: :binary)
|
80
|
+
# TODO: DRY Document#upload_version
|
80
81
|
file_types = {
|
81
82
|
binary: "application/octet-stream",
|
82
83
|
pdf: "application/pdf",
|
@@ -101,6 +102,8 @@ module Springcm
|
|
101
102
|
end
|
102
103
|
end
|
103
104
|
|
105
|
+
# access
|
106
|
+
# InheritFromParentFolder, NoAccess, View, ViewCreate, ViewEdit, ViewEditDelete, ViewEditDeleteSetAccess
|
104
107
|
def update_security(group:, access:)
|
105
108
|
Helpers.validate_access!(access)
|
106
109
|
if !group.is_a?(Springcm::Group)
|
data/lib/springcm-sdk/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: springcm-sdk
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Paul Holden
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2020-
|
11
|
+
date: 2020-03-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
@@ -192,7 +192,7 @@ metadata:
|
|
192
192
|
allowed_push_host: https://rubygems.org
|
193
193
|
homepage_uri: https://github.com/paulholden2/springcm-sdk
|
194
194
|
source_code_uri: https://github.com/paulholden2/springcm-sdk
|
195
|
-
documentation_uri: https://rubydoc.info/github/paulholden2/springcm-sdk/1.0
|
195
|
+
documentation_uri: https://rubydoc.info/github/paulholden2/springcm-sdk/1.1.0
|
196
196
|
changelog_uri: https://github.com/paulholden2/springcm-sdk/blob/master/CHANGELOG.md
|
197
197
|
post_install_message:
|
198
198
|
rdoc_options: []
|