Class: Qravan::Request
- Inherits:
-
Object
- Object
- Qravan::Request
- Defined in:
- lib/qravan/query/request.rb
Overview
Requests processing class
Instance Attribute Summary collapse
-
#cargo ⇒ Object
Returns the value of attribute cargo.
-
#resources ⇒ Object
Returns the value of attribute resources.
-
#sources ⇒ Object
Returns the value of attribute sources.
Instance Method Summary collapse
- #credentials ⇒ Object
- #extract_resources ⇒ Object
-
#initialize(request, cargo = {}) ⇒ Request
constructor
A new instance of Request.
- #validate ⇒ Object
Constructor Details
#initialize(request, cargo = {}) ⇒ Request
Returns a new instance of Request.
10 11 12 13 14 15 16 17 18 |
# File 'lib/qravan/query/request.rb', line 10 def initialize(request, cargo = {}) @query = request["query"] @credentials = request["credentials"] @resources = [] @cargo ||= cargo validate extract_resources end |
Instance Attribute Details
#cargo ⇒ Object
Returns the value of attribute cargo.
8 9 10 |
# File 'lib/qravan/query/request.rb', line 8 def cargo @cargo end |
#resources ⇒ Object
Returns the value of attribute resources.
8 9 10 |
# File 'lib/qravan/query/request.rb', line 8 def resources @resources end |
#sources ⇒ Object
Returns the value of attribute sources.
8 9 10 |
# File 'lib/qravan/query/request.rb', line 8 def sources @sources end |
Instance Method Details
#credentials ⇒ Object
36 37 38 |
# File 'lib/qravan/query/request.rb', line 36 def credentials @credentials end |
#extract_resources ⇒ Object
24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/qravan/query/request.rb', line 24 def extract_resources = Async::Barrier.new .async do @query.each do |key, resource| @resources << { key => Qravan::Resource.new(key, resource, cargo).extract } end ensure @resources end .wait end |
#validate ⇒ Object
20 21 22 |
# File 'lib/qravan/query/request.rb', line 20 def validate @query end |