Class: OpenApi::Encoding

Inherits:
Object
  • Object
show all
Includes:
EquatableAsContent
Defined in:
lib/open_api/encoding.rb

Overview

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Methods included from EquatableAsContent

#==

Constructor Details

#initialize(content_type: nil, headers: nil, style: nil, explode: nil, allow_reserved: false) ⇒ Encoding

Returns a new instance of Encoding.



8
9
10
11
12
13
14
# File 'lib/open_api/encoding.rb', line 8

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

Instance Attribute Details

#allow_reservedObject

Returns the value of attribute allow_reserved.



6
7
8
# File 'lib/open_api/encoding.rb', line 6

def allow_reserved
  @allow_reserved
end

#content_typeObject

Returns the value of attribute content_type.



6
7
8
# File 'lib/open_api/encoding.rb', line 6

def content_type
  @content_type
end

#explodeObject

Returns the value of attribute explode.



6
7
8
# File 'lib/open_api/encoding.rb', line 6

def explode
  @explode
end

#headersObject

Returns the value of attribute headers.



6
7
8
# File 'lib/open_api/encoding.rb', line 6

def headers
  @headers
end

#styleObject

Returns the value of attribute style.



6
7
8
# File 'lib/open_api/encoding.rb', line 6

def style
  @style
end

Class Method Details

.load(hash) ⇒ Object



16
17
18
19
20
21
22
23
24
# File 'lib/open_api/encoding.rb', line 16

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