Class: Swagger::Grape::EntityNestingExposure
- Inherits:
-
EntityExposure
- Object
- EntityExposure
- Swagger::Grape::EntityNestingExposure
- Defined in:
- lib/ruby-swagger/grape/entity_nesting_exposure.rb
Instance Method Summary collapse
-
#initialize(exposure) ⇒ EntityNestingExposure
constructor
A new instance of EntityNestingExposure.
- #to_swagger ⇒ Object
Methods inherited from EntityExposure
#array?, #attribute, #description, #documentation, #nested?, #nested_exposures, #options, #representer?, #sub_type, #type, #type?
Constructor Details
#initialize(exposure) ⇒ EntityNestingExposure
Returns a new instance of EntityNestingExposure.
3 4 5 6 7 8 |
# File 'lib/ruby-swagger/grape/entity_nesting_exposure.rb', line 3 def initialize(exposure) raise ArgumentError.new("Expecting a NestingExposure - Can't translate #{exposure}!") unless exposure.is_a? Grape::Entity::Exposure::NestingExposure @exposure = exposure @properties = {} end |
Instance Method Details
#to_swagger ⇒ Object
10 11 12 13 14 15 16 |
# File 'lib/ruby-swagger/grape/entity_nesting_exposure.rb', line 10 def to_swagger nested_exposures.each do |exposure| @properties.merge!(Swagger::Grape::EntityExposure.new(exposure).to_swagger) end array? ? array_schema : object_schema end |