Class: WeakSwaggerParameters::Services::SwaggerOptionsAdapter
- Inherits:
-
Object
- Object
- WeakSwaggerParameters::Services::SwaggerOptionsAdapter
- Defined in:
- lib/weak_swagger_parameters/services/swagger_options_adapter.rb
Constant Summary collapse
- KNOWN_TYPES =
{ integer: { type: :integer, format: :int32 }, long: { type: :integer, format: :int64 }, float: { type: :number, format: :float }, double: { type: :number, format: :double }, string: { type: :string }, byte: { type: :string, format: :byte }, binary: { type: :string, format: :binary }, boolean: { type: :boolean }, date: { type: :string, format: :date }, dateTime: { type: :string, format: :'date-time' }, password: { type: :string, format: :password } }.freeze
Class Method Summary collapse
- .about_options(options) ⇒ Object
- .adapt(options) ⇒ Object
- .default_options(options) ⇒ Object
- .enum_options(options) ⇒ Object
- .range_options(options) ⇒ Object
- .required_options(options) ⇒ Object
- .type_options(options) ⇒ Object
Class Method Details
.about_options(options) ⇒ Object
35 36 37 38 39 40 41 |
# File 'lib/weak_swagger_parameters/services/swagger_options_adapter.rb', line 35 def self.() result = {} result = result.merge(name: [:name]) if [:name].present? result = result.merge(description: [:description]) if [:description].present? result = result.merge(in: [:location]) if [:location].present? result end |
.adapt(options) ⇒ Object
20 21 22 23 24 25 26 27 28 29 |
# File 'lib/weak_swagger_parameters/services/swagger_options_adapter.rb', line 20 def self.adapt() result = {} result = result.merge(()) result = result.merge(()) result = result.merge(()) result = result.merge(()) result = result.merge(()) result = result.merge(()) result end |
.default_options(options) ⇒ Object
57 58 59 |
# File 'lib/weak_swagger_parameters/services/swagger_options_adapter.rb', line 57 def self.() [:default].present? ? { default: [:default] } : {} end |
.enum_options(options) ⇒ Object
61 62 63 |
# File 'lib/weak_swagger_parameters/services/swagger_options_adapter.rb', line 61 def self.() [:enum].present? ? { enum: [:enum] } : {} end |
.range_options(options) ⇒ Object
50 51 52 53 54 55 |
# File 'lib/weak_swagger_parameters/services/swagger_options_adapter.rb', line 50 def self.() result = {} result = result.merge(minimum: [:min]) if [:min].present? result = result.merge(maximum: [:max]) if [:max].present? result end |
.required_options(options) ⇒ Object
43 44 45 46 47 48 |
# File 'lib/weak_swagger_parameters/services/swagger_options_adapter.rb', line 43 def self.() result = {} result = result.merge(required: true) if [:location] == :path result = result.merge(required: [:required]) if [:required] result end |
.type_options(options) ⇒ Object
31 32 33 |
# File 'lib/weak_swagger_parameters/services/swagger_options_adapter.rb', line 31 def self.() KNOWN_TYPES[[:type]] end |