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:  
     | 
| 
       4 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 3 
     | 
    
         
            +
              metadata.gz: 8d694e45b861d26bfcc09164939a69910f758b090dfdc780f66d78c1df010aa7
         
     | 
| 
      
 4 
     | 
    
         
            +
              data.tar.gz: 1a6c79a6e402aae532da53c6b1792fb1387f4a8134748f359e7fb3aaf9f9bcd0
         
     | 
| 
       5 
5 
     | 
    
         
             
            SHA512:
         
     | 
| 
       6 
     | 
    
         
            -
              metadata.gz:  
     | 
| 
       7 
     | 
    
         
            -
              data.tar.gz:  
     | 
| 
      
 6 
     | 
    
         
            +
              metadata.gz: 2b2c462efc6ced1d3b5516020acda7c15fda3886228bee6b40dd52345f6b43feb8115dfa310cde3c6e8f479f2057a5ff95425ab51edc2ab54eee44ad7c227b0a
         
     | 
| 
      
 7 
     | 
    
         
            +
              data.tar.gz: bda00cb71f3d3874d368d329a748624c7a4de2a963d43c5ef6907507f63263691bc10570bf71a1ed4576ec2dada79324bdf2885d16e2bd10564977ab0e8df935
         
     | 
    
        data/Gemfile.lock
    CHANGED
    
    
| 
         @@ -85,7 +85,7 @@ module RopenPi 
     | 
|
| 
       85 
85 
     | 
    
         
             
                end
         
     | 
| 
       86 
86 
     | 
    
         | 
| 
       87 
87 
     | 
    
         
             
                def self.type(thing, opts = {})
         
     | 
| 
       88 
     | 
    
         
            -
                  { type: thing 
     | 
| 
      
 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:  
     | 
| 
      
 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 
     | 
| 
      
 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 
     | 
    
         | 
    
        data/lib/ropen_pi/version.rb
    CHANGED