apipie-postman 0.0.4 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/apipie-postman.rb +14 -12
- metadata +11 -11
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 744c898d34eba39938c8961bbfa6047b26e75cec9ef9b46bdd9571622cd626d2
|
4
|
+
data.tar.gz: 53d9f075566802e40802aeae23187747f88c50342b5d496584cc75c2d727038e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 55bf9987fd1e88cc716bc8a57ad095f114da7c4ed957c98e5664a7d92dfd4b60bbc666d7eb64dcb1dbdc69f208f6110bc2ffcbdc7e91f4ab683a3b72dcedba76
|
7
|
+
data.tar.gz: bc1b255a5fd737ecd73f0c10b793cce9de2ff4d975b30549eb329928c6a58023d3b8e8e071aa878de86dac0011beb2c8976f367d627b69a507f647a8b6109541
|
data/lib/apipie-postman.rb
CHANGED
@@ -3,7 +3,6 @@
|
|
3
3
|
require 'json'
|
4
4
|
require 'faraday'
|
5
5
|
|
6
|
-
# General module for gem
|
7
6
|
module ApipiePostman
|
8
7
|
class << self
|
9
8
|
attr_accessor :configuration
|
@@ -46,7 +45,7 @@ module ApipiePostman
|
|
46
45
|
end
|
47
46
|
|
48
47
|
endpoints_hashes << {
|
49
|
-
name: endpoint['title'],
|
48
|
+
name: endpoint['title'] == 'Default' ? "#{endpoint['verb']} #{endpoint['path']}" : endpoint['title'],
|
50
49
|
request: {
|
51
50
|
url: "#{self.configuration.base_url}#{endpoint['path']}",
|
52
51
|
method: endpoint['verb'],
|
@@ -72,22 +71,25 @@ module ApipiePostman
|
|
72
71
|
item: endpoints_hashes
|
73
72
|
}
|
74
73
|
}.to_json
|
74
|
+
|
75
75
|
headers = {
|
76
76
|
'X-Api-Key': self.configuration.postman_api_key,
|
77
77
|
'Content-Type': 'application/json'
|
78
78
|
}
|
79
79
|
|
80
|
-
|
80
|
+
collection_uid = check_collection_uid_by_name(headers)
|
81
81
|
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
82
|
+
if collection_uid.nil?
|
83
|
+
Faraday.public_send(:post, 'https://api.getpostman.com/collections/', body, headers)
|
84
|
+
else
|
85
|
+
Faraday.public_send(:put, "https://api.getpostman.com/collections/#{collection_uid['uid']}", body, headers)
|
86
|
+
end
|
87
|
+
end
|
86
88
|
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
91
|
-
|
89
|
+
def self.check_collection_uid_by_name(headers)
|
90
|
+
response = Faraday.public_send(:get, 'https://api.getpostman.com/collections/', {}, headers)
|
91
|
+
JSON.parse(response.body)['collections'].select do |col|
|
92
|
+
col['name'] == self.configuration.postman_collection_name
|
93
|
+
end.last
|
92
94
|
end
|
93
95
|
end
|
metadata
CHANGED
@@ -1,35 +1,35 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: apipie-postman
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Victor Motogna
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2021-08-
|
11
|
+
date: 2021-08-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- - "~>"
|
18
|
-
- !ruby/object:Gem::Version
|
19
|
-
version: '1.4'
|
20
17
|
- - ">="
|
21
18
|
- !ruby/object:Gem::Version
|
22
|
-
version: 1.
|
19
|
+
version: 1.0.0
|
20
|
+
- - "~>"
|
21
|
+
- !ruby/object:Gem::Version
|
22
|
+
version: '1.0'
|
23
23
|
type: :runtime
|
24
24
|
prerelease: false
|
25
25
|
version_requirements: !ruby/object:Gem::Requirement
|
26
26
|
requirements:
|
27
|
-
- - "~>"
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
version: '1.4'
|
30
27
|
- - ">="
|
31
28
|
- !ruby/object:Gem::Version
|
32
|
-
version: 1.
|
29
|
+
version: 1.0.0
|
30
|
+
- - "~>"
|
31
|
+
- !ruby/object:Gem::Version
|
32
|
+
version: '1.0'
|
33
33
|
- !ruby/object:Gem::Dependency
|
34
34
|
name: pry
|
35
35
|
requirement: !ruby/object:Gem::Requirement
|
@@ -59,7 +59,7 @@ dependencies:
|
|
59
59
|
- !ruby/object:Gem::Version
|
60
60
|
version: '3.10'
|
61
61
|
description: Use 'bundle exec apipie-postman' and 'rake apipie_postman' to generate
|
62
|
-
the docs!
|
62
|
+
the docs!
|
63
63
|
email: vmotogna@gmail.com
|
64
64
|
executables:
|
65
65
|
- apipie-postman
|