open_api_parser 1.1.1 → 1.1.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/LICENSE.txt +1 -1
- data/lib/open_api_parser/specification/root.rb +12 -8
- data/lib/open_api_parser/version.rb +1 -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: 673e2c745f8c364512a0c67529c03aec5d32f985
|
4
|
+
data.tar.gz: 7e542ca36c68a487d51639af6912a83f56a140d1
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c13fb008fe910d5146dab2ada1639352684e5dfb8355c7ee2253346005a61dd72ab87fca76ea5bc59a83bfbe5751dfc940ca8fb591c3eb6853a7a7db712f778c
|
7
|
+
data.tar.gz: a6126e71e75fd7b330c19e2e0c48b9c3415d91cb58206ea2af24119d591d640390c02fa26dc2f91c60b1b2fde35d65ab23870d7883f641b950126adeacc6d328
|
data/CHANGELOG.md
CHANGED
data/LICENSE.txt
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
The MIT License (MIT)
|
2
2
|
|
3
|
-
Copyright (c)
|
3
|
+
Copyright (c) 2017 Braintree, a division of PayPal, Inc.
|
4
4
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
@@ -11,19 +11,19 @@ module OpenApiParser
|
|
11
11
|
uri = URI.parse(path)
|
12
12
|
requested_path = uri.path.gsub(/\..+\z/, "")
|
13
13
|
|
14
|
-
|
15
|
-
requested_path =~ to_pattern(path_name)
|
14
|
+
matching_path_details = @raw["paths"].detect do |path_name, path|
|
15
|
+
requested_path =~ to_pattern(path_name) &&
|
16
|
+
path.keys.any? { |method| matching_method?(method, request_method) }
|
16
17
|
end
|
17
|
-
return nil if
|
18
|
+
return nil if matching_path_details.nil?
|
18
19
|
|
19
|
-
|
20
|
+
matching_name, matching_path = matching_path_details
|
20
21
|
|
21
|
-
method_details =
|
22
|
-
method
|
22
|
+
method_details = matching_path.detect do |method, schema|
|
23
|
+
matching_method?(method, request_method)
|
23
24
|
end
|
24
|
-
return nil if method_details.nil?
|
25
25
|
|
26
|
-
Endpoint.new(
|
26
|
+
Endpoint.new(matching_name, method_details.first, method_details.last)
|
27
27
|
rescue URI::InvalidURIError
|
28
28
|
nil
|
29
29
|
end
|
@@ -34,6 +34,10 @@ module OpenApiParser
|
|
34
34
|
|
35
35
|
private
|
36
36
|
|
37
|
+
def matching_method?(method, request_method)
|
38
|
+
method.to_s == request_method.downcase
|
39
|
+
end
|
40
|
+
|
37
41
|
def to_pattern(path_name)
|
38
42
|
Regexp.new("\\A" + path_name.gsub(/\{[^}]+\}/, "[^/]+") + "\\z")
|
39
43
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: open_api_parser
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.1.
|
4
|
+
version: 1.1.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Braintree
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2017-
|
11
|
+
date: 2017-03-21 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: json_schema
|