Class: Datomic::Client::Response

Inherits:
Object
  • Object
show all
Defined in:
lib/datomic/client/response.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(body, response, request) ⇒ Response

Returns a new instance of Response.



11
12
13
14
15
16
17
# File 'lib/datomic/client/response.rb', line 11

def initialize(body, response, request)
  @body = body
  @args = request.args
  @net_http = response
  # used to parse response cookies and headers
  @rest_client_response = RestClient::Response.create(body, response, @args)
end

Instance Attribute Details

#argsObject (readonly)

Args used to make request



9
10
11
# File 'lib/datomic/client/response.rb', line 9

def args
  @args
end

#bodyObject (readonly)

Response body as a string



5
6
7
# File 'lib/datomic/client/response.rb', line 5

def body
  @body
end

#net_httpObject (readonly)

Underlying Net:HTTP response



7
8
9
# File 'lib/datomic/client/response.rb', line 7

def net_http
  @net_http
end

Instance Method Details

#dataObject

converts an EDN body to a data structure i.e. array, hash



20
21
22
# File 'lib/datomic/client/response.rb', line 20

def data
  @data ||= EDN.read @body
end