lambda_open_api 0.1.3 → 0.2.0

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 215da615c51f2cc4828de0551f0f3c8ff55e1139913125654f336f5b596a9641
4
- data.tar.gz: 55aa015422479a62519535d4ac452b03fe1e994fcb6aac8cf919054007a9ab9b
3
+ metadata.gz: b3d36e338d14f7ec73fa44a6dcff28a9318d8232211e060ff4b9e831b1c32592
4
+ data.tar.gz: ec5683c9cae85aeddfd0c391d7ee46ecda7b7ba221c766cf63cd0ee64185e846
5
5
  SHA512:
6
- metadata.gz: f288e0522addb39986627173c569a6ecead21a7ab7dd45e7bc9b72ec2e0dad79dacad4f1f5d038e7ac9aeebd6ba46f78ee76272ebc492f0c52a3dabfbeea6ac0
7
- data.tar.gz: 1228582d556426675f94e02a0fb83be97494e0e6ed084e1f4d442101023847b03d2122418fc467cd30adacb7a29bc9ff3ebbf01d10b144f8eaa77a05393aa8ab
6
+ metadata.gz: 50a309862a63e87bc791ffff8740deb6e6cdbfb28885045576acd767479997548321ef29a0c0d489a432f8031d71c6b3c9c110e3e1cadca376709a311b027b48
7
+ data.tar.gz: 3b2dad01c575f9df59d532608de110617f2f9ee2378504410669c27d0f1573d6cc41dea41693c2096d93a26e605451541a0a09eac3a09b0f119ea9b94660b0eb
data/Gemfile.lock CHANGED
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- lambda_open_api (0.1.3)
4
+ lambda_open_api (0.2.0)
5
5
 
6
6
  GEM
7
7
  remote: https://rubygems.org/
@@ -4,14 +4,8 @@ module LambdaOpenApi
4
4
  class BodyParameter
5
5
  attr_accessor :data
6
6
 
7
- def initialize(data = nil, file_name: nil)
8
- @file_name = file_name
9
-
7
+ def initialize(data = nil)
10
8
  @data = data
11
- if data.nil? && File.exists?("lib/lambda_open_api/examples/requests/#{file_name}.json")
12
- json = File.open("lib/lambda_open_api/examples/requests/#{file_name}.json").read
13
- @data = JSON.parse(json)
14
- end
15
9
  end
16
10
 
17
11
  def json
@@ -15,6 +15,22 @@ module LambdaOpenApi
15
15
  "type"=> "object",
16
16
  "properties"=> hash.props
17
17
  }
18
+ elsif value.is_a?(Array)
19
+ item_props = {}
20
+
21
+ value.each do |item|
22
+ hash = LambdaOpenApi::BodyProperty.new
23
+ hash.generate(item)
24
+ item_props.merge!(hash.props)
25
+ end
26
+
27
+ props[key.to_s] = {
28
+ "type"=> "array",
29
+ "items"=> {
30
+ "type" => "object",
31
+ "properties" => item_props
32
+ }
33
+ }
18
34
  else
19
35
  props[key.to_s] = {
20
36
  "type"=> value_type(value)
@@ -115,7 +115,7 @@ module LambdaOpenApi
115
115
  def self.invoke
116
116
  invokcation = LambdaOpenApi::Invoker.new(klass: @klass, method: "process", event: @event.json, context: OpenStruct.new(aws_request_id: "123"))
117
117
  @action.set_response(invokcation.response_body)
118
- invokcation.response_body
118
+ invokcation.response
119
119
  end
120
120
  def self.set_action(action)
121
121
  @action = action
@@ -8,7 +8,7 @@ module LambdaOpenApi
8
8
  end
9
9
 
10
10
  def response_body
11
- response["body"] || response
11
+ response["body"] || response[:body] || response
12
12
  end
13
13
 
14
14
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module LambdaOpenApi
4
- VERSION = "0.1.3"
4
+ VERSION = "0.2.0"
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lambda_open_api
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Timothyjb