Sha256: 9332ce1d831171702ef3c281234da770aa8b5d9d7a2c42f0a58caa2f7e61a56a
Contents?: true
Size: 998 Bytes
Versions: 1
Compression:
Stored size: 998 Bytes
Contents
module DocSmoosher class Api < ApiObject attr_accessor :endpoint, :version, :format, :resources, :resquests, :objects def resources @resources ||= [] end def objects @objects ||= [] end def resquests @resquests ||= [] end def request( params = {}, &block ) end def resource( params = {}, &block ) r = Resource.new( params, &block ) resources << r unless resources.include?(r) r end def object( params = {}, &block ) if params.class == ApiObject o = params else o = ApiObject.new( params, &block ) end objects << o unless objects.include?(o) o end def initialize(params = {}, &block) super(params) end def as_json(options={}) { :name => name, :description => description, :version => version, :format => format, :resources => self.resources.map(&:as_json) } end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
doc_smoosher-0.1.0 | lib/doc_smoosher/api.rb |