apidragon 0.1.2 → 1.0.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: fec85c3dec05adc4610466d4cf18a88b786a6ac1
4
- data.tar.gz: b4e3ab3c86cf633462cf87719c9b3adb19452de2
3
+ metadata.gz: 38f447a14c74741ccc26b5d641ac6bf3be90315f
4
+ data.tar.gz: 6a320529e79a2f3e3816a1e3224629d2d5e38fc1
5
5
  SHA512:
6
- metadata.gz: 32167d48c82cac4d80741c6422a398767cc8d95e57b7b9cefade40205fa43a300c8c55c1a4dbe1838ab71f8f8f39a1987f1009d0cb54619e2f3f504185d4bd62
7
- data.tar.gz: 2a72e5d923f58e0bdac9a77d4f69a06dc512fb658c99beb2eec50540c8ec147b09ed100f17eab94f0a87d3321cb7b720558ad4bf2b8a59d7b47030dd718026a7
6
+ metadata.gz: 1d403ce82e3d9a20be2837ed6b9b0dd2021008d3a7434a3d4e226dee06d8a30f6c122996d35d13149c1234cf060199f88e7804913e37ed853c837a63cf270e53
7
+ data.tar.gz: 761f6f6613eeca86d341b3ef4f478c26ba0c444f6118a2d130b6465a1ecbb79048486a66ad47246a0489a2aa7cbaba17741cf6f9d2ffd151ced1c715961cea6a
data/.gitignore CHANGED
@@ -1,4 +1,10 @@
1
- unit_test_log.txt
2
1
  config.yaml
3
- api_structure.yaml
4
- logic.yaml
2
+ .document
3
+ apidragon.gemspec
4
+ Gemfile
5
+ Gemfile.lock
6
+ README.rdoc
7
+ Rakefile
8
+ VERSION
9
+ /test/*
10
+ /pkg/*
data/README.md CHANGED
@@ -1,8 +1,8 @@
1
- # apidragon: an Automated API Framework
1
+ # apidragon: an Api Interaction Automation Framework
2
2
 
3
3
  These classes run a sequence of API calls using a configuration file.
4
- - config.yaml is read and vars are dumped into an `arg_bucket`
5
- - macros can specified in the config and run as commands
4
+ - config file is read and `vars` are dumped into an `arg_bucket`
5
+ - `macros` are specified in the config and can be run from the command line
6
6
 
7
7
  # Requirements:
8
8
  - Ruby > 2.0
@@ -10,36 +10,44 @@ These classes run a sequence of API calls using a configuration file.
10
10
 
11
11
  # How to Use:
12
12
 
13
- - Clone the Repo
14
- - Create `config.yaml` according to the examples below
15
- - Run from the command line with `./apidragon do [command]`
16
- `command` is the name of a macro defined in the config file.
13
+ - `gem install apidragon`
14
+ - Create `/tmp/apidragonconf.yaml` according to the examples below
15
+ - Run from the command line with `apidragon do [command]`
16
+ `[command]` is the name of one of the `macros` defined in the config file. So if I was using the config in the example,
17
+ I could run `apidragon do macro_1`, which would then call `testcall` and `testcall2` in the order specified.
17
18
 
18
19
  # Configuration:
19
- Create `config.yaml`. Can contain any variable you need to access the API you are using.
20
- - config.yaml:
20
+ Create `/tmp/apidragonconf.yaml`. It can contain any variables you need to access the API you are using, as well as `macros`.
21
+ - Example config:
21
22
  ```yaml
22
23
  ---
23
24
  vars:
24
25
  test: value
25
26
  username: bob
26
- password: saget
27
+ password: mypassword
27
28
  id: 123456abcdef
28
29
  macros:
29
30
  macro_1:
30
31
  testcall:
31
- function: username:password@test.net/api
32
+ function: username:password@test.net/api/test.do
32
33
  input:
33
34
  - id
34
35
  output:
35
- - status
36
+ - tablename
37
+ mode: get
38
+ testcall2:
39
+ function: username:password@test.net/api/test2.do
40
+ input:
41
+ - tablename
42
+ output:
43
+ - tablecontents
36
44
  mode: get
37
45
  ```
38
46
 
39
47
  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`.
40
48
 
41
49
  # Request modes
42
- Currently support modes:
50
+ Currently supported modes:
43
51
  - `get`
44
52
  - `post`
45
53
  - `curl_get` (uses curl instead of the `rest-client` gem for special cases)
@@ -49,21 +57,27 @@ Planned: `put`, `delete`, `curl_post`, `curl_put`, `curl_delete`
49
57
  # Further Options
50
58
  Each call can have a `record` option, where you can specify what output variables you want to record to your config.
51
59
 
52
- e.g.:
60
+ - e.g.:
53
61
  ```yaml
54
62
  testcall:
55
63
  output:
56
64
  - id
65
+ - userinfo
57
66
  record:
58
67
  - id
59
68
  ```
60
69
 
61
70
  Further, 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.
62
71
 
63
- e.g.
72
+ - e.g.:
64
73
  ```yaml
65
74
  testcall:
66
75
  output:
67
76
  - id: username
77
+ - userinfo
68
78
  ```
69
79
  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.
80
+
81
+ #License
82
+
83
+ [MIT](https://tldrlegal.com/license/mit-license)
data/README.rdoc CHANGED
@@ -1,6 +1,6 @@
1
1
  = apidragon
2
2
 
3
- Description goes here.
3
+ See main Github page for a description.
4
4
 
5
5
  == Contributing to apidragon
6
6
 
@@ -12,8 +12,4 @@ Description goes here.
12
12
  * Make sure to add tests for it. This is important so I don't break it in a future version unintentionally.
13
13
  * Please try not to mess with the Rakefile, version, or history. If you want to have your own version, or is otherwise necessary, that is fine, but please isolate to its own commit so I can cherry-pick around it.
14
14
 
15
- == Copyright
16
-
17
- Copyright (c) 2015 isand3r. See LICENSE.txt for
18
- further details.
19
15
 
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.1.2
1
+ 1.0.0
data/apidragon.gemspec CHANGED
@@ -2,11 +2,11 @@
2
2
  # DO NOT EDIT THIS FILE DIRECTLY
3
3
  # Instead, edit Jeweler::Tasks in Rakefile, and run 'rake gemspec'
4
4
  # -*- encoding: utf-8 -*-
5
- # stub: apidragon 0.1.2 ruby lib
5
+ # stub: apidragon 1.0.0 ruby lib
6
6
 
7
7
  Gem::Specification.new do |s|
8
8
  s.name = "apidragon"
9
- s.version = "0.1.2"
9
+ s.version = "1.0.0"
10
10
 
11
11
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
12
12
  s.require_paths = ["lib"]
@@ -21,7 +21,6 @@ Gem::Specification.new do |s|
21
21
  "README.rdoc"
22
22
  ]
23
23
  s.files = [
24
- ".document",
25
24
  ".gitignore",
26
25
  "Gemfile",
27
26
  "Gemfile.lock",
@@ -46,18 +46,26 @@ class Call < ArgBucket
46
46
  puts "making a get: #{@function} with #{@input}"
47
47
  @response = RestClient.get @function, params: @input
48
48
  when 'post'
49
- puts 'making a post'
49
+ puts "making a post: #{@function} with #{@input}"
50
50
  @response = RestClient.post @function, params: @input
51
51
  when 'put'
52
- puts 'making a put'
52
+ puts "making a put: #{@function} with #{@input}"
53
+ @response = RestClient.put @function, params: @input
53
54
  when 'delete'
54
- puts 'making a delete'
55
+ puts "making a delete: #{@function} with #{@input}"
56
+ @response = RestClient.delete @function, params: @input
55
57
  when 'curl_get'
56
58
  command = "curl --url #{@function}"
57
59
  @input.each_pair do |key, value|
58
60
  command << " -F #{key}='#{value}'"
59
61
  end
60
62
  @response = `#{command}`
63
+ when 'curl_post'
64
+ command = "curl -X POST --url #{@function}"
65
+ @input.each_pair do |key, value|
66
+ command << " -F #{key}='#{value}'"
67
+ end
68
+ @response = `#{command}`
61
69
  else
62
70
  puts "#{@mode} not supported."
63
71
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: apidragon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 1.0.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - isaiah thiessen
@@ -244,7 +244,6 @@ extra_rdoc_files:
244
244
  - README.md
245
245
  - README.rdoc
246
246
  files:
247
- - ".document"
248
247
  - ".gitignore"
249
248
  - Gemfile
250
249
  - Gemfile.lock
data/.document DELETED
@@ -1,5 +0,0 @@
1
- lib/**/*.rb
2
- bin/*
3
- -
4
- features/**/*.feature
5
- LICENSE.txt