Sha256: 39c92e52c1d2e2d675ff53f57059fa7ef8163285c5dd2b18c766dae486eead6a
Contents?: true
Size: 1.09 KB
Versions: 1
Compression:
Stored size: 1.09 KB
Contents
module Wordnik class OperationParameter require 'active_model' include ActiveModel::Validations include ActiveModel::Conversion extend ActiveModel::Naming attr_accessor :name, :description, :required, :param_type, :default_value, :allowable_values, :param_access, :internal_description, :wrapper_name, :data_type, :allow_multiple def initialize(attributes = {}) attributes.each do |name, value| send("#{name.to_s.underscore.to_sym}=", value) end # Fudge body param into having the name :body self.name = :body if self.name.blank? end def human_name return "request body" if self.param_type == 'body' self.name.to_s end def required? self.required || self.param_type == "path" end # Is this a required positional param used in a convenience method? def positional? return true if self.param_type == 'body' return true if self.param_type == 'path' && self.name.to_s != 'format' false end # It's an ActiveModel thing.. def persisted? false end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
wordnik-4.06.06 | lib/wordnik/operation_parameter.rb |