Class: DocSmoosher::Resource
- Defined in:
- lib/doc_smoosher/resource.rb
Instance Attribute Summary collapse
-
#parameters ⇒ Object
Returns the value of attribute parameters.
-
#requests ⇒ Object
Returns the value of attribute requests.
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) ⇒ Resource
constructor
A new instance of Resource.
- #request(params = {}, &block) ⇒ Object
Methods included from Parameters
Constructor Details
#initialize(params = {}, &block) ⇒ Resource
Returns a new instance of Resource.
5 6 7 |
# File 'lib/doc_smoosher/resource.rb', line 5 def initialize(params = {}, &block) super(params) end |
Instance Attribute Details
#parameters ⇒ Object
Returns the value of attribute parameters.
3 4 5 |
# File 'lib/doc_smoosher/resource.rb', line 3 def parameters @parameters end |
#requests ⇒ Object
Returns the value of attribute requests.
3 4 5 |
# File 'lib/doc_smoosher/resource.rb', line 3 def requests @requests end |
Instance Method Details
#as_json(options = {}) ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/doc_smoosher/resource.rb', line 24 def as_json(={}) json = super if self.requests.length > 0 json.merge( { :requests => self.requests.map(&:as_json) } ) end if self.parameters.length > 0 json.merge( { :parameters => self.parameters.map(&:as_json) } ) end json end |