filebound_client 0.1.0
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 +7 -0
- data/.gitignore +12 -0
- data/.rspec +3 -0
- data/.rubocop.yml +2 -0
- data/.travis.yml +5 -0
- data/CHANGELOG.md +14 -0
- data/CODE_OF_CONDUCT.md +73 -0
- data/CONTRIBUTING.md +58 -0
- data/Gemfile +14 -0
- data/Gemfile.lock +57 -0
- data/LICENSE.txt +21 -0
- data/README.md +200 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/example_test.yml +9 -0
- data/filebound_client.gemspec +29 -0
- data/lib/ext/hash.rb +8 -0
- data/lib/ext/object.rb +19 -0
- data/lib/filebound_client.rb +102 -0
- data/lib/filebound_client/config.rb +33 -0
- data/lib/filebound_client/configuration.rb +6 -0
- data/lib/filebound_client/connection.rb +183 -0
- data/lib/filebound_client/endpoints.rb +52 -0
- data/lib/filebound_client/endpoints/assignments.rb +21 -0
- data/lib/filebound_client/endpoints/dividers.rb +14 -0
- data/lib/filebound_client/endpoints/document_binary_data.rb +53 -0
- data/lib/filebound_client/endpoints/documents.rb +102 -0
- data/lib/filebound_client/endpoints/eform_data.rb +14 -0
- data/lib/filebound_client/endpoints/eform_detail.rb +14 -0
- data/lib/filebound_client/endpoints/files.rb +69 -0
- data/lib/filebound_client/endpoints/projects.rb +160 -0
- data/lib/filebound_client/endpoints/separators.rb +14 -0
- data/lib/filebound_client/endpoints/version.rb +12 -0
- data/lib/filebound_client/version.rb +4 -0
- data/test.txt +1 -0
- metadata +135 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 98614285d4e91599c7a5d4b7e55ad3fe2ebc9836bd945cf35ea1d8ce8d3ba91d
|
4
|
+
data.tar.gz: '09ed3d8df8de9172e02464cd22361c9c8bfb5f8bdfd48293eeed859b780ccf39'
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 52fe4ac525d97b95b5589e86b8d37be2117a2169a629a8e1d5b4d2159c2281fd2c79c9b1f5e2909162699a23104636a7f55ad4ffeac23689d10dc4886fd6a2f6
|
7
|
+
data.tar.gz: a92d599d4670123d4f4b680548e751ea2c20aa32e1f1cc2d4fc105866c1088b61075bd31cfc880844ef5c055b7e41dc435fd8835a1208c70e025f57ae7d9b887
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.rubocop.yml
ADDED
data/.travis.yml
ADDED
data/CHANGELOG.md
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
# Changelog
|
2
|
+
|
3
|
+
|
4
|
+
Changes to this gem will be noted here.
|
5
|
+
|
6
|
+
## [0.1.0] - 2018-08-01
|
7
|
+
### Added
|
8
|
+
- Assignments, Dividers, DocumentBinaryData, Documents, EFormData, EFormDetail, Files, Projects, Separators, and Version
|
9
|
+
endpoints.
|
10
|
+
- Initial build of client and configuration code
|
11
|
+
- Specs for assignments, dividers, documents, projects, and separators endpoints and FileboundClient::Client.
|
12
|
+
|
13
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
14
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
data/CODE_OF_CONDUCT.md
ADDED
@@ -0,0 +1,73 @@
|
|
1
|
+
# Contributor Covenant Code of Conduct
|
2
|
+
|
3
|
+
## Our Pledge
|
4
|
+
|
5
|
+
In the interest of fostering an open and welcoming environment, we as
|
6
|
+
contributors and maintainers pledge to making participation in our project and
|
7
|
+
our community a harassment-free experience for everyone, regardless of age, body
|
8
|
+
size, disability, ethnicity, sex characteristics, gender identity and expression,
|
9
|
+
level of experience, education, socio-economic status, nationality, personal
|
10
|
+
appearance, race, religion, or sexual identity and orientation.
|
11
|
+
|
12
|
+
## Our Standards
|
13
|
+
|
14
|
+
Examples of behavior that contributes to creating a positive environment
|
15
|
+
include:
|
16
|
+
|
17
|
+
* Using welcoming and inclusive language
|
18
|
+
* Being respectful of differing viewpoints and experiences
|
19
|
+
* Gracefully accepting constructive criticism
|
20
|
+
* Focusing on what is best for the community
|
21
|
+
* Showing empathy towards other community members
|
22
|
+
|
23
|
+
Examples of unacceptable behavior by participants include:
|
24
|
+
|
25
|
+
* The use of sexualized language or imagery and unwelcome sexual attention or
|
26
|
+
advances
|
27
|
+
* Trolling, insulting/derogatory comments, and personal or political attacks
|
28
|
+
* Public or private harassment
|
29
|
+
* Publishing others' private information, such as a physical or electronic
|
30
|
+
address, without explicit permission
|
31
|
+
* Other conduct which could reasonably be considered inappropriate in a
|
32
|
+
professional setting
|
33
|
+
|
34
|
+
## Our Responsibilities
|
35
|
+
|
36
|
+
Project maintainers are responsible for clarifying the standards of acceptable
|
37
|
+
behavior and are expected to take appropriate and fair corrective action in
|
38
|
+
response to any instances of unacceptable behavior.
|
39
|
+
|
40
|
+
Project maintainers have the right and responsibility to remove, edit, or
|
41
|
+
reject comments, commits, code, wiki edits, issues, and other contributions
|
42
|
+
that are not aligned to this Code of Conduct, or to ban temporarily or
|
43
|
+
permanently any contributor for other behaviors that they deem inappropriate,
|
44
|
+
threatening, offensive, or harmful.
|
45
|
+
|
46
|
+
## Scope
|
47
|
+
|
48
|
+
This Code of Conduct applies both within project spaces and in public spaces
|
49
|
+
when an individual is representing the project or its community. Examples of
|
50
|
+
representing a project or community include using an official project e-mail
|
51
|
+
address, posting via an official social media account, or acting as an appointed
|
52
|
+
representative at an online or offline event. Representation of a project may be
|
53
|
+
further defined and clarified by project maintainers.
|
54
|
+
|
55
|
+
## Enforcement
|
56
|
+
|
57
|
+
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
58
|
+
reported by contacting the project team at dev@heiskell.com. All
|
59
|
+
complaints will be reviewed and investigated and will result in a response that
|
60
|
+
is deemed necessary and appropriate to the circumstances. The project team is
|
61
|
+
obligated to maintain confidentiality with regard to the reporter of an incident.
|
62
|
+
Further details of specific enforcement policies may be posted separately.
|
63
|
+
|
64
|
+
Project maintainers who do not follow or enforce the Code of Conduct in good
|
65
|
+
faith may face temporary or permanent repercussions as determined by other
|
66
|
+
members of the project's leadership.
|
67
|
+
|
68
|
+
## Attribution
|
69
|
+
|
70
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
|
71
|
+
available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
|
72
|
+
|
73
|
+
[homepage]: https://www.contributor-covenant.org
|
data/CONTRIBUTING.md
ADDED
@@ -0,0 +1,58 @@
|
|
1
|
+
# Contributing to the Filebound Client Gem
|
2
|
+
|
3
|
+
Thank you for taking the time to contribute to this project! We gladly welcome new suggestions and pull requests!
|
4
|
+
|
5
|
+
This document details the guidelines around contributing to this gem. If anything is vague or unclear let us know or
|
6
|
+
submit a pull request with your suggested changes! Again these are guidelines and not hard and fast rules so please use
|
7
|
+
your discretion.
|
8
|
+
|
9
|
+
## Code of Conduct
|
10
|
+
|
11
|
+
You can access our code of conduct [here](./CODE_OF_CONDUCT.md). It is based on the
|
12
|
+
[Contributor Covenant](https://www.contributor-covenant.org/) Code of Conduct. Please report conduct that violates
|
13
|
+
this code to [dev@heiskell.com](mailto:dev@heiskell.com).
|
14
|
+
|
15
|
+
## Contributing
|
16
|
+
|
17
|
+
### Reporting Bugs
|
18
|
+
|
19
|
+
Coming soon...
|
20
|
+
|
21
|
+
#### Submitting A Good Bug Report
|
22
|
+
|
23
|
+
Coming soon...
|
24
|
+
|
25
|
+
### Suggesting Enhancements
|
26
|
+
|
27
|
+
Coming soon...
|
28
|
+
|
29
|
+
#### Submitting a Good Enhancement Suggestion
|
30
|
+
|
31
|
+
Coming soon...
|
32
|
+
|
33
|
+
### Pull Requests
|
34
|
+
|
35
|
+
Coming soon...
|
36
|
+
|
37
|
+
## Styleguides
|
38
|
+
|
39
|
+
Coming soon...
|
40
|
+
|
41
|
+
### Commit Messages
|
42
|
+
|
43
|
+
Coming soon...
|
44
|
+
|
45
|
+
### Ruby Styleguide
|
46
|
+
|
47
|
+
Coming soon...
|
48
|
+
|
49
|
+
### Specs Styleguide
|
50
|
+
|
51
|
+
Coming soon...
|
52
|
+
|
53
|
+
### Documentation Styleguide
|
54
|
+
|
55
|
+
Coming soon...
|
56
|
+
|
57
|
+
|
58
|
+
|
data/Gemfile
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
git_source(:github) { |repo_name| "https://github.com/#{repo_name}" }
|
4
|
+
|
5
|
+
# Specify your gem's dependencies in filebound_client.gemspec
|
6
|
+
gemspec
|
7
|
+
|
8
|
+
group :test do
|
9
|
+
gem 'rspec', '~> 3.0'
|
10
|
+
end
|
11
|
+
|
12
|
+
group :development do
|
13
|
+
gem 'rubocop', '~> 0.58.2', require: false
|
14
|
+
end
|
data/Gemfile.lock
ADDED
@@ -0,0 +1,57 @@
|
|
1
|
+
PATH
|
2
|
+
remote: .
|
3
|
+
specs:
|
4
|
+
filebound_client (0.1.0)
|
5
|
+
ruby-ntlm (~> 0.0.4)
|
6
|
+
|
7
|
+
GEM
|
8
|
+
remote: https://rubygems.org/
|
9
|
+
specs:
|
10
|
+
ast (2.4.0)
|
11
|
+
diff-lcs (1.3)
|
12
|
+
jaro_winkler (1.5.1)
|
13
|
+
parallel (1.12.1)
|
14
|
+
parser (2.5.1.2)
|
15
|
+
ast (~> 2.4.0)
|
16
|
+
powerpack (0.1.2)
|
17
|
+
rainbow (3.0.0)
|
18
|
+
rake (12.3.1)
|
19
|
+
rspec (3.7.0)
|
20
|
+
rspec-core (~> 3.7.0)
|
21
|
+
rspec-expectations (~> 3.7.0)
|
22
|
+
rspec-mocks (~> 3.7.0)
|
23
|
+
rspec-core (3.7.1)
|
24
|
+
rspec-support (~> 3.7.0)
|
25
|
+
rspec-expectations (3.7.0)
|
26
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
27
|
+
rspec-support (~> 3.7.0)
|
28
|
+
rspec-mocks (3.7.0)
|
29
|
+
diff-lcs (>= 1.2.0, < 2.0)
|
30
|
+
rspec-support (~> 3.7.0)
|
31
|
+
rspec-support (3.7.1)
|
32
|
+
rubocop (0.58.2)
|
33
|
+
jaro_winkler (~> 1.5.1)
|
34
|
+
parallel (~> 1.10)
|
35
|
+
parser (>= 2.5, != 2.5.1.1)
|
36
|
+
powerpack (~> 0.1)
|
37
|
+
rainbow (>= 2.2.2, < 4.0)
|
38
|
+
ruby-progressbar (~> 1.7)
|
39
|
+
unicode-display_width (~> 1.0, >= 1.0.1)
|
40
|
+
ruby-ntlm (0.0.4)
|
41
|
+
ruby-progressbar (1.9.0)
|
42
|
+
unicode-display_width (1.4.0)
|
43
|
+
yard (0.9.15)
|
44
|
+
|
45
|
+
PLATFORMS
|
46
|
+
ruby
|
47
|
+
|
48
|
+
DEPENDENCIES
|
49
|
+
bundler (~> 1.16.0)
|
50
|
+
filebound_client!
|
51
|
+
rake (~> 12.3.0)
|
52
|
+
rspec (~> 3.0)
|
53
|
+
rubocop (~> 0.58.2)
|
54
|
+
yard (~> 0.9.0)
|
55
|
+
|
56
|
+
BUNDLED WITH
|
57
|
+
1.16.2
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2018 J.D. Heiskell & Co.
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,200 @@
|
|
1
|
+
# FileboundClient
|
2
|
+
|
3
|
+
This gem provides a easy way for you to access the Filebound API.
|
4
|
+
|
5
|
+
## Dependencies
|
6
|
+
|
7
|
+
### Development
|
8
|
+
* Ruby
|
9
|
+
* Bundler
|
10
|
+
* Rake
|
11
|
+
* Yard - for documentation
|
12
|
+
* RSpec - for testing
|
13
|
+
|
14
|
+
### Runtime
|
15
|
+
* Ruby
|
16
|
+
* ruby-ntlm - this gem provides the ability to send NTLM headers in requests for when your Filebound server is running
|
17
|
+
on an IIS web site with Windows Authentication enabled.
|
18
|
+
|
19
|
+
## Installation
|
20
|
+
|
21
|
+
Add this line to your application's Gemfile:
|
22
|
+
|
23
|
+
```ruby
|
24
|
+
gem 'filebound_client'
|
25
|
+
```
|
26
|
+
|
27
|
+
And then execute:
|
28
|
+
|
29
|
+
$ bundle
|
30
|
+
|
31
|
+
Or install it yourself as:
|
32
|
+
|
33
|
+
$ gem install filebound_client
|
34
|
+
|
35
|
+
## Usage
|
36
|
+
|
37
|
+
Once you have the gem install you will need to configure it before you can connect to the Filebound API.
|
38
|
+
Here is an example:
|
39
|
+
|
40
|
+
```ruby
|
41
|
+
require 'filebound_client'
|
42
|
+
c = FileboundClient::Client.connect(host: url_to_api, username: fb_username, password: fb_password)
|
43
|
+
```
|
44
|
+
|
45
|
+
If your Filebound server uses domain auth you will need to add some additional configuration values:
|
46
|
+
|
47
|
+
```ruby
|
48
|
+
require 'filebound_client'
|
49
|
+
c = FileboundClient::Client.connect(host: url_to_api, username: fb_username, password: fb_password, use_ntlm: true,
|
50
|
+
ntlm_user: ntlm_username, ntlm_password: ntlm_password, ntlm_domain: ntlm_domain)
|
51
|
+
```
|
52
|
+
|
53
|
+
Once you have a connection you can start making requests to the API
|
54
|
+
|
55
|
+
## Examples
|
56
|
+
|
57
|
+
### Get a project
|
58
|
+
|
59
|
+
```ruby
|
60
|
+
p = c.project(123)
|
61
|
+
puts p[:name]
|
62
|
+
```
|
63
|
+
|
64
|
+
### Create a project
|
65
|
+
|
66
|
+
```ruby
|
67
|
+
p = c.project_new
|
68
|
+
p[:name] = 'Test Project'
|
69
|
+
project_id = c.project_add(p)
|
70
|
+
p = c.project(project_id)
|
71
|
+
puts p[:name]
|
72
|
+
```
|
73
|
+
|
74
|
+
### Update a project
|
75
|
+
|
76
|
+
```ruby
|
77
|
+
p = c.project(123)
|
78
|
+
puts p[:name]
|
79
|
+
p[:name] = 'something else'
|
80
|
+
project_id = c.project_update(p)
|
81
|
+
p = c.project(project_id)
|
82
|
+
puts p[:name]
|
83
|
+
```
|
84
|
+
|
85
|
+
### Create a file
|
86
|
+
|
87
|
+
```ruby
|
88
|
+
p = c.project(123)
|
89
|
+
f = c.file_new
|
90
|
+
f[:projectId] = p[:id]
|
91
|
+
f[:notes] = 'test file'
|
92
|
+
```
|
93
|
+
|
94
|
+
If you have field values you need to set for indexing set them this way. The first element in the array is not used.
|
95
|
+
Element 1 is the first indexed field.
|
96
|
+
|
97
|
+
```ruby
|
98
|
+
f[:field] = ["not used - ignore", "test value", "", "", "", "", "", "", "", "", "", "", "", "",
|
99
|
+
"", "", "", "", "", "", ""]
|
100
|
+
```
|
101
|
+
|
102
|
+
Then save your new file this way.
|
103
|
+
|
104
|
+
```ruby
|
105
|
+
file_id = c.file_add(f)
|
106
|
+
f = c.file(file_id)
|
107
|
+
puts f[:notes]
|
108
|
+
```
|
109
|
+
|
110
|
+
### Update a file
|
111
|
+
|
112
|
+
```ruby
|
113
|
+
f = c.file(123)
|
114
|
+
f[:notes] = 'updated notes'
|
115
|
+
file_id = c.file_update(f)
|
116
|
+
f = c.file(file_id)
|
117
|
+
puts f[:notes]
|
118
|
+
```
|
119
|
+
|
120
|
+
### Create document with attached binary file data
|
121
|
+
|
122
|
+
```ruby
|
123
|
+
data = Base64.encode64(File.read('somefile.pdf'))
|
124
|
+
d = c.document_new
|
125
|
+
d[:allowSaveBinaryData] = false
|
126
|
+
d[:binaryData] = data
|
127
|
+
d[:extension] = 'pdf'
|
128
|
+
d[:fileId] = 123
|
129
|
+
d[:description] = 'Test PDF file'
|
130
|
+
d[:name] = 'somefile.pdf'
|
131
|
+
d[:notes] = 'Test PDF'
|
132
|
+
document_id = c.document_add(d)
|
133
|
+
d = c.document(document_id)
|
134
|
+
puts d[:name]
|
135
|
+
```
|
136
|
+
|
137
|
+
Set the isImage field to true if the file is an image (png, jpg, gif, etc).
|
138
|
+
Set the isText field to true if the file is a text file.
|
139
|
+
Set the isTIFF field to true if the file is as TIFF file.
|
140
|
+
Set the isWeb field to true if the file is and HTML file (HTM, HTML, etc).
|
141
|
+
Set the isWebEform field to true if the file is an HTML form.
|
142
|
+
|
143
|
+
### Update document
|
144
|
+
|
145
|
+
```ruby
|
146
|
+
d = c.document(123)
|
147
|
+
puts d[:name]
|
148
|
+
d[:name] = 'different name'
|
149
|
+
document_id = c.document_update(d)
|
150
|
+
d = c.document(document_id)
|
151
|
+
puts d[:name]
|
152
|
+
```
|
153
|
+
|
154
|
+
## Development
|
155
|
+
|
156
|
+
After checking out the repo, run `bin/setup` to install dependencies. Setup your Filebound connection information
|
157
|
+
in a test.yml file. You can see an example in example_test.yml. Then, run `rake spec` to run the tests.
|
158
|
+
You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
159
|
+
|
160
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the
|
161
|
+
version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version,
|
162
|
+
push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
163
|
+
|
164
|
+
### New resource endpoints
|
165
|
+
|
166
|
+
If you are creating a new resource endpoint there are a couple of macros you can use for creating a new empty
|
167
|
+
resource and getting all instances of a resource on the Filebound server. Here is an example from the assignments
|
168
|
+
resource endpoint file:
|
169
|
+
|
170
|
+
```ruby
|
171
|
+
module FileboundClient
|
172
|
+
module Endpoints
|
173
|
+
module Assignments
|
174
|
+
def self.included klass
|
175
|
+
klass.instance_eval do
|
176
|
+
allow_new :assignment # Creates a new empty assignment
|
177
|
+
allow_all :assignments # Request all assignments with an optional filter query parameter
|
178
|
+
end
|
179
|
+
end
|
180
|
+
...
|
181
|
+
end
|
182
|
+
end
|
183
|
+
end
|
184
|
+
```
|
185
|
+
|
186
|
+
|
187
|
+
## Contributing
|
188
|
+
|
189
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/JDHeiskell/filebound_client. Our contributing
|
190
|
+
guidelines can be found [here](./CONTRIBUTING.md).
|
191
|
+
|
192
|
+
## Code of Conduct
|
193
|
+
|
194
|
+
We enforce the standard [Contributor Covenant](https://www.contributor-covenant.org/) Code of Conduct. You can access
|
195
|
+
that [here](./CODE_OF_CONDUCT.md).
|
196
|
+
|
197
|
+
## License
|
198
|
+
|
199
|
+
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT). A copy
|
200
|
+
of it is [here](./LICENSE.txt).
|