Class: DocSmoosher::Api
Instance Attribute Summary collapse
-
#endpoint ⇒ Object
Returns the value of attribute endpoint.
-
#format ⇒ Object
Returns the value of attribute format.
-
#objects ⇒ Object
Returns the value of attribute objects.
-
#resources ⇒ Object
Returns the value of attribute resources.
-
#resquests ⇒ Object
Returns the value of attribute resquests.
-
#version ⇒ Object
Returns the value of attribute version.
Attributes inherited from ApiObject
#default, #description, #example, #name, #required, #type
Attributes included from Parameters
Instance Method Summary collapse
- #as_json(options = {}) ⇒ Object
-
#initialize(params = {}, &block) ⇒ Api
constructor
A new instance of Api.
- #object(params = {}, &block) ⇒ Object
- #request(params = {}, &block) ⇒ Object
- #resource(params = {}, &block) ⇒ Object
Methods included from Parameters
Constructor Details
#initialize(params = {}, &block) ⇒ Api
Returns a new instance of Api.
39 40 41 |
# File 'lib/doc_smoosher/api.rb', line 39 def initialize(params = {}, &block) super(params) end |
Instance Attribute Details
#endpoint ⇒ Object
Returns the value of attribute endpoint.
3 4 5 |
# File 'lib/doc_smoosher/api.rb', line 3 def endpoint @endpoint end |
#format ⇒ Object
Returns the value of attribute format.
3 4 5 |
# File 'lib/doc_smoosher/api.rb', line 3 def format @format end |
#objects ⇒ Object
Returns the value of attribute objects.
3 4 5 |
# File 'lib/doc_smoosher/api.rb', line 3 def objects @objects end |
#resources ⇒ Object
Returns the value of attribute resources.
3 4 5 |
# File 'lib/doc_smoosher/api.rb', line 3 def resources @resources end |
#resquests ⇒ Object
Returns the value of attribute resquests.
3 4 5 |
# File 'lib/doc_smoosher/api.rb', line 3 def resquests @resquests end |
#version ⇒ Object
Returns the value of attribute version.
3 4 5 |
# File 'lib/doc_smoosher/api.rb', line 3 def version @version end |
Instance Method Details
#as_json(options = {}) ⇒ Object
44 45 46 47 48 49 50 51 52 |
# File 'lib/doc_smoosher/api.rb', line 44 def as_json(={}) { :name => name, :description => description, :version => version, :format => format, :resources => self.resources.map(&:as_json) } end |
#object(params = {}, &block) ⇒ Object
28 29 30 31 32 33 34 35 36 37 |
# File 'lib/doc_smoosher/api.rb', line 28 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 |
#request(params = {}, &block) ⇒ Object
17 18 19 |
# File 'lib/doc_smoosher/api.rb', line 17 def request( params = {}, &block ) end |