reivt 1.5.0 → 1.6.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +15 -14
- data/.rubocop.yml +1168 -1168
- data/Gemfile +11 -11
- data/README.md +3 -2
- data/Rakefile +22 -22
- data/bin/console +9 -9
- data/exe/revit +5 -5
- data/guides/BaemptyError.md +31 -31
- data/guides/CreatingRevs.md +50 -50
- data/guides/GraphQLDataIssue.md +5 -5
- data/guides/GraphQLValidationError.md +5 -5
- data/guides/LoggingIn.md +17 -17
- data/lib/reivt/api/mutations/document_create.mutation.rb +50 -50
- data/lib/reivt/api/mutations/document_delete.mutation.rb +36 -36
- data/lib/reivt/api/mutations/rev_create.mutation.rb +38 -38
- data/lib/reivt/api/mutations/rev_delete.mutation.rb +36 -36
- data/lib/reivt/api/mutations/user_create.mutation.rb +32 -32
- data/lib/reivt/api/mutations/user_signin.mutation.rb +39 -39
- data/lib/reivt/api.rb +64 -64
- data/lib/reivt/auth.rb +96 -82
- data/lib/reivt/cli.rb +167 -165
- data/lib/reivt/document.rb +67 -67
- data/lib/reivt/exception.rb +48 -35
- data/lib/reivt/schema/schema.json +20981 -20981
- data/lib/reivt/util.rb +112 -112
- data/lib/reivt/version.rb +3 -3
- data/lib/reivt.rb +42 -42
- data/revit.gemspec +44 -44
- metadata +2 -2
data/Gemfile
CHANGED
@@ -1,11 +1,11 @@
|
|
1
|
-
source 'https://rubygems.org'
|
2
|
-
|
3
|
-
# gem dependencies go in revit.gemspec
|
4
|
-
gemspec
|
5
|
-
|
6
|
-
gem 'rugged', git: 'git://github.com/libgit2/rugged.git', submodules: true
|
7
|
-
|
8
|
-
group :test do
|
9
|
-
gem 'codeclimate-test-reporter', '~> 1.0.0'
|
10
|
-
gem 'simplecov'
|
11
|
-
end
|
1
|
+
source 'https://rubygems.org'
|
2
|
+
|
3
|
+
# gem dependencies go in revit.gemspec
|
4
|
+
gemspec
|
5
|
+
|
6
|
+
gem 'rugged', git: 'git://github.com/libgit2/rugged.git', submodules: true
|
7
|
+
|
8
|
+
group :test do
|
9
|
+
gem 'codeclimate-test-reporter', '~> 1.0.0'
|
10
|
+
gem 'simplecov'
|
11
|
+
end
|
data/README.md
CHANGED
@@ -1,6 +1,7 @@
|
|
1
1
|
[![Code Climate](https://codeclimate.com/repos/57d861ee01430a66ea000bed/badges/4d214cda256127c2391e/gpa.svg)](https://codeclimate.com/repos/57d861ee01430a66ea000bed/feed) [![Test Coverage](https://codeclimate.com/repos/57d861ee01430a66ea000bed/badges/4d214cda256127c2391e/coverage.svg)](https://codeclimate.com/repos/57d861ee01430a66ea000bed/coverage) [![Issue Count](https://codeclimate.com/repos/57d861ee01430a66ea000bed/badges/4d214cda256127c2391e/issue_count.svg)](https://codeclimate.com/repos/57d861ee01430a66ea000bed/feed)
|
2
2
|
|
3
|
-
#
|
3
|
+
# Revit
|
4
|
+
## Rev's handy CLI sidekick
|
4
5
|
---
|
5
6
|
Upload your documents/directories/git commits to rev for a code review session!
|
6
7
|
|
@@ -14,4 +15,4 @@ Conduct your code reviews with [rev](https://rev.vaemoi.co)!
|
|
14
15
|
|
15
16
|
## License
|
16
17
|
|
17
|
-
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
18
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
CHANGED
@@ -1,22 +1,22 @@
|
|
1
|
-
require 'rspec/core/rake_task'
|
2
|
-
require 'bundler/gem_tasks'
|
3
|
-
|
4
|
-
RSpec::Core::RakeTask.new(:spec) do |t|
|
5
|
-
t.rspec_opts = '--format doc'
|
6
|
-
end
|
7
|
-
|
8
|
-
task :console do
|
9
|
-
require 'pry'
|
10
|
-
require 'gem_name'
|
11
|
-
|
12
|
-
def reload!
|
13
|
-
# Change 'gem_name' here too:
|
14
|
-
files = $LOADED_FEATURES.select { |feat| feat =~ %r{//gem_name} }
|
15
|
-
files.each { |file| load file }
|
16
|
-
end
|
17
|
-
|
18
|
-
ARGV.clear
|
19
|
-
Pry.start
|
20
|
-
end
|
21
|
-
|
22
|
-
task default: :spec
|
1
|
+
require 'rspec/core/rake_task'
|
2
|
+
require 'bundler/gem_tasks'
|
3
|
+
|
4
|
+
RSpec::Core::RakeTask.new(:spec) do |t|
|
5
|
+
t.rspec_opts = '--format doc'
|
6
|
+
end
|
7
|
+
|
8
|
+
task :console do
|
9
|
+
require 'pry'
|
10
|
+
require 'gem_name'
|
11
|
+
|
12
|
+
def reload!
|
13
|
+
# Change 'gem_name' here too:
|
14
|
+
files = $LOADED_FEATURES.select { |feat| feat =~ %r{//gem_name} }
|
15
|
+
files.each { |file| load file }
|
16
|
+
end
|
17
|
+
|
18
|
+
ARGV.clear
|
19
|
+
Pry.start
|
20
|
+
end
|
21
|
+
|
22
|
+
task default: :spec
|
data/bin/console
CHANGED
@@ -1,9 +1,9 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'bundler/setup'
|
4
|
-
require 'paint'
|
5
|
-
require 'reivt'
|
6
|
-
|
7
|
-
require 'irb'
|
8
|
-
|
9
|
-
IRB.start(__FILE__)
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'bundler/setup'
|
4
|
+
require 'paint'
|
5
|
+
require 'reivt'
|
6
|
+
|
7
|
+
require 'irb'
|
8
|
+
|
9
|
+
IRB.start(__FILE__)
|
data/exe/revit
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
|
3
|
-
require 'reivt'
|
4
|
-
|
5
|
-
Reivt::CLI.start(ARGV)
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require 'reivt'
|
4
|
+
|
5
|
+
Reivt::CLI.start(ARGV)
|
data/guides/BaemptyError.md
CHANGED
@@ -1,31 +1,31 @@
|
|
1
|
-
# baemptyError
|
2
|
-
|
3
|
-
This simply means you have passed rev either to an empty repo or a [bare repo](http://www.saintsjd.com/2011/01/what-is-a-bare-git-repository/).
|
4
|
-
|
5
|
-
If you still want to use the repo:
|
6
|
-
|
7
|
-
|
8
|
-
- create a commit
|
9
|
-
``` bash
|
10
|
-
|
11
|
-
git add -A && git commit -m # Add every file in the repo
|
12
|
-
|
13
|
-
git add ./path/to/file.ext && git commit -m # Add a specific file or folder
|
14
|
-
|
15
|
-
```
|
16
|
-
|
17
|
-
- Destroy the repo
|
18
|
-
``` bash
|
19
|
-
|
20
|
-
rm -rf .git
|
21
|
-
|
22
|
-
```
|
23
|
-
|
24
|
-
|
25
|
-
Then try revit again:
|
26
|
-
|
27
|
-
``` bash
|
28
|
-
|
29
|
-
revit create ./path/to/repo
|
30
|
-
|
31
|
-
```
|
1
|
+
# baemptyError
|
2
|
+
|
3
|
+
This simply means you have passed rev either to an empty repo or a [bare repo](http://www.saintsjd.com/2011/01/what-is-a-bare-git-repository/).
|
4
|
+
|
5
|
+
If you still want to use the repo:
|
6
|
+
|
7
|
+
|
8
|
+
- create a commit
|
9
|
+
``` bash
|
10
|
+
|
11
|
+
git add -A && git commit -m # Add every file in the repo
|
12
|
+
|
13
|
+
git add ./path/to/file.ext && git commit -m # Add a specific file or folder
|
14
|
+
|
15
|
+
```
|
16
|
+
|
17
|
+
- Destroy the repo
|
18
|
+
``` bash
|
19
|
+
|
20
|
+
rm -rf .git
|
21
|
+
|
22
|
+
```
|
23
|
+
|
24
|
+
|
25
|
+
Then try revit again:
|
26
|
+
|
27
|
+
``` bash
|
28
|
+
|
29
|
+
revit create ./path/to/repo
|
30
|
+
|
31
|
+
```
|
data/guides/CreatingRevs.md
CHANGED
@@ -1,50 +1,50 @@
|
|
1
|
-
# How to
|
2
|
-
|
3
|
-
## Getting Started
|
4
|
-
---
|
5
|
-
To get started with revit make sure you have the latest ruby installed or atleast version 2.3.3.
|
6
|
-
|
7
|
-
``` bash
|
8
|
-
|
9
|
-
ruby -v
|
10
|
-
|
11
|
-
```
|
12
|
-
|
13
|
-
Now let's install revit!
|
14
|
-
|
15
|
-
``` bash
|
16
|
-
|
17
|
-
gem install revit
|
18
|
-
|
19
|
-
revit -v
|
20
|
-
revit --version
|
21
|
-
|
22
|
-
```
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
## Creating a revs
|
27
|
-
---
|
28
|
-
revit only allows creating new rev at the moment, modifying them will come soong!
|
29
|
-
|
30
|
-
Get started by running revit ```create```
|
31
|
-
|
32
|
-
``` bash
|
33
|
-
|
34
|
-
revit create ./path/to/docs # Path to a single file, directory or git repo
|
35
|
-
|
36
|
-
revit create -l ./path/file1 ./path/file2 # -l allows you to pass multiple files / docs / repos
|
37
|
-
|
38
|
-
revit create ./path/file1 -d "An example rev" # Add a description to your rev
|
39
|
-
|
40
|
-
revit create ./path/file1 -t "First Rev" # Add a title to your rev
|
41
|
-
|
42
|
-
```
|
43
|
-
|
44
|
-
These commands will also be shown by running:
|
45
|
-
|
46
|
-
``` bash
|
47
|
-
|
48
|
-
revit --help
|
49
|
-
|
50
|
-
```
|
1
|
+
# How to
|
2
|
+
|
3
|
+
## Getting Started
|
4
|
+
---
|
5
|
+
To get started with revit make sure you have the latest ruby installed or atleast version 2.3.3.
|
6
|
+
|
7
|
+
``` bash
|
8
|
+
|
9
|
+
ruby -v
|
10
|
+
|
11
|
+
```
|
12
|
+
|
13
|
+
Now let's install revit!
|
14
|
+
|
15
|
+
``` bash
|
16
|
+
|
17
|
+
gem install revit
|
18
|
+
|
19
|
+
revit -v
|
20
|
+
revit --version
|
21
|
+
|
22
|
+
```
|
23
|
+
|
24
|
+
|
25
|
+
|
26
|
+
## Creating a revs
|
27
|
+
---
|
28
|
+
revit only allows creating new rev at the moment, modifying them will come soong!
|
29
|
+
|
30
|
+
Get started by running revit ```create```
|
31
|
+
|
32
|
+
``` bash
|
33
|
+
|
34
|
+
revit create ./path/to/docs # Path to a single file, directory or git repo
|
35
|
+
|
36
|
+
revit create -l ./path/file1 ./path/file2 # -l allows you to pass multiple files / docs / repos
|
37
|
+
|
38
|
+
revit create ./path/file1 -d "An example rev" # Add a description to your rev
|
39
|
+
|
40
|
+
revit create ./path/file1 -t "First Rev" # Add a title to your rev
|
41
|
+
|
42
|
+
```
|
43
|
+
|
44
|
+
These commands will also be shown by running:
|
45
|
+
|
46
|
+
``` bash
|
47
|
+
|
48
|
+
revit --help
|
49
|
+
|
50
|
+
```
|
data/guides/GraphQLDataIssue.md
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
# GraphQLDataIssue
|
2
|
-
|
3
|
-
Hey, don't fret this just means that some error happened on our api! It's not your fault we swear!
|
4
|
-
|
5
|
-
Try running the same command again, and if you end up here again post an issue to our tracker on Bitbucket [here](https://bitbucket.org/vaemoi/revit/issues)
|
1
|
+
# GraphQLDataIssue
|
2
|
+
|
3
|
+
Hey, don't fret this just means that some error happened on our api! It's not your fault we swear!
|
4
|
+
|
5
|
+
Try running the same command again, and if you end up here again post an issue to our tracker on Bitbucket [here](https://bitbucket.org/vaemoi/revit/issues)
|
@@ -1,5 +1,5 @@
|
|
1
|
-
# GraphQLValidationError
|
2
|
-
|
3
|
-
Hey, don't fret this just means that some variable passed to our api wasn't in the correct format! It's not your fault we swear!
|
4
|
-
|
5
|
-
Try running the same command again, and if it fails post an issue to our tracker on Bitbucket [here](https://bitbucket.org/vaemoi/revit/issues)
|
1
|
+
# GraphQLValidationError
|
2
|
+
|
3
|
+
Hey, don't fret this just means that some variable passed to our api wasn't in the correct format! It's not your fault we swear!
|
4
|
+
|
5
|
+
Try running the same command again, and if it fails post an issue to our tracker on Bitbucket [here](https://bitbucket.org/vaemoi/revit/issues)
|
data/guides/LoggingIn.md
CHANGED
@@ -1,17 +1,17 @@
|
|
1
|
-
# Logging In
|
2
|
-
Start an authentication workflow to receive an access token (allows you to access our api)
|
3
|
-
|
4
|
-
Running login will produce a url you need to follow in order to get your auth code from Auth0. Paste this code back into the terminal and you'll be authenticated. (If you want more security info checkout our wiki!)
|
5
|
-
|
6
|
-
``` bash
|
7
|
-
|
8
|
-
revit login
|
9
|
-
|
10
|
-
"Login here for your token": https://vaemoi.auth0/login/stuff/to/login
|
11
|
-
|
12
|
-
"Enter your auth code here" => owfnoisjIAIO90w9JDOFIEF
|
13
|
-
|
14
|
-
Authentication successful :)
|
15
|
-
```
|
16
|
-
|
17
|
-
Now you're ready to make some revs!
|
1
|
+
# Logging In
|
2
|
+
Start an authentication workflow to receive an access token (allows you to access our api)
|
3
|
+
|
4
|
+
Running login will produce a url you need to follow in order to get your auth code from Auth0. Paste this code back into the terminal and you'll be authenticated. (If you want more security info checkout our wiki!)
|
5
|
+
|
6
|
+
``` bash
|
7
|
+
|
8
|
+
revit login
|
9
|
+
|
10
|
+
"Login here for your token": https://vaemoi.auth0/login/stuff/to/login
|
11
|
+
|
12
|
+
"Enter your auth code here" => owfnoisjIAIO90w9JDOFIEF
|
13
|
+
|
14
|
+
Authentication successful :)
|
15
|
+
```
|
16
|
+
|
17
|
+
Now you're ready to make some revs!
|
@@ -1,50 +1,50 @@
|
|
1
|
-
# An extension of our main module Revit
|
2
|
-
#
|
3
|
-
# @author [brwnrclse]
|
4
|
-
#
|
5
|
-
module Reivt
|
6
|
-
# An extension of the RevAPI module
|
7
|
-
#
|
8
|
-
# @author [brwnrclse]
|
9
|
-
#
|
10
|
-
module RevAPI
|
11
|
-
CreateDocumentMutation = CLIENT.parse <<-'GRAPHQL'
|
12
|
-
mutation($blob: String!, $content_type: String!, $doc_name: String!, $has_diff: Boolean!, $rev_id: ID!) {
|
13
|
-
createDocument(blob: $blob, contentType: $content_type, name: $doc_name, hasDiff: $has_diff, revId: $rev_id) {
|
14
|
-
id
|
15
|
-
}
|
16
|
-
}
|
17
|
-
GRAPHQL
|
18
|
-
|
19
|
-
# API call to createDocument
|
20
|
-
# @param blob [String] The contents of the Document
|
21
|
-
# @param content_type [String] The kind of Document
|
22
|
-
# @param doc_name [String] The name of the Document
|
23
|
-
# @param rev_id [String] The id of the Rev this Document belongs to
|
24
|
-
#
|
25
|
-
# @return [String] The id of the Document
|
26
|
-
#
|
27
|
-
def self.create_doc(blob, content_type, doc_name, has_diff, rev_id)
|
28
|
-
blob = "That's all folks?" if blob.nil? || blob.strip.empty?
|
29
|
-
doc_name = 'Empty Doc' if doc_name.nil? || doc_name.strip.empty?
|
30
|
-
has_diff = false if has_diff.nil?
|
31
|
-
|
32
|
-
if content_type.nil? || content_type.strip.empty?
|
33
|
-
content_type = 'plain text'
|
34
|
-
end
|
35
|
-
|
36
|
-
if rev_id.length < 25
|
37
|
-
raise Reivt::GraphQLValidationException, 'Missing rev id'
|
38
|
-
end
|
39
|
-
|
40
|
-
result = CLIENT.query(CreateDocumentMutation, variables: {
|
41
|
-
blob: blob, content_type: content_type,
|
42
|
-
doc_name: doc_name, has_diff: has_diff,
|
43
|
-
rev_id: rev_id
|
44
|
-
})
|
45
|
-
data = RevAPI.retrieve(result)
|
46
|
-
|
47
|
-
data.createDocument.id
|
48
|
-
end
|
49
|
-
end
|
50
|
-
end
|
1
|
+
# An extension of our main module Revit
|
2
|
+
#
|
3
|
+
# @author [brwnrclse]
|
4
|
+
#
|
5
|
+
module Reivt
|
6
|
+
# An extension of the RevAPI module
|
7
|
+
#
|
8
|
+
# @author [brwnrclse]
|
9
|
+
#
|
10
|
+
module RevAPI
|
11
|
+
CreateDocumentMutation = CLIENT.parse <<-'GRAPHQL'
|
12
|
+
mutation($blob: String!, $content_type: String!, $doc_name: String!, $has_diff: Boolean!, $rev_id: ID!) {
|
13
|
+
createDocument(blob: $blob, contentType: $content_type, name: $doc_name, hasDiff: $has_diff, revId: $rev_id) {
|
14
|
+
id
|
15
|
+
}
|
16
|
+
}
|
17
|
+
GRAPHQL
|
18
|
+
|
19
|
+
# API call to createDocument
|
20
|
+
# @param blob [String] The contents of the Document
|
21
|
+
# @param content_type [String] The kind of Document
|
22
|
+
# @param doc_name [String] The name of the Document
|
23
|
+
# @param rev_id [String] The id of the Rev this Document belongs to
|
24
|
+
#
|
25
|
+
# @return [String] The id of the Document
|
26
|
+
#
|
27
|
+
def self.create_doc(blob, content_type, doc_name, has_diff, rev_id)
|
28
|
+
blob = "That's all folks?" if blob.nil? || blob.strip.empty?
|
29
|
+
doc_name = 'Empty Doc' if doc_name.nil? || doc_name.strip.empty?
|
30
|
+
has_diff = false if has_diff.nil?
|
31
|
+
|
32
|
+
if content_type.nil? || content_type.strip.empty?
|
33
|
+
content_type = 'plain text'
|
34
|
+
end
|
35
|
+
|
36
|
+
if rev_id.length < 25
|
37
|
+
raise Reivt::GraphQLValidationException, 'Missing rev id'
|
38
|
+
end
|
39
|
+
|
40
|
+
result = CLIENT.query(CreateDocumentMutation, variables: {
|
41
|
+
blob: blob, content_type: content_type,
|
42
|
+
doc_name: doc_name, has_diff: has_diff,
|
43
|
+
rev_id: rev_id
|
44
|
+
})
|
45
|
+
data = RevAPI.retrieve(result)
|
46
|
+
|
47
|
+
data.createDocument.id
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -1,36 +1,36 @@
|
|
1
|
-
# An extension of our main module
|
2
|
-
#
|
3
|
-
# @author [brwnrclse]
|
4
|
-
#
|
5
|
-
module Reivt
|
6
|
-
# An extension of the RevAPI module
|
7
|
-
#
|
8
|
-
# @author [brwnrclse]
|
9
|
-
#
|
10
|
-
module RevAPI
|
11
|
-
DeleteDocumentMutation = CLIENT.parse <<-'GRAPHQL'
|
12
|
-
mutation($id: ID!) {
|
13
|
-
deleteDocument(id: $id) {
|
14
|
-
id
|
15
|
-
}
|
16
|
-
}
|
17
|
-
GRAPHQL
|
18
|
-
|
19
|
-
# API call to deleteDocument
|
20
|
-
# @param id [String] The unique identifier of the Document
|
21
|
-
#
|
22
|
-
# @return [String, RevAPI::GraphQLValidationError] The id of the deleted
|
23
|
-
# Document or an error
|
24
|
-
#
|
25
|
-
def self.delete_doc(id)
|
26
|
-
if id.length < 25
|
27
|
-
raise raise Reivt::GraphQLValidationException, 'Missing id to delete'
|
28
|
-
end
|
29
|
-
|
30
|
-
result = CLIENT.query(DeleteDocumentMutation, variables: { id: id })
|
31
|
-
data = RevAPI.retrieve(result)
|
32
|
-
|
33
|
-
data.deleteDocument.id
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
1
|
+
# An extension of our main module
|
2
|
+
#
|
3
|
+
# @author [brwnrclse]
|
4
|
+
#
|
5
|
+
module Reivt
|
6
|
+
# An extension of the RevAPI module
|
7
|
+
#
|
8
|
+
# @author [brwnrclse]
|
9
|
+
#
|
10
|
+
module RevAPI
|
11
|
+
DeleteDocumentMutation = CLIENT.parse <<-'GRAPHQL'
|
12
|
+
mutation($id: ID!) {
|
13
|
+
deleteDocument(id: $id) {
|
14
|
+
id
|
15
|
+
}
|
16
|
+
}
|
17
|
+
GRAPHQL
|
18
|
+
|
19
|
+
# API call to deleteDocument
|
20
|
+
# @param id [String] The unique identifier of the Document
|
21
|
+
#
|
22
|
+
# @return [String, RevAPI::GraphQLValidationError] The id of the deleted
|
23
|
+
# Document or an error
|
24
|
+
#
|
25
|
+
def self.delete_doc(id)
|
26
|
+
if id.length < 25
|
27
|
+
raise raise Reivt::GraphQLValidationException, 'Missing id to delete'
|
28
|
+
end
|
29
|
+
|
30
|
+
result = CLIENT.query(DeleteDocumentMutation, variables: { id: id })
|
31
|
+
data = RevAPI.retrieve(result)
|
32
|
+
|
33
|
+
data.deleteDocument.id
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|
@@ -1,38 +1,38 @@
|
|
1
|
-
# An extension of our main module
|
2
|
-
#
|
3
|
-
# @author [brwnrclse]
|
4
|
-
#
|
5
|
-
module Reivt
|
6
|
-
# An extension of the RevAPI module
|
7
|
-
#
|
8
|
-
# @author [brwnrclse]
|
9
|
-
#
|
10
|
-
module RevAPI
|
11
|
-
CreateRevMutation = CLIENT.parse <<-'GRAPHQL'
|
12
|
-
mutation($description: String!, $title: String!, $user_id: ID!) {
|
13
|
-
createRev(description: $description, title: $title, userId: $user_id) {
|
14
|
-
id
|
15
|
-
}
|
16
|
-
}
|
17
|
-
GRAPHQL
|
18
|
-
|
19
|
-
# API call to createRev
|
20
|
-
# @param description [String] What the Rev is about
|
21
|
-
# @param title [String] The name of the Rev
|
22
|
-
#
|
23
|
-
# @return [String] The id of the created Rev
|
24
|
-
#
|
25
|
-
def self.create_rev(description, title)
|
26
|
-
description = 'Some rev' if description.nil? || description.strip.empty?
|
27
|
-
title = 'A rev, right?' if title.nil? || title.strip.empty?
|
28
|
-
|
29
|
-
result = CLIENT.query(RevAPI::CreateRevMutation, variables: {
|
30
|
-
description: description, title: title,
|
31
|
-
user_id: RevAPI::ID_TOKEN
|
32
|
-
})
|
33
|
-
data = RevAPI.retrieve(result)
|
34
|
-
|
35
|
-
data.createRev.id
|
36
|
-
end
|
37
|
-
end
|
38
|
-
end
|
1
|
+
# An extension of our main module
|
2
|
+
#
|
3
|
+
# @author [brwnrclse]
|
4
|
+
#
|
5
|
+
module Reivt
|
6
|
+
# An extension of the RevAPI module
|
7
|
+
#
|
8
|
+
# @author [brwnrclse]
|
9
|
+
#
|
10
|
+
module RevAPI
|
11
|
+
CreateRevMutation = CLIENT.parse <<-'GRAPHQL'
|
12
|
+
mutation($description: String!, $title: String!, $user_id: ID!) {
|
13
|
+
createRev(description: $description, title: $title, userId: $user_id) {
|
14
|
+
id
|
15
|
+
}
|
16
|
+
}
|
17
|
+
GRAPHQL
|
18
|
+
|
19
|
+
# API call to createRev
|
20
|
+
# @param description [String] What the Rev is about
|
21
|
+
# @param title [String] The name of the Rev
|
22
|
+
#
|
23
|
+
# @return [String] The id of the created Rev
|
24
|
+
#
|
25
|
+
def self.create_rev(description, title)
|
26
|
+
description = 'Some rev' if description.nil? || description.strip.empty?
|
27
|
+
title = 'A rev, right?' if title.nil? || title.strip.empty?
|
28
|
+
|
29
|
+
result = CLIENT.query(RevAPI::CreateRevMutation, variables: {
|
30
|
+
description: description, title: title,
|
31
|
+
user_id: RevAPI::ID_TOKEN
|
32
|
+
})
|
33
|
+
data = RevAPI.retrieve(result)
|
34
|
+
|
35
|
+
data.createRev.id
|
36
|
+
end
|
37
|
+
end
|
38
|
+
end
|
@@ -1,36 +1,36 @@
|
|
1
|
-
# An extension of our main module Revit
|
2
|
-
#
|
3
|
-
# @author [brwnrclse]
|
4
|
-
#
|
5
|
-
module Reivt
|
6
|
-
# An extension of the RevAPI module
|
7
|
-
#
|
8
|
-
# @author [brwnrclse]
|
9
|
-
#
|
10
|
-
module RevAPI
|
11
|
-
DeleteRevMutation = CLIENT.parse <<-'GRAPHQL'
|
12
|
-
mutation($id: ID!) {
|
13
|
-
deleteRev(id: $id) {
|
14
|
-
id
|
15
|
-
}
|
16
|
-
}
|
17
|
-
GRAPHQL
|
18
|
-
|
19
|
-
# API call to deleteRev
|
20
|
-
# @param id [String] The unique identifier of the Rev
|
21
|
-
#
|
22
|
-
# @return [String, RevAPI::GraphQLValidationError] The id of the deleted Rev
|
23
|
-
# or an error
|
24
|
-
#
|
25
|
-
def self.delete_rev(id)
|
26
|
-
if id.length < 25
|
27
|
-
raise Reivt::GraphQLValidationException, 'Missing id to delete'
|
28
|
-
end
|
29
|
-
|
30
|
-
result = CLIENT.query(RevAPI::DeleteRevMutation, variables: { id: id })
|
31
|
-
data = RevAPI.retrieve(result)
|
32
|
-
|
33
|
-
data.deleteRev.id
|
34
|
-
end
|
35
|
-
end
|
36
|
-
end
|
1
|
+
# An extension of our main module Revit
|
2
|
+
#
|
3
|
+
# @author [brwnrclse]
|
4
|
+
#
|
5
|
+
module Reivt
|
6
|
+
# An extension of the RevAPI module
|
7
|
+
#
|
8
|
+
# @author [brwnrclse]
|
9
|
+
#
|
10
|
+
module RevAPI
|
11
|
+
DeleteRevMutation = CLIENT.parse <<-'GRAPHQL'
|
12
|
+
mutation($id: ID!) {
|
13
|
+
deleteRev(id: $id) {
|
14
|
+
id
|
15
|
+
}
|
16
|
+
}
|
17
|
+
GRAPHQL
|
18
|
+
|
19
|
+
# API call to deleteRev
|
20
|
+
# @param id [String] The unique identifier of the Rev
|
21
|
+
#
|
22
|
+
# @return [String, RevAPI::GraphQLValidationError] The id of the deleted Rev
|
23
|
+
# or an error
|
24
|
+
#
|
25
|
+
def self.delete_rev(id)
|
26
|
+
if id.length < 25
|
27
|
+
raise Reivt::GraphQLValidationException, 'Missing id to delete'
|
28
|
+
end
|
29
|
+
|
30
|
+
result = CLIENT.query(RevAPI::DeleteRevMutation, variables: { id: id })
|
31
|
+
data = RevAPI.retrieve(result)
|
32
|
+
|
33
|
+
data.deleteRev.id
|
34
|
+
end
|
35
|
+
end
|
36
|
+
end
|