cthiesfork-awspec 1.1.0 → 1.2.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
  SHA256:
3
- metadata.gz: c0ceb4dd81e824e3b7cb888a0e91eded7603d1f7ca1f9a3906e45e55e2cd981c
4
- data.tar.gz: 29473c8f95f0fe93faea99bba7ed197bce015518358303e1cdae63fdf89cdb6e
3
+ metadata.gz: 1f04090ce54345c6edab9b9f45776c27b86f57da62c3f34c65f9d125b2aac8aa
4
+ data.tar.gz: 7d425a66935a8491bb201e47146eaa2d1117e4b9d235ca502e8c6212728a925e
5
5
  SHA512:
6
- metadata.gz: ed53af3a1cc0aee85e9e0d8e33ccf829e93bef4f373697ba290a9d3fd02924a8e443d620240b71088fff17c9591c7ebdfa24ea4a96654f3ef78c7677d537e279
7
- data.tar.gz: c800999b96ac689a827a1b3dd24d3c8365f0dcbb06a8fc46bb6973a124bbc7e4b1260cdd7fe1b1f8ae5c6ab4f75742689897e3bf92b450a46202fdcf101bc36d
6
+ metadata.gz: 4e4f27fb7faf28ad0cc0b3c849a1626528711cf8c0bf79387aafb23dee1059b2221b89387da6ef003c9092bfaf4319a41f76f804b35a59236a8324d68eb45a06
7
+ data.tar.gz: b6168cc0fc35bc2c71515b84c32bc1c1ab49cb178e762a3570680330b51e331284ed3bf60a4ce748ab36a495c0f53b078e50c369ea482f49f9ca57aa55b94333
@@ -6,7 +6,7 @@ require 'awspec/version'
6
6
 
7
7
  Gem::Specification.new do |spec|
8
8
  spec.name = 'cthiesfork-awspec'
9
- spec.version = '1.1.0'
9
+ spec.version = '1.2.0'
10
10
  spec.authors = ['cthies']
11
11
  spec.email = ['colekthiessen@gmail.com']
12
12
 
@@ -284,8 +284,12 @@ describe apigateway('my-apigateway') do
284
284
  end
285
285
  ```
286
286
 
287
+ ### have_integration_method
288
+
287
289
  ### have_integration_path
288
290
 
291
+ ### have_method
292
+
289
293
  ### have_path
290
294
 
291
295
  ### its(:id), its(:name), its(:description), its(:created_date), its(:version), its(:warnings), its(:binary_media_types), its(:minimum_compression_size), its(:api_key_source), its(:policy), its(:tags)
@@ -78,7 +78,8 @@ Aws.config[:apigateway] = {
78
78
  path: '/proxy',
79
79
  resource_methods: {
80
80
  'GET' => {
81
- method_integration: { uri: 'http://127.0.0.1:8080/hockey' }
81
+ http_method: 'GET',
82
+ method_integration: { http_method: 'POST', uri: 'http://127.0.0.1:8080/hockey' }
82
83
  }
83
84
  }
84
85
  },
@@ -86,7 +87,8 @@ Aws.config[:apigateway] = {
86
87
  path: '/zambonis',
87
88
  resource_methods: {
88
89
  'POST' => {
89
- method_integration: { uri: 'http://127.0.0.1:8080/zambonis/{arena}' }
90
+ http_method: 'POST',
91
+ method_integration: { http_method: 'POST', uri: 'http://127.0.0.1:8080/zambonis/{arena}' }
90
92
  }
91
93
  }
92
94
  },
@@ -21,21 +21,39 @@ module Awspec::Type
21
21
  def has_path?(path)
22
22
  check_existence
23
23
  self.api_resources.each do |resource|
24
- return true if resource.path == path
24
+ return resource if resource.path == path
25
25
  end
26
- false
26
+ nil
27
27
  end
28
28
 
29
29
  def has_integration_path?(path)
30
30
  check_existence
31
31
  self.api_resources.each do |resource|
32
32
  next if resource.resource_methods.nil?
33
- resource.resource_methods.each do |_, value|
34
- uri = Addressable::URI.parse(value.method_integration.uri)
35
- return true if uri.path == path
33
+ resource.resource_methods.each do |_, method|
34
+ uri = Addressable::URI.parse(method.method_integration.uri)
35
+ return resource if uri.path == path
36
36
  end
37
37
  end
38
- false
38
+ nil
39
+ end
40
+
41
+ def has_method?(path, http_method)
42
+ check_existence
43
+ resource_to_check = has_path?(path)
44
+ return nil if resource_to_check.nil?
45
+ resource_to_check.resource_methods.each do |_, method|
46
+ return resource_to_check if method.http_method == http_method
47
+ end
48
+ end
49
+
50
+ def has_integration_method?(integration_path, http_method)
51
+ check_existence
52
+ integration_resource_to_check = has_integration_path?(integration_path)
53
+ return nil if integration_resource_to_check.nil?
54
+ integration_resource_to_check.resource_methods.each do |_, method|
55
+ return integration_resource_to_check if method.method_integration.http_method == http_method
56
+ end
39
57
  end
40
58
  end
41
59
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: cthiesfork-awspec
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.0
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - cthies
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-03-05 00:00:00.000000000 Z
11
+ date: 2020-03-06 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk