mithraic_events 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +59 -8
- data/.rubocop_todo.yml +56 -0
- data/CHANGELOG.md +5 -0
- data/Gemfile.lock +1 -1
- data/README.md +43 -17
- data/lib/mithraic_events/version.rb +1 -1
- data/lib/mithraic_events.rb +19 -19
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: d0010dd62bd2e4cd33ec6bd2a40b6a5a5c1322385c4b103d8533b51b83f6e050
|
4
|
+
data.tar.gz: 85c9005b1acfdbd5ae37e2d3b794aa06085053b49acd84dbf2019ec484e791b6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: d053fcb68a9d024d34ca4da7c27c16c621238689889755c16cc726cf063b8917b3347ef8c3aaf803786f16e2034072dea80db1ae306cb26f8b65ceb88329e230
|
7
|
+
data.tar.gz: 7ceebbe4c95c171ac1cd09877099f39329baa361b4b379ef93cef0208c7cc1f0a15aaa98e2cbb0c6c1b2b7fdb28a74d30783002704ad604f5c67b9403c4b0278
|
data/.rubocop.yml
CHANGED
@@ -1,13 +1,64 @@
|
|
1
|
+
inherit_from: .rubocop_todo.yml
|
2
|
+
|
1
3
|
AllCops:
|
2
|
-
|
4
|
+
# Exclude:
|
5
|
+
# TargetRubyVersion: 2.7
|
6
|
+
NewCops: enable
|
7
|
+
SuggestExtensions: false
|
3
8
|
|
4
|
-
|
5
|
-
|
6
|
-
EnforcedStyle: double_quotes
|
9
|
+
Metrics/MethodLength:
|
10
|
+
Max: 1000
|
7
11
|
|
8
|
-
|
9
|
-
|
10
|
-
EnforcedStyle: double_quotes
|
12
|
+
Metrics/ModuleLength:
|
13
|
+
Max: 1000
|
11
14
|
|
12
15
|
Layout/LineLength:
|
13
|
-
Max:
|
16
|
+
Max: 5000
|
17
|
+
|
18
|
+
Metrics/ClassLength:
|
19
|
+
Max: 2000
|
20
|
+
|
21
|
+
Metrics/AbcSize:
|
22
|
+
Max: 200
|
23
|
+
|
24
|
+
Metrics/BlockLength:
|
25
|
+
Max: 200
|
26
|
+
|
27
|
+
Metrics/PerceivedComplexity:
|
28
|
+
Max: 100
|
29
|
+
|
30
|
+
Metrics/CyclomaticComplexity:
|
31
|
+
Max: 30
|
32
|
+
|
33
|
+
Style/NumericLiteralPrefix:
|
34
|
+
Enabled: false
|
35
|
+
|
36
|
+
Style/GlobalVars:
|
37
|
+
Enabled: false
|
38
|
+
|
39
|
+
Style/FrozenStringLiteralComment:
|
40
|
+
Enabled: false
|
41
|
+
|
42
|
+
Metrics/ParameterLists:
|
43
|
+
Max: 20
|
44
|
+
|
45
|
+
Style/RaiseArgs:
|
46
|
+
Enabled: false
|
47
|
+
|
48
|
+
Style/RedundantInterpolation:
|
49
|
+
Enabled: false
|
50
|
+
|
51
|
+
Style/NumericLiterals:
|
52
|
+
Enabled: false
|
53
|
+
|
54
|
+
Style/HashLikeCase:
|
55
|
+
Enabled: false
|
56
|
+
|
57
|
+
Style/Documentation:
|
58
|
+
Enabled: false
|
59
|
+
|
60
|
+
Lint/FloatComparison:
|
61
|
+
Enabled: false
|
62
|
+
|
63
|
+
Style/OptionalBooleanParameter:
|
64
|
+
Enabled: false
|
data/.rubocop_todo.yml
ADDED
@@ -0,0 +1,56 @@
|
|
1
|
+
# This configuration was generated by
|
2
|
+
# `rubocop --auto-gen-config`
|
3
|
+
# on 2022-06-17 23:34:55 UTC using RuboCop version 1.30.1.
|
4
|
+
# The point is for the user to remove these configuration records
|
5
|
+
# one by one as the offenses are removed from the code base.
|
6
|
+
# Note that changes in the inspected code, or installation of new
|
7
|
+
# versions of RuboCop, may require this file to be generated again.
|
8
|
+
|
9
|
+
# Offense count: 1
|
10
|
+
# This cop supports safe autocorrection (--autocorrect).
|
11
|
+
# Configuration parameters: Include.
|
12
|
+
# Include: **/*.gemspec
|
13
|
+
Gemspec/RequireMFA:
|
14
|
+
Exclude:
|
15
|
+
# - 'mithraic_events.gemspec'
|
16
|
+
|
17
|
+
# Offense count: 1
|
18
|
+
# This cop supports safe autocorrection (--autocorrect).
|
19
|
+
# Configuration parameters: EnforcedStyle.
|
20
|
+
# SupportedStyles: strict, consistent
|
21
|
+
Lint/SymbolConversion:
|
22
|
+
Exclude:
|
23
|
+
# - 'lib/mithraic_events.rb'
|
24
|
+
|
25
|
+
# Offense count: 1
|
26
|
+
Style/ClassVars:
|
27
|
+
Exclude:
|
28
|
+
# - 'lib/mithraic_events.rb'
|
29
|
+
|
30
|
+
# Offense count: 4
|
31
|
+
Style/OpenStructUse:
|
32
|
+
Exclude:
|
33
|
+
# - 'lib/plugin/plugin.rb'
|
34
|
+
|
35
|
+
# Offense count: 2
|
36
|
+
# This cop supports unsafe autocorrection (--autocorrect-all).
|
37
|
+
# Configuration parameters: Methods.
|
38
|
+
Style/RedundantArgument:
|
39
|
+
Exclude:
|
40
|
+
# - 'lib/plugin/plugin.rb'
|
41
|
+
|
42
|
+
# Offense count: 85
|
43
|
+
# This cop supports safe autocorrection (--autocorrect).
|
44
|
+
# Configuration parameters: EnforcedStyle, ConsistentQuotesInMultiline.
|
45
|
+
# SupportedStyles: single_quotes, double_quotes
|
46
|
+
Style/StringLiterals:
|
47
|
+
Exclude:
|
48
|
+
- 'Gemfile'
|
49
|
+
- 'Rakefile'
|
50
|
+
- 'bin/console'
|
51
|
+
# - 'lib/mithraic_events.rb'
|
52
|
+
- 'lib/mithraic_events/version.rb'
|
53
|
+
- 'lib/plugin/plugin.rb'
|
54
|
+
- 'mithraic_events.gemspec'
|
55
|
+
- 'spec/mithraic_events_spec.rb'
|
56
|
+
- 'spec/spec_helper.rb'
|
data/CHANGELOG.md
CHANGED
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -1,37 +1,63 @@
|
|
1
|
-
#
|
1
|
+
# Mithraic-Events
|
2
2
|
|
3
|
-
|
4
|
-
|
5
|
-
TODO: Delete this and the text above, and describe your gem
|
3
|
+
Mithraic Events aims to provide a convenient and easy process for working with HTTParty and other facilities to help you in API testings.
|
6
4
|
|
7
5
|
## Installation
|
8
6
|
|
9
|
-
|
7
|
+
Add Mithraic-Events to your `Gemfile`:
|
8
|
+
|
9
|
+
```bash
|
10
|
+
gem 'mithraic_events', '~> 0.1.1'
|
11
|
+
```
|
12
|
+
|
13
|
+
or
|
10
14
|
|
11
|
-
|
15
|
+
```ruby
|
16
|
+
gem 'mithraic_events'
|
17
|
+
```
|
12
18
|
|
13
|
-
|
19
|
+
Install:
|
14
20
|
|
15
|
-
|
21
|
+
```bash
|
22
|
+
bundle install
|
23
|
+
```
|
16
24
|
|
17
25
|
## Usage
|
18
26
|
|
19
|
-
|
27
|
+
GET
|
28
|
+
|
29
|
+
```bash
|
30
|
+
get("#{url_token}members/me/?key={{api_key}}&token={{token}}"
|
31
|
+
```
|
32
|
+
|
33
|
+
POST
|
34
|
+
|
35
|
+
```bash
|
36
|
+
post("{url_token}boards/?name=comaed&key={{api_key}}&token={{token}}&defaultLists=false")
|
37
|
+
```
|
20
38
|
|
21
|
-
|
39
|
+
PUT
|
22
40
|
|
23
|
-
|
41
|
+
```bash
|
42
|
+
put("{url_token}/cards/:id?idList={{doneListId}}&key={{trelloKey}}&token={{trelloToken}}")
|
43
|
+
```
|
24
44
|
|
25
|
-
|
45
|
+
PATCH
|
46
|
+
|
47
|
+
```bash
|
48
|
+
patch("{url_token}/checklists/:id/:field?value=bottom")
|
49
|
+
```
|
50
|
+
|
51
|
+
DELETE
|
52
|
+
|
53
|
+
```bash
|
54
|
+
delete("{url_token}/boards/:id?key={{trelloKey}}&token={{trelloToken}}")
|
55
|
+
```
|
26
56
|
|
27
57
|
## Contributing
|
28
58
|
|
29
|
-
Bug reports and pull requests are welcome on GitHub at https://github.com/
|
59
|
+
Bug reports and pull requests are welcome on GitHub at <https://github.com/callyca/mithraic_events>. This project is intended to be a safe, welcoming space for collaboration.
|
30
60
|
|
31
61
|
## License
|
32
62
|
|
33
63
|
The gem is available as open source under the terms of the [MIT License](https://opensource.org/licenses/MIT).
|
34
|
-
|
35
|
-
## Code of Conduct
|
36
|
-
|
37
|
-
Everyone interacting in the MithraicEvents project's codebases, issue trackers, chat rooms and mailing lists is expected to follow the [code of conduct](https://github.com/[USERNAME]/mithraic_events/blob/master/CODE_OF_CONDUCT.md).
|
data/lib/mithraic_events.rb
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
|
3
|
-
require_relative
|
4
|
-
require
|
3
|
+
require_relative 'mithraic_events/version'
|
4
|
+
require 'httparty'
|
5
5
|
|
6
6
|
module MithraicEvents
|
7
7
|
include HTTParty
|
@@ -11,36 +11,36 @@ module MithraicEvents
|
|
11
11
|
def get(url, query: nil, headers: nil, body: nil)
|
12
12
|
headers = build_request(headers)
|
13
13
|
response = HTTParty.get(url, query: query, headers: headers, body: body.to_json)
|
14
|
-
print_info(
|
14
|
+
print_info('GET', url, query, headers, body, response) if ISPDF == 'true'
|
15
15
|
response
|
16
16
|
end
|
17
17
|
|
18
18
|
def post(url, query: nil, headers: nil, body: nil)
|
19
|
-
body = body.to_json unless body.eql?(
|
19
|
+
body = body.to_json unless body.eql?('grant_type=client_credentials')
|
20
20
|
headers = build_request(headers)
|
21
21
|
response = HTTParty.post(url, query: query, headers: headers, body: body, timeout: 180)
|
22
|
-
print_info(
|
22
|
+
print_info('POST', url, query, headers, body, response) if ISPDF == 'true'
|
23
23
|
response
|
24
24
|
end
|
25
25
|
|
26
26
|
def put(url, query: nil, headers: nil, body: nil)
|
27
27
|
headers = build_request(headers)
|
28
28
|
response = HTTParty.put(url, query: query, headers: headers, body: body.to_json)
|
29
|
-
print_info(
|
29
|
+
print_info('PUT', url, query, headers, body, response) if ISPDF == 'true'
|
30
30
|
response
|
31
31
|
end
|
32
32
|
|
33
33
|
def patch(url, query: nil, headers: nil, body: nil)
|
34
34
|
headers = build_request(headers)
|
35
35
|
response = HTTParty.patch(url, query: query, headers: headers, body: body.to_json)
|
36
|
-
print_info(
|
36
|
+
print_info('PATCH', url, query, headers, body, response) if ISPDF == 'true'
|
37
37
|
response
|
38
38
|
end
|
39
39
|
|
40
40
|
def delete(url, query: nil, headers: nil, body: nil)
|
41
41
|
headers = build_request(headers)
|
42
42
|
response = HTTParty.delete(url, query: query, headers: headers, body: body.to_json)
|
43
|
-
print_info(
|
43
|
+
print_info('DELETE', url, query, headers, body, response) if ISPDF == 'true'
|
44
44
|
response
|
45
45
|
end
|
46
46
|
|
@@ -49,20 +49,20 @@ module MithraicEvents
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def build_request(headers)
|
52
|
-
headers = { 'Content-Type':
|
53
|
-
headers.merge!('Content-Type':
|
54
|
-
headers.merge!(
|
52
|
+
headers = { 'Content-Type': 'application/json' } if headers.nil?
|
53
|
+
headers.merge!('Content-Type': 'application/json') unless headers.key?(:'Content-Type')
|
54
|
+
headers.merge!(Authorization: @@token) unless defined?(@@token).nil?
|
55
55
|
headers
|
56
56
|
end
|
57
57
|
|
58
58
|
def print_info(verb, url, query, headers, body, response)
|
59
|
-
write_evidence(
|
60
|
-
write_evidence(
|
61
|
-
write_evidence(
|
62
|
-
write_evidence(
|
63
|
-
write_evidence(
|
64
|
-
write_evidence(
|
65
|
-
write_evidence(
|
59
|
+
write_evidence('Request Method:', verb)
|
60
|
+
write_evidence('Request URL:', url)
|
61
|
+
write_evidence('Response Status:', response.code)
|
62
|
+
write_evidence('Query params:', query) unless query.nil?
|
63
|
+
write_evidence('Headers:', headers) unless headers.nil?
|
64
|
+
write_evidence('Request Body:', body) unless body.nil?
|
65
|
+
write_evidence('Response Body:', response.parsed_response) unless response.body.nil? || response.body.empty?
|
66
66
|
end
|
67
67
|
|
68
68
|
def write_evidence(text, value)
|
@@ -81,7 +81,7 @@ module MithraicEvents
|
|
81
81
|
def prepare_mock_invalid(payload, field, max_length, character)
|
82
82
|
json_navigate = field.split(/-/)
|
83
83
|
object = JSON.parse(payload.to_json)
|
84
|
-
value =
|
84
|
+
value = ''.rjust(max_length.to_i, character)
|
85
85
|
payload = set_value_iter(object, json_navigate, value)
|
86
86
|
payload.to_h
|
87
87
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: mithraic_events
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- callyca
|
@@ -248,7 +248,7 @@ dependencies:
|
|
248
248
|
- - ">="
|
249
249
|
- !ruby/object:Gem::Version
|
250
250
|
version: '0'
|
251
|
-
description: Mithraic
|
251
|
+
description: Mithraic Events is a tool to help in the API testing with HTTParty
|
252
252
|
email:
|
253
253
|
- thiago.callyxz@gmail.com
|
254
254
|
executables: []
|
@@ -257,6 +257,7 @@ extra_rdoc_files: []
|
|
257
257
|
files:
|
258
258
|
- ".rspec"
|
259
259
|
- ".rubocop.yml"
|
260
|
+
- ".rubocop_todo.yml"
|
260
261
|
- CHANGELOG.md
|
261
262
|
- Gemfile
|
262
263
|
- Gemfile.lock
|
@@ -270,7 +271,8 @@ files:
|
|
270
271
|
homepage: https://github.com/CallyCa/MithraicEvents
|
271
272
|
licenses:
|
272
273
|
- MIT
|
273
|
-
metadata:
|
274
|
+
metadata:
|
275
|
+
rubygems_mfa_required: 'true'
|
274
276
|
post_install_message:
|
275
277
|
rdoc_options: []
|
276
278
|
require_paths:
|