oas_request 0.0.2 → 0.0.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/oas_request.rb +12 -2
  3. metadata +1 -21
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 672124bdfd13b2f874bf30ed890d5837f27b688051d2348c08d9af73b7af0667
4
- data.tar.gz: 3e692ef035ef02ab2421f7b59fcb408f0cad0c19d0a0279e643f4eee06886f92
3
+ metadata.gz: eff936a836194070a533df223dc68808666c5f1c66c9ae69458c14258c6ac942
4
+ data.tar.gz: 29dbfff1f8cb35541db4c35db807a5578abe525f6f7859c154a74b23fa0906fd
5
5
  SHA512:
6
- metadata.gz: 616f2c7fb0e0f5d56aa264ff42648821f982515d6bb1e7ff4b48a41e8ca8974f52733a462d2b712666ba38e06e6fbd8b416b55b02b13502085e2737a33bf8c39
7
- data.tar.gz: 0e6c2517d08e9e50280f9ee433ef9a5afad1dce5a688fdc30c00386a585ea1c2cbe5913dd3cd67e4c763b2ff9348096bcd55e4a51b5dacaf06f9e5be125e1f61
6
+ metadata.gz: 3d848a527152d9459ca08ea149fe9f8fac19722ae3fceac6c50f3b0bf87e2fb21f257e2b074ebcd9c0f9fb242addd2fe82fdace3db2a60eaadbf39d8ab6513d5
7
+ data.tar.gz: 9b26f5dbf3140b62dda6da1160188374a81542221e349646bdb1ec999be9ed01ab095fa1203c1a47e0edaca36e8228ba0fde2c9fca8e791f688c3cc2e2e3c23f
@@ -1,4 +1,5 @@
1
1
  require "rack"
2
+ require "string"
2
3
 
3
4
  class OASRequest
4
5
  def self.spec(oas)
@@ -44,13 +45,16 @@ class OASRequest
44
45
  )
45
46
  end
46
47
 
48
+
47
49
  oas["paths"].each do |url, methods|
48
50
  methods.each do |method, definition|
49
51
  # filter to paths that contain an operationId
50
52
  next unless definition.is_a?(Hash) && definition["operationId"]
51
53
 
52
- # process each method
53
- define_method definition["operationId"] do |headers: {}, params: {}, query: {}, body: nil|
54
+ operation_id = definition["operationId"]
55
+ underscored_operation_id = operation_id.underscore
56
+
57
+ request_method = Proc.new do |headers: {}, params: {}, query: {}, body: nil|
54
58
  __request(
55
59
  method: method,
56
60
  url: url,
@@ -62,6 +66,12 @@ class OASRequest
62
66
  }
63
67
  )
64
68
  end
69
+
70
+ # process each method
71
+ define_method(operation_id, &request_method)
72
+
73
+ # Rubyify it getFooByBar -> get_foo_by_bar
74
+ define_method(underscored_operation_id, &request_method) if operation_id != underscored_operation_id
65
75
  end
66
76
  end
67
77
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: oas_request
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - ''
@@ -30,26 +30,6 @@ dependencies:
30
30
  - - ">="
31
31
  - !ruby/object:Gem::Version
32
32
  version: 2.2.3
33
- - !ruby/object:Gem::Dependency
34
- name: jwt
35
- requirement: !ruby/object:Gem::Requirement
36
- requirements:
37
- - - "~>"
38
- - !ruby/object:Gem::Version
39
- version: '1.5'
40
- - - ">="
41
- - !ruby/object:Gem::Version
42
- version: 1.5.4
43
- type: :runtime
44
- prerelease: false
45
- version_requirements: !ruby/object:Gem::Requirement
46
- requirements:
47
- - - "~>"
48
- - !ruby/object:Gem::Version
49
- version: '1.5'
50
- - - ">="
51
- - !ruby/object:Gem::Version
52
- version: 1.5.4
53
33
  - !ruby/object:Gem::Dependency
54
34
  name: webmock
55
35
  requirement: !ruby/object:Gem::Requirement