Class: Qravan::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/qravan/query/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(request) ⇒ Response

Returns a new instance of Response.



9
10
11
12
13
# File 'lib/qravan/query/response.rb', line 9

def initialize(request)
  @request ||= request
  @resources = request.resources
  @credentials = request.credentials
end

Instance Attribute Details

#credentialsObject

Returns the value of attribute credentials.



7
8
9
# File 'lib/qravan/query/response.rb', line 7

def credentials
  @credentials
end

#requestObject

Returns the value of attribute request.



5
6
7
# File 'lib/qravan/query/response.rb', line 5

def request
  @request
end

#resourcesObject

Returns the value of attribute resources.



6
7
8
# File 'lib/qravan/query/response.rb', line 6

def resources
  @resources
end

Instance Method Details

#answerObject



19
20
21
22
23
24
# File 'lib/qravan/query/response.rb', line 19

def answer
  {
    "response": @resources,
    "credentials": Qravan::Credentials::Query.new(@credentials).credentials
  }.to_json
end

#validateObject



15
16
17
# File 'lib/qravan/query/response.rb', line 15

def validate
  @request
end