apidragon 1.7.1 → 1.8.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +17 -16
- data/VERSION +1 -1
- data/lib/apidragon/macro.rb +3 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 1de8fae6340edefe1ca62386a59ca280c7f4e111
|
4
|
+
data.tar.gz: 4427de169637fa9f512dab70817bbd675cabeac9
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f0ec4f7ba1f196c40c32f87c0665a2f2a53e5e6372bad312a54e58176ec8b0fd5d94866eadb8d1cee39b90fcc0190fcb41164f8b4c1a39df4e195d52f379427
|
7
|
+
data.tar.gz: 142398cb7758a0b73437236d6bba0b70ea73948db60011be7336c16565a8dd7ca1fe5d791c406b4dd02d2e19504bab0d919a8466ea5d17780d22fc0cd145b9f4
|
data/README.md
CHANGED
@@ -1,15 +1,15 @@
|
|
1
|
-
|
1
|
+
## apidragon: an Api Interaction Automation Framework
|
2
2
|
[![Code Climate](https://codeclimate.com/github/isand3r/apidragon/badges/gpa.svg)](https://codeclimate.com/github/isand3r/apidragon)
|
3
3
|
|
4
4
|
These classes run a sequence of API calls using a configuration file.
|
5
5
|
- config file is read and `vars` are dumped into an `arg_bucket`
|
6
6
|
- `macros` are specified in the config and can be run from the command line
|
7
7
|
|
8
|
-
|
8
|
+
## Requirements:
|
9
9
|
- Ruby > 2.0
|
10
10
|
- Gems: `json`, `active_support`, `psych`, `rest-client`
|
11
11
|
|
12
|
-
|
12
|
+
## How to Use:
|
13
13
|
|
14
14
|
- `gem install apidragon`
|
15
15
|
- Create `apidragonconf.yaml` according to the examples below
|
@@ -19,7 +19,7 @@ I could run `apidragon do macro_1`, which would then call `testcall` and `testca
|
|
19
19
|
- You can specify your own config file path by running `apidragon do [command] --config [filepath]`
|
20
20
|
- You can specify you password or username from the command line with `apidragon do [command] --username [username] --password [password]` (recommended if you don't want to store credentials in a file)
|
21
21
|
|
22
|
-
|
22
|
+
## Configuration:
|
23
23
|
Create `apidragonconf.yaml`. It can contain any variables you need to access the API you are using, as well as `macros`.
|
24
24
|
- Example config:
|
25
25
|
```yaml
|
@@ -49,7 +49,7 @@ Create `apidragonconf.yaml`. It can contain any variables you need to access the
|
|
49
49
|
|
50
50
|
Each macro can have `n` number of calls like `testcall` in the example, each requiring a `function`, the necessary `input` and `output` variables, and the request `mode`.
|
51
51
|
|
52
|
-
|
52
|
+
## Request modes
|
53
53
|
Currently supported modes:
|
54
54
|
- `get`
|
55
55
|
- `post`
|
@@ -59,15 +59,15 @@ Currently supported modes:
|
|
59
59
|
- `plugin`
|
60
60
|
- Planned: `curl_put`, `curl_delete`
|
61
61
|
|
62
|
-
|
62
|
+
### get, post, put, delete
|
63
63
|
|
64
64
|
Makes an api call using the respective HTTP verb through the rest-client gem.
|
65
65
|
|
66
|
-
|
66
|
+
### curl_get, curl_post
|
67
67
|
|
68
68
|
Makes an api call using the respective HTTP verb through curl.
|
69
69
|
|
70
|
-
|
70
|
+
### plugin
|
71
71
|
|
72
72
|
Evaluates the given line of ruby code through `eval()`.
|
73
73
|
- e.g.:
|
@@ -100,9 +100,9 @@ Notes: Filename and classname are arbitrary but should be the same as each other
|
|
100
100
|
{"test" => "test"}
|
101
101
|
```
|
102
102
|
|
103
|
-
|
103
|
+
## Further Options
|
104
104
|
|
105
|
-
|
105
|
+
### stdout
|
106
106
|
Setting `stdout: true` for any call will ouput its response to STDOUT. Defaults to false.
|
107
107
|
- e.g.:
|
108
108
|
```yaml
|
@@ -110,7 +110,7 @@ Setting `stdout: true` for any call will ouput its response to STDOUT. Defaults
|
|
110
110
|
stdout: true
|
111
111
|
```
|
112
112
|
|
113
|
-
|
113
|
+
### record
|
114
114
|
Each call can have a `record` option, where you can specify what output variables you want to record to your config.
|
115
115
|
|
116
116
|
- e.g.:
|
@@ -123,7 +123,7 @@ Each call can have a `record` option, where you can specify what output variable
|
|
123
123
|
- id
|
124
124
|
```
|
125
125
|
|
126
|
-
|
126
|
+
### Qualifier variables
|
127
127
|
apidragon automatically returns the first instance it finds of the specified output variable in the response.
|
128
128
|
|
129
129
|
For more specific output parsing, you can specify a qualifier variable. As long as responses are returned as `xml` or `json`, output variables can be associated with one of your pre-defined values for cases like parsing lists of values that have several attribute fields.
|
@@ -137,7 +137,7 @@ For more specific output parsing, you can specify a qualifier variable. As long
|
|
137
137
|
```
|
138
138
|
So if the call returns a list like this: `[{username => bob, id => 1234}, {username => alice, id => 5678}]`, you can always return the `id` associated with the `username` variable defined in the `vars` section.
|
139
139
|
|
140
|
-
|
140
|
+
### logging
|
141
141
|
Loggin can be disabled by specifying `logging` to be `false`, as per below.
|
142
142
|
|
143
143
|
- e.g.:
|
@@ -146,7 +146,7 @@ Loggin can be disabled by specifying `logging` to be `false`, as per below.
|
|
146
146
|
logging: false
|
147
147
|
```
|
148
148
|
|
149
|
-
|
149
|
+
### plugin
|
150
150
|
Note: The default folder for plugins is `/usr/local/apidragonplugins`. Create this folder and writing any plugin files to it usually requires root permissions.
|
151
151
|
Each call can refer to a plugin file. The Plugin class should follow the structure outlined below.
|
152
152
|
- e.g.:
|
@@ -169,9 +169,10 @@ Each call can refer to a plugin file. The Plugin class should follow the structu
|
|
169
169
|
```
|
170
170
|
|
171
171
|
|
172
|
-
|
172
|
+
## To-Do / Planned Features
|
173
173
|
- Ability to pass any variables as options at the command line
|
174
|
+
- Unit Tests
|
174
175
|
|
175
|
-
|
176
|
+
## License
|
176
177
|
|
177
178
|
[MIT](https://tldrlegal.com/license/mit-license)
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
1.
|
1
|
+
1.8.0
|
data/lib/apidragon/macro.rb
CHANGED
@@ -52,7 +52,9 @@ class Call < ArgBucket
|
|
52
52
|
when 'curl_post'
|
53
53
|
command = "curl -X POST --url #{@function}"
|
54
54
|
curl_request command
|
55
|
-
|
55
|
+
when 'curl_put'
|
56
|
+
command = "curl -X PUT --url #{@function} -d #{@data}"
|
57
|
+
curl_request command
|
56
58
|
when 'plugin'
|
57
59
|
Object.const_get(@plugin).new(@arg_bucket).run
|
58
60
|
else
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apidragon
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.8.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- isaiah thiessen
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2016-05-13 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: activesupport
|