api_pi 0.9 → 0.9.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/tests.yml +38 -0
- data/.gitignore +1 -0
- data/.ruby-version +1 -1
- data/Gemfile.lock +21 -16
- data/README.md +4 -6
- data/api_pi.gemspec +5 -5
- data/example/example.rb +16 -6
- data/lib/api_pi/dsl.rb +6 -6
- data/lib/api_pi/version.rb +1 -1
- data/logo/pi-logo.jpg +0 -0
- data/test/unit/test_assertions.rb +1 -1
- metadata +17 -16
- data/.travis.yml +0 -14
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ffac63a3f0f7ce1538044fa5336546effe59dc64b0a16a528761c80a740123c0
|
4
|
+
data.tar.gz: 146038c0ac9dd68fef685101c02370ab251cb7d77e3b2ab30af0a8013ba4a14d
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: cc1440f2f95e199ac892dcd5a1ccfac5075fccdbb0043dcdccb982bb183ace03dcde7c515d0a79cea21aad942405f0982cf07faecd50173c603172c01cf36c1b
|
7
|
+
data.tar.gz: 1b733e4953891974bcff398e7c7bb7b0d7346f64beb91f42861a5fa245a9893033f01c3db6386ecdbf54dc955a88883495a8f0a26d0c35d21864ea6be97e62d9
|
@@ -0,0 +1,38 @@
|
|
1
|
+
# This workflow uses actions that are not certified by GitHub.
|
2
|
+
# They are provided by a third-party and are governed by
|
3
|
+
# separate terms of service, privacy policy, and support
|
4
|
+
# documentation.
|
5
|
+
# This workflow will download a prebuilt Ruby version, install dependencies and run tests with Rake
|
6
|
+
# For more information see: https://github.com/marketplace/actions/setup-ruby-jruby-and-truffleruby
|
7
|
+
|
8
|
+
name: Tests
|
9
|
+
|
10
|
+
on:
|
11
|
+
push:
|
12
|
+
branches: [ "main" ]
|
13
|
+
pull_request:
|
14
|
+
branches: [ "main" ]
|
15
|
+
|
16
|
+
permissions:
|
17
|
+
contents: read
|
18
|
+
|
19
|
+
jobs:
|
20
|
+
test:
|
21
|
+
|
22
|
+
runs-on: ubuntu-latest
|
23
|
+
strategy:
|
24
|
+
matrix:
|
25
|
+
ruby-version: ['3.0']
|
26
|
+
|
27
|
+
steps:
|
28
|
+
- uses: actions/checkout@v4
|
29
|
+
- name: Set up Ruby
|
30
|
+
# To automatically get bug fixes and new Ruby versions for ruby/setup-ruby,
|
31
|
+
# change this to (see https://github.com/ruby/setup-ruby#versioning):
|
32
|
+
# uses: ruby/setup-ruby@v1
|
33
|
+
uses: ruby/setup-ruby@55283cc23133118229fd3f97f9336ee23a179fcf # v1.146.0
|
34
|
+
with:
|
35
|
+
ruby-version: ${{ matrix.ruby-version }}
|
36
|
+
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
|
37
|
+
- name: Run tests
|
38
|
+
run: bundle exec rake
|
data/.gitignore
CHANGED
data/.ruby-version
CHANGED
@@ -1 +1 @@
|
|
1
|
-
|
1
|
+
3.3.4
|
data/Gemfile.lock
CHANGED
@@ -1,35 +1,40 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
api_pi (0.
|
4
|
+
api_pi (0.9.3)
|
5
5
|
map (~> 6.6)
|
6
6
|
|
7
7
|
GEM
|
8
8
|
remote: https://rubygems.org/
|
9
9
|
specs:
|
10
|
-
addressable (2.7
|
11
|
-
public_suffix (>= 2.0.2, <
|
12
|
-
|
13
|
-
|
14
|
-
|
10
|
+
addressable (2.8.7)
|
11
|
+
public_suffix (>= 2.0.2, < 7.0)
|
12
|
+
bigdecimal (3.1.8)
|
13
|
+
crack (1.0.0)
|
14
|
+
bigdecimal
|
15
|
+
rexml
|
16
|
+
hashdiff (1.1.0)
|
15
17
|
map (6.6.0)
|
16
|
-
minitest (5.
|
17
|
-
public_suffix (
|
18
|
-
rake (13.
|
19
|
-
|
20
|
-
|
21
|
-
|
18
|
+
minitest (5.24.1)
|
19
|
+
public_suffix (6.0.0)
|
20
|
+
rake (13.2.1)
|
21
|
+
rexml (3.3.1)
|
22
|
+
strscan
|
23
|
+
strscan (3.1.0)
|
24
|
+
webmock (3.23.1)
|
25
|
+
addressable (>= 2.8.0)
|
22
26
|
crack (>= 0.3.2)
|
23
27
|
hashdiff (>= 0.4.0, < 2.0.0)
|
24
28
|
|
25
29
|
PLATFORMS
|
26
30
|
ruby
|
31
|
+
x86_64-darwin-21
|
27
32
|
|
28
33
|
DEPENDENCIES
|
29
34
|
api_pi!
|
30
|
-
minitest (~> 5.
|
31
|
-
rake (~> 13.
|
32
|
-
webmock (~> 3.
|
35
|
+
minitest (~> 5.24.1)
|
36
|
+
rake (~> 13.2.1)
|
37
|
+
webmock (~> 3.23.1)
|
33
38
|
|
34
39
|
BUNDLED WITH
|
35
|
-
|
40
|
+
2.5.15
|
data/README.md
CHANGED
@@ -1,10 +1,9 @@
|
|
1
1
|
# API P.I.
|
2
|
+
![API P.I.](https://raw.githubusercontent.com/benwoody/api_pi/main/logo/pi-logo.jpg)
|
2
3
|
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
An example test can be found in the example/ directory.
|
4
|
+
A ruby DSL to investigate and test JSON contracts.
|
5
|
+
----------
|
6
|
+
[![Tests](https://github.com/benwoody/api_pi/actions/workflows/tests.yml/badge.svg?branch=main)](https://github.com/benwoody/api_pi/actions/workflows/tests.yml)
|
8
7
|
|
9
8
|
## Install
|
10
9
|
|
@@ -212,4 +211,3 @@ To-Do
|
|
212
211
|
-----
|
213
212
|
|
214
213
|
* Ability to basic_auth before GET request
|
215
|
-
|
data/api_pi.gemspec
CHANGED
@@ -7,7 +7,7 @@ Gem::Specification.new do |g|
|
|
7
7
|
g.version = ApiPi::VERSION
|
8
8
|
|
9
9
|
g.summary = "API validation DSL"
|
10
|
-
g.description = "A ruby DSL to validate API requests."
|
10
|
+
g.description = "A ruby DSL to investigate and validate API requests."
|
11
11
|
|
12
12
|
g.authors = "Ben Woodall"
|
13
13
|
g.email = "mail@benwoodall.com"
|
@@ -16,10 +16,10 @@ Gem::Specification.new do |g|
|
|
16
16
|
g.test_files = `git ls-files -- test/*`.split("\n")
|
17
17
|
|
18
18
|
g.extra_rdoc_files = ["README.md"]
|
19
|
-
g.required_ruby_version = '>=
|
19
|
+
g.required_ruby_version = '>= 3.0'
|
20
20
|
|
21
21
|
g.add_dependency 'map', '~> 6.6'
|
22
|
-
g.add_development_dependency 'minitest', '~>5.
|
23
|
-
g.add_development_dependency 'webmock', '~> 3.
|
24
|
-
g.add_development_dependency 'rake', '~> 13.
|
22
|
+
g.add_development_dependency 'minitest', '~>5.24.1'
|
23
|
+
g.add_development_dependency 'webmock', '~> 3.23.1'
|
24
|
+
g.add_development_dependency 'rake', '~> 13.2.1'
|
25
25
|
end
|
data/example/example.rb
CHANGED
@@ -6,6 +6,21 @@ get "https://raw.githubusercontent.com/benwoody/api_pi/master/example/example.js
|
|
6
6
|
|
7
7
|
test "headers" do
|
8
8
|
response.code.is 200
|
9
|
+
response.header.has_key "contenttype"
|
10
|
+
end
|
11
|
+
|
12
|
+
test "metadata" do
|
13
|
+
response.body.results.is_a Hash
|
14
|
+
response.body.metadata.has_keys "totalCount", "totalPageCount"
|
15
|
+
response.body.metadata.totalCount.is_a Integer
|
16
|
+
response.body.metadata.totalPageCount.is_a Integer
|
17
|
+
end
|
18
|
+
|
19
|
+
test "results" do
|
20
|
+
response.body.results.is_a Hash
|
21
|
+
response.body.results.has_key "string"
|
22
|
+
response.body.results.lacks_key "nope"
|
23
|
+
response.body.results.has_keys "string", "int", "here", "array"
|
9
24
|
end
|
10
25
|
|
11
26
|
test "results.string" do
|
@@ -17,13 +32,8 @@ get "https://raw.githubusercontent.com/benwoody/api_pi/master/example/example.js
|
|
17
32
|
response.body.results.int.is_an Integer
|
18
33
|
end
|
19
34
|
|
20
|
-
test "results" do
|
21
|
-
response.body.results.has_key "string"
|
22
|
-
response.body.results.lacks_key "nope"
|
23
|
-
response.body.results.has_keys "string","int","here","array"
|
24
|
-
end
|
25
|
-
|
26
35
|
test "results.array" do
|
36
|
+
response.body.results.array.is_an Array
|
27
37
|
response.body.results.array.includes 3
|
28
38
|
end
|
29
39
|
end
|
data/lib/api_pi/dsl.rb
CHANGED
@@ -16,19 +16,19 @@ module ApiPi
|
|
16
16
|
pi.investigate
|
17
17
|
end
|
18
18
|
|
19
|
-
# Test blocks are used to group similar assertions into readable units.
|
20
|
-
#
|
19
|
+
# Test blocks are used to group similar assertions into readable units.
|
20
|
+
#
|
21
21
|
# For example, you may want to put your header tests into one test block:
|
22
|
-
#
|
22
|
+
#
|
23
23
|
# get 'example.com/user.json' do
|
24
24
|
# test 'Headers have correct data' do
|
25
25
|
# # You header assertions...
|
26
26
|
# end
|
27
27
|
# end
|
28
|
-
#
|
28
|
+
#
|
29
29
|
# Inside of the test block, you would then put your header assertions.
|
30
|
-
# onceyou run your tests, your test blocks are grouped together and
|
31
|
-
# pass/fail based on
|
30
|
+
# onceyou run your tests, your test blocks are grouped together and
|
31
|
+
# pass/fail based on assertions in the test block.
|
32
32
|
|
33
33
|
def test desc, &block
|
34
34
|
@tests[desc] = block
|
data/lib/api_pi/version.rb
CHANGED
data/logo/pi-logo.jpg
ADDED
Binary file
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: api_pi
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 0.9.3
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Ben Woodall
|
8
|
-
autorequire:
|
8
|
+
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-07-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: map
|
@@ -30,52 +30,52 @@ dependencies:
|
|
30
30
|
requirements:
|
31
31
|
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: 5.
|
33
|
+
version: 5.24.1
|
34
34
|
type: :development
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
38
|
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: 5.
|
40
|
+
version: 5.24.1
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: webmock
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: 3.
|
47
|
+
version: 3.23.1
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: 3.
|
54
|
+
version: 3.23.1
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: rake
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: 13.
|
61
|
+
version: 13.2.1
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: 13.
|
69
|
-
description: A ruby DSL to validate API requests.
|
68
|
+
version: 13.2.1
|
69
|
+
description: A ruby DSL to investigate and validate API requests.
|
70
70
|
email: mail@benwoodall.com
|
71
71
|
executables: []
|
72
72
|
extensions: []
|
73
73
|
extra_rdoc_files:
|
74
74
|
- README.md
|
75
75
|
files:
|
76
|
+
- ".github/workflows/tests.yml"
|
76
77
|
- ".gitignore"
|
77
78
|
- ".ruby-version"
|
78
|
-
- ".travis.yml"
|
79
79
|
- Gemfile
|
80
80
|
- Gemfile.lock
|
81
81
|
- README.md
|
@@ -89,14 +89,15 @@ files:
|
|
89
89
|
- lib/api_pi/dsl.rb
|
90
90
|
- lib/api_pi/request.rb
|
91
91
|
- lib/api_pi/version.rb
|
92
|
+
- logo/pi-logo.jpg
|
92
93
|
- test/test_helper.rb
|
93
94
|
- test/unit/test_assertions.rb
|
94
95
|
- test/unit/test_dsl.rb
|
95
96
|
- test/unit/test_requests.rb
|
96
|
-
homepage:
|
97
|
+
homepage:
|
97
98
|
licenses: []
|
98
99
|
metadata: {}
|
99
|
-
post_install_message:
|
100
|
+
post_install_message:
|
100
101
|
rdoc_options: []
|
101
102
|
require_paths:
|
102
103
|
- lib
|
@@ -104,15 +105,15 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
104
105
|
requirements:
|
105
106
|
- - ">="
|
106
107
|
- !ruby/object:Gem::Version
|
107
|
-
version:
|
108
|
+
version: '3.0'
|
108
109
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
109
110
|
requirements:
|
110
111
|
- - ">="
|
111
112
|
- !ruby/object:Gem::Version
|
112
113
|
version: '0'
|
113
114
|
requirements: []
|
114
|
-
rubygems_version: 3.
|
115
|
-
signing_key:
|
115
|
+
rubygems_version: 3.5.11
|
116
|
+
signing_key:
|
116
117
|
specification_version: 4
|
117
118
|
summary: API validation DSL
|
118
119
|
test_files:
|