Class: Burrow::Response

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

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(id, params) ⇒ Response

Returns a new instance of Response.



5
6
7
8
# File 'lib/burrow/response.rb', line 5

def initialize(id, params)
  @id     = id
  @params = params
end

Instance Attribute Details

#idObject (readonly)

Returns the value of attribute id.



3
4
5
# File 'lib/burrow/response.rb', line 3

def id
  @id
end

#paramsObject (readonly)

Returns the value of attribute params.



3
4
5
# File 'lib/burrow/response.rb', line 3

def params
  @params
end

Instance Method Details

#attributesObject



14
15
16
17
18
19
20
# File 'lib/burrow/response.rb', line 14

def attributes
  {
    id:     id,
    result: params,
    jsonrpc: '2.0'
  }
end

#jsonObject



10
11
12
# File 'lib/burrow/response.rb', line 10

def json
  JSON.generate(attributes)
end