Birst_Command 0.1.1 → 0.2.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 +4 -4
- data/README.md +42 -14
- data/bin/birstcl +76 -0
- data/doc/roadmap.md +7 -0
- data/lib/birst_command/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 58f9b1e8e6efa926c798dce89e9135c72faa9899
|
4
|
+
data.tar.gz: bdac960c6a738e563bec501a64adf03bd7eae28b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: f7d27fb486170d53a80d6bf946672d2f71cb8e29ed2c292827452f35fb1c21789c6a894816d72dd959b5f06301d7c4da606440dbc6f1bd5c31a89ea8d3c51bf2
|
7
|
+
data.tar.gz: 144d996dd5e0bd9fbd8d73bdd0cfa70a5345371a85084b2fef7ea321f5964e710e0a870c366aacc83c02181135768b1548fb688987806e3a77f91505818763fb
|
data/README.md
CHANGED
@@ -1,17 +1,20 @@
|
|
1
1
|
Birst_Command
|
2
2
|
====================
|
3
3
|
|
4
|
-
Birst Command is a Ruby gem that allows you to build Ruby scripts that
|
5
|
-
with the Birst Web API.
|
4
|
+
Birst Command is a Ruby gem that allows you to build Ruby scripts that
|
5
|
+
interface with the Birst Web API.
|
6
6
|
|
7
|
+
Note: this is not an officially-sanctioned Birst project. I'm just a
|
8
|
+
Birst user that needed to set up a very basic Ruby interface.
|
7
9
|
|
8
10
|
# Installation & Setup
|
9
11
|
|
10
12
|
Install the gem using `gem install Birst_Command` or using rvm or
|
11
13
|
rbenv/bundler as you prefer.
|
12
14
|
|
13
|
-
After installing, you'll need to create a Birst Command config file
|
14
|
-
the credentials you'll use to connect to Birst. This
|
15
|
+
After installing, you'll need to create a Birst Command config file
|
16
|
+
that contains the credentials you'll use to connect to Birst. This
|
17
|
+
config file should look like,
|
15
18
|
|
16
19
|
{
|
17
20
|
"wsdl": "https://login.bws.birst.com/CommandWebService.asmx?WSDL",
|
@@ -20,10 +23,10 @@ the credentials you'll use to connect to Birst. This config file should look li
|
|
20
23
|
"password": "obfuscated pwd"
|
21
24
|
}
|
22
25
|
|
23
|
-
Most users should only need to modify the username and password.
|
24
|
-
aversion to storing passwords in plaintext, the
|
25
|
-
be an obfuscated password. Birst
|
26
|
-
executed via
|
26
|
+
Most users should only need to modify the username and password.
|
27
|
+
Since I have a strong aversion to storing passwords in plaintext, the
|
28
|
+
password in the config file needs to be an obfuscated password. Birst
|
29
|
+
Command comes with a password obfuscator that can be executed via
|
27
30
|
|
28
31
|
$ obfuscate_pwd.rb mypassword
|
29
32
|
0x8GOZ5nA3oRSSS8ao1l6Q==
|
@@ -33,8 +36,32 @@ to a secure location**. If any attacker is able to get your
|
|
33
36
|
obfuscated password and knows it was created using this program, it
|
34
37
|
would be trivial to get your Birst login credentials.
|
35
38
|
|
39
|
+
# Usage - Command-line tool
|
36
40
|
|
37
|
-
|
41
|
+
Birst Command also installs a rudimentary command line tool for interacting
|
42
|
+
with the Birst web API. It's still very simple. If you want more functionality,
|
43
|
+
please drop me a line in the github repository.
|
44
|
+
|
45
|
+
To use the command line tool, put the config file created above in
|
46
|
+
$HOME/.birstcl. Then run Birst commands using `birstcl`. You'll have to refer
|
47
|
+
to the [Birst Documentation](https://app2102.bws.birst.com/CommandWebService.asmx)
|
48
|
+
for a full list of commands. All birst commands should be submitted using snake_case
|
49
|
+
and arguments using the exact camelCase specified in the Birst documentation. See
|
50
|
+
below for an explanation of this bizarre requirement. Here are some examples:
|
51
|
+
|
52
|
+
List spaces
|
53
|
+
|
54
|
+
birstcl -c list_spaces
|
55
|
+
|
56
|
+
Get list of sources for a space
|
57
|
+
|
58
|
+
birstcl -c get_sources_list -a '{ spaceID: "383nf0d7-3875-3829-3hff-faba8936180a" }'
|
59
|
+
|
60
|
+
Copy space with options
|
61
|
+
|
62
|
+
birstcl -c copy_space -a '{ spFromID: "9ab9865c-37a8-0586-e856-ddd3856a0371", spToID: "3957a9b7-38c1-175v-3985-1957f1836a93", mode: "replicate", options: "data;repository;settings-basic" }'
|
63
|
+
|
64
|
+
# Usage - As Ruby library
|
38
65
|
|
39
66
|
In your Ruby program, include the Birst Command gem and load the config file via
|
40
67
|
|
@@ -44,9 +71,10 @@ In your Ruby program, include the Birst Command gem and load the config file via
|
|
44
71
|
|
45
72
|
Birst_Command::Config.read_config(File.join(File.dirname(__FILE__),"config.json"))
|
46
73
|
|
47
|
-
Birst commands are submitted in session blocks, which automatically
|
48
|
-
process of logging in, tracking the login token, and
|
49
|
-
to list all spaces that you have rights to,
|
74
|
+
Birst commands are submitted in session blocks, which automatically
|
75
|
+
perform the process of logging in, tracking the login token, and
|
76
|
+
logging out. For example, to list all spaces that you have rights to,
|
77
|
+
you can submit the following code
|
50
78
|
|
51
79
|
Birst_Command::Session.start do |bc|
|
52
80
|
spaces = bc.list_spaces
|
@@ -101,8 +129,8 @@ provides the basic interface.
|
|
101
129
|
|
102
130
|
## Command arguments
|
103
131
|
|
104
|
-
Some Birst API commands require arguments. All arguments are supplied
|
105
|
-
hash. For example, to create a new space,
|
132
|
+
Some Birst API commands require arguments. All arguments are supplied
|
133
|
+
as an argument hash. For example, to create a new space,
|
106
134
|
|
107
135
|
Birst_Command::Session.start do |bc|
|
108
136
|
new_space_id = bc.create_new_space :spaceName => "myNewSpace",
|
data/bin/birstcl
ADDED
@@ -0,0 +1,76 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
# FOR TESTING ONLY
|
4
|
+
$LOAD_PATH << File.join(File.dirname(__FILE__),"../lib")
|
5
|
+
require 'rubygems'
|
6
|
+
require 'bundler/setup'
|
7
|
+
# REMOVE THE ABOVE
|
8
|
+
|
9
|
+
require "birst_command"
|
10
|
+
require "optparse"
|
11
|
+
|
12
|
+
module BirstCL
|
13
|
+
extend self
|
14
|
+
|
15
|
+
def set_options
|
16
|
+
@options = {}
|
17
|
+
|
18
|
+
OptionParser.new do |opts|
|
19
|
+
opts.banner = "Usage: birstcl -c <COMMAND> -a <ARGUMENTS>"
|
20
|
+
|
21
|
+
opts.on("--verbose", "--[no-]verbose", "Run verbosely") do |v|
|
22
|
+
@options[:verbose] = v
|
23
|
+
end
|
24
|
+
|
25
|
+
opts.on("-h","--help", "Show this message") do
|
26
|
+
puts opts
|
27
|
+
exit
|
28
|
+
end
|
29
|
+
|
30
|
+
@options[:command] = nil
|
31
|
+
opts.on("-c","--command <COMMAND>","COMMAND is the snake_case Birst web API command") do |opt|
|
32
|
+
@options[:command] = opt
|
33
|
+
end
|
34
|
+
|
35
|
+
@options[:arguments] = {}
|
36
|
+
opts.on("-a","--args <ARGUMNETS>","ARGUMENTS is a JSON string of arguments to COMMAND") do |opt|
|
37
|
+
@options[:arguments] = eval(opt)
|
38
|
+
end
|
39
|
+
|
40
|
+
=begin
|
41
|
+
@options[:json_full_path] = nil
|
42
|
+
opts.on("-f","--file <JSON FILE>","Path to JSON file containing command") do |opt|
|
43
|
+
@options[:json_full_path] = opt
|
44
|
+
end
|
45
|
+
=end
|
46
|
+
|
47
|
+
@options[:config_full_path] = "#{ENV['HOME']}/.birstcl"
|
48
|
+
opts.on("-s","--config_file <CONFIG FILE>", "Path to config file containing credentials (default: $HOME/.birstcl)") do |opt|
|
49
|
+
@options[:config_full_path] = opt
|
50
|
+
end
|
51
|
+
end.parse!
|
52
|
+
end
|
53
|
+
|
54
|
+
|
55
|
+
def read_config_file
|
56
|
+
Birst_Command::Config.read_config(@options[:config_full_path])
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
def execute_command
|
61
|
+
output = {}
|
62
|
+
|
63
|
+
output[:command] = @options[:command]
|
64
|
+
output[:arguments] = @options[:arguments]
|
65
|
+
Birst_Command::Session.start do |bc|
|
66
|
+
output[:token] = bc.token
|
67
|
+
output[:auth_cookies] = bc.auth_cookies.inspect
|
68
|
+
output[:result] = bc.send(@options[:command], @options[:arguments])
|
69
|
+
end
|
70
|
+
puts "#{JSON.pretty_generate output}"
|
71
|
+
end
|
72
|
+
end
|
73
|
+
|
74
|
+
BirstCL.set_options
|
75
|
+
BirstCL.read_config_file
|
76
|
+
BirstCL.execute_command
|
data/doc/roadmap.md
ADDED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: Birst_Command
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sterling Paramore
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2014-
|
11
|
+
date: 2014-04-11 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: savon
|
@@ -42,6 +42,7 @@ description: Ruby interface to Birst web API
|
|
42
42
|
email:
|
43
43
|
- gnilrets@gmail.com
|
44
44
|
executables:
|
45
|
+
- birstcl
|
45
46
|
- obfuscate_pwd.rb
|
46
47
|
extensions: []
|
47
48
|
extra_rdoc_files: []
|
@@ -54,8 +55,10 @@ files:
|
|
54
55
|
- LICENSE
|
55
56
|
- README.md
|
56
57
|
- Rakefile
|
58
|
+
- bin/birstcl
|
57
59
|
- bin/obfuscate_pwd.rb
|
58
60
|
- config.json_template
|
61
|
+
- doc/roadmap.md
|
59
62
|
- lib/birst_command.rb
|
60
63
|
- lib/birst_command/config.rb
|
61
64
|
- lib/birst_command/obfuscate.rb
|