Class: ApiSketch::Model::Parameters

Inherits:
Base
  • Object
show all
Defined in:
lib/api_sketch/model/parameters.rb

Instance Attribute Summary collapse

Attributes inherited from Base

#description, #name

Instance Method Summary collapse

Constructor Details

#initialize(attributes = {}) ⇒ Parameters

Returns a new instance of Parameters.



4
5
6
7
8
# File 'lib/api_sketch/model/parameters.rb', line 4

def initialize(attributes = {})
  super(attributes)
  self.query ||= []
  self.body ||= []
end

Instance Attribute Details

#bodyObject

Returns the value of attribute body.



2
3
4
# File 'lib/api_sketch/model/parameters.rb', line 2

def body
  @body
end

#body_container_typeObject

Returns the value of attribute body_container_type.



2
3
4
# File 'lib/api_sketch/model/parameters.rb', line 2

def body_container_type
  @body_container_type
end

#queryObject

Returns the value of attribute query.



2
3
4
# File 'lib/api_sketch/model/parameters.rb', line 2

def query
  @query
end

#query_container_typeObject

Returns the value of attribute query_container_type.



2
3
4
# File 'lib/api_sketch/model/parameters.rb', line 2

def query_container_type
  @query_container_type
end

Instance Method Details

#as_full_namesObject



18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
# File 'lib/api_sketch/model/parameters.rb', line 18

def as_full_names
  fullname_params = self.class.new
  [:query, :body].each do |param_location|
    new_params = []
    self.send(param_location).each do |param|
      if param.data_type == :document
        full_names_for(param, param.name, new_params)
      else
        new_params << param
      end
    end
    fullname_params.send("#{param_location}=", new_params)
  end
  fullname_params
end

#wrapped_bodyObject



14
15
16
# File 'lib/api_sketch/model/parameters.rb', line 14

def wrapped_body
  ApiSketch::Model::Attribute.new(data_type: self.body_container_type, content: self.body)
end

#wrapped_queryObject



10
11
12
# File 'lib/api_sketch/model/parameters.rb', line 10

def wrapped_query
  ApiSketch::Model::Attribute.new(data_type: self.query_container_type, content: self.query)
end