app/models/try_api/parameter.rb in try_api-0.0.18 vs app/models/try_api/parameter.rb in try_api-0.1.0
- old
+ new
@@ -1,30 +1,9 @@
module TryApi
class Parameter < TryApi::Base
typesafe_accessor :name, String
typesafe_accessor :type, String
- typesafe_accessor :parameters, Array, default: []
+ typesafe_accessor :parameters, Array, default: [], items_type: TryApi::Parameter
typesafe_accessor :required, Boolean, default: true
typesafe_accessor :description, String
-
- class << self
- def parse(hash)
- instance = self.new
- instance.name = hash[:name]
- instance.type = hash[:type]
- instance.required = hash[:required]
- instance.description = hash[:description]
-
- instance.parameters = []
- if hash[:parameters].is_a? Array
- hash[:parameters].each do |parameter|
- instance.parameters << TryApi::Parameter.parse(parameter)
- end
- else
- # TODO raise exception ?
- end
-
- instance
- end
- end
end
end
\ No newline at end of file