ropen_pi 0.1.1 → 0.1.2

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: 05ded72d6db3776db71ff571aac767ae4f121897de69e0ad133766266617a78e
4
- data.tar.gz: a912449691704d26ab33c6069aeb828ea8b8266cae52af161c1982a6d059e02c
3
+ metadata.gz: 8d694e45b861d26bfcc09164939a69910f758b090dfdc780f66d78c1df010aa7
4
+ data.tar.gz: 1a6c79a6e402aae532da53c6b1792fb1387f4a8134748f359e7fb3aaf9f9bcd0
5
5
  SHA512:
6
- metadata.gz: a40ac712a173b34199502da1ffe0e348e1860411f038c5d47daab42e62f70ca715338ced601907de66079d14ec171009568002116eee61760469eb15e4499b20
7
- data.tar.gz: 2555a06ed5f08c2dc4d86774a588e0ce32ab1dbe24ffa4ea311b0adc164593d5d61e286583f9c1f92ccb9d5b0db8ba614db6b02b132bc43175c8841770aaf63b
6
+ metadata.gz: 2b2c462efc6ced1d3b5516020acda7c15fda3886228bee6b40dd52345f6b43feb8115dfa310cde3c6e8f479f2057a5ff95425ab51edc2ab54eee44ad7c227b0a
7
+ data.tar.gz: bda00cb71f3d3874d368d329a748624c7a4de2a963d43c5ef6907507f63263691bc10570bf71a1ed4576ec2dada79324bdf2885d16e2bd10564977ab0e8df935
@@ -1,7 +1,7 @@
1
1
  PATH
2
2
  remote: .
3
3
  specs:
4
- ropen_pi (0.1.1)
4
+ ropen_pi (0.1.2)
5
5
  hashie
6
6
  json-schema
7
7
 
@@ -85,7 +85,7 @@ module RopenPi
85
85
  end
86
86
 
87
87
  def self.type(thing, opts = {})
88
- { type: thing.to_s }.merge(opts)
88
+ { type: thing }.merge(opts)
89
89
  end
90
90
 
91
91
  def self.string_array_type(opts = {})
@@ -109,7 +109,7 @@ module RopenPi
109
109
  type => {
110
110
  schema: {
111
111
  type: 'object',
112
- properties: { data: { type: 'array', items: { '$ref': ref } } }
112
+ properties: { data: { type: :array, items: { '$ref': ref } } }
113
113
  }
114
114
  }
115
115
  }
@@ -111,7 +111,7 @@ module RopenPi
111
111
 
112
112
  # TODO: add examples to this like we can for json, might be large lift
113
113
  # as many assumptions are made on content-type
114
- def request_body_xml(schema:,required: false, description: nil, examples: nil)
114
+ def request_body_xml(schema:, required: false, description: nil, examples: nil)
115
115
  passed_examples = Array(examples)
116
116
  content_hash = { 'application/xml' => { schema: schema, examples: examples }.compact! || {} }
117
117
  request_body(description: description, required: required, content: content_hash)
@@ -165,7 +165,7 @@ module RopenPi
165
165
  end
166
166
 
167
167
  def schema(value, content_type: 'application/json')
168
- content_hash = {content_type => {schema: value}}
168
+ content_hash = { content_type => { schema: value } }
169
169
  metadata[:response][:content] = content_hash
170
170
  end
171
171
 
@@ -173,7 +173,7 @@ module RopenPi
173
173
  metadata[:response][:headers] ||= {}
174
174
 
175
175
  if attributes[:type] && attributes[:schema].nil?
176
- attributes[:schema] = {type: attributes[:type]}
176
+ attributes[:schema] = { type: attributes[:type] }
177
177
  attributes.delete(:type)
178
178
  end
179
179
 
@@ -77,8 +77,8 @@ class RopenPi::Specs::RequestFactory
77
77
  def add_path(request, metadata, open_api_doc, parameters, example)
78
78
  template = (open_api_doc[:basePath] || '') + metadata[:path_item][:template]
79
79
 
80
- in_path = parameters.select { |p| p[:in] == :path }
81
- in_query = parameters.select { |p| p[:in] == :query }
80
+ in_path = parameters.select { |p| p[:in].to_sym == :path }
81
+ in_query = parameters.select { |p| p[:in].to_sym == :query }
82
82
 
83
83
  request[:path] = template.tap do |inner_template|
84
84
  in_path.each do |p|
@@ -12,7 +12,10 @@ module RopenPi::Specs
12
12
  require 'active_support/core_ext/hash/keys'
13
13
 
14
14
  def self.convert(doc)
15
- doc.deep_stringify_keys.to_yaml
15
+ doc.deep_stringify_keys!
16
+ doc.deep_transform_values { |value| value.to_s if value.is_a?(Symbol) }
17
+
18
+ doc.to_yaml
16
19
  end
17
20
  end
18
21
 
@@ -1,4 +1,4 @@
1
1
  module RopenPi
2
- VERSION = '0.1.1'.freeze
2
+ VERSION = '0.1.2'.freeze
3
3
  APP_JSON = 'application/json'.freeze
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ropen_pi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andy Ruck