Class: Restify::Processors::Base
- Inherits:
-
Object
- Object
- Restify::Processors::Base
- Extended by:
- Forwardable
- Defined in:
- lib/restify/processors/base.rb,
lib/restify/processors/base/parsing.rb
Defined Under Namespace
Modules: Parsing
Instance Attribute Summary collapse
-
#context ⇒ Object
readonly
Returns the value of attribute context.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Class Method Summary collapse
Instance Method Summary collapse
- #body ⇒ Object
-
#initialize(context, response) ⇒ Base
constructor
A new instance of Base.
-
#load ⇒ Object
Return resource or data.
- #resource ⇒ Object
Constructor Details
#initialize(context, response) ⇒ Base
Returns a new instance of Base.
12 13 14 15 |
# File 'lib/restify/processors/base.rb', line 12 def initialize(context, response) @context = context @response = response end |
Instance Attribute Details
#context ⇒ Object (readonly)
Returns the value of attribute context.
8 9 10 |
# File 'lib/restify/processors/base.rb', line 8 def context @context end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
10 11 12 |
# File 'lib/restify/processors/base.rb', line 10 def response @response end |
Class Method Details
.accept?(_response) ⇒ Boolean
61 62 63 |
# File 'lib/restify/processors/base.rb', line 61 def accept?(_response) false end |
Instance Method Details
#body ⇒ Object
42 |
# File 'lib/restify/processors/base.rb', line 42 delegate body: :@response |
#load ⇒ Object
Return resource or data.
Should be overridden in subclass.
36 37 38 |
# File 'lib/restify/processors/base.rb', line 36 def load body end |
#resource ⇒ Object
17 18 19 20 21 22 23 24 25 26 27 28 29 30 |
# File 'lib/restify/processors/base.rb', line 17 def resource @resource ||= begin resource = load unless resource.is_a? Restify::Resource resource = Resource.new context, response: response, data: resource end resource._restify_response = response merge_relations! resource._restify_relations resource end end |