Sha256: f14e3039b997c9538fc38f76493c96ae65d263da8bbab23cef35411aa7ab0009

Contents?: true

Size: 871 Bytes

Versions: 12

Compression:

Stored size: 871 Bytes

Contents

module OpenApi
  # https://github.com/OAI/OpenAPI-Specification/blob/master/versions/3.0.1.md#encodingObject
  class Encoding
    prepend EquatableAsContent

    attr_accessor :content_type, :headers, :style, :explode, :allow_reserved

    def initialize(content_type: nil, headers: nil, style: nil, explode: nil, allow_reserved: false)
      self.content_type = content_type
      self.headers = headers
      self.style = style
      self.explode = explode
      self.allow_reserved = allow_reserved
    end

    def self.load(hash)
      new(
        content_type: hash["contentType"]&.to_s,
        headers: hash["headers"]&.map { |k, v| [k, Reference.load(v) || Header.load(v)] }.to_h,
        style: hash["style"]&.to_s,
        explode: hash["explode"],
        allow_reserved: hash["allowReserved"].nil? ? false : hash["allowReserved"],
      )
    end
  end
end

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
open_api-0.6.2 lib/open_api/encoding.rb
open_api-0.6.1 lib/open_api/encoding.rb
open_api-0.6.0 lib/open_api/encoding.rb
open_api-0.5.0 lib/open_api/encoding.rb
open_api-0.4.0 lib/open_api/encoding.rb
open_api-0.3.4 lib/open_api/encoding.rb
open_api-0.3.3 lib/open_api/encoding.rb
open_api-0.3.2 lib/open_api/encoding.rb
open_api-0.3.1 lib/open_api/encoding.rb
open_api-0.3.0 lib/open_api/encoding.rb
open_api-0.2.0 lib/open_api/encoding.rb
open_api-0.1.0 lib/open_api/encoding.rb