Class: Dialed::HTTP::Response::JsonBody
- Inherits:
-
Body
- Object
- Body
- Dialed::HTTP::Response::JsonBody
show all
- Defined in:
- lib/dialed/http/response/json_body.rb
Instance Method Summary
collapse
Methods inherited from Body
#http2?, #initialize, #to_io
Instance Method Details
#as_json ⇒ Object
19
20
21
|
# File 'lib/dialed/http/response/json_body.rb', line 19
def as_json
@__as_json ||= JSON.parse(read, symbolize_names: false)
end
|
#deconstruct_keys(keys) ⇒ Object
23
24
25
|
# File 'lib/dialed/http/response/json_body.rb', line 23
def deconstruct_keys(keys)
keys ? to_h.slice(*keys) : to_h
end
|
#read ⇒ Object
6
7
8
9
|
# File 'lib/dialed/http/response/json_body.rb', line 6
def read
buffered_internal_body
end
|
#to_h ⇒ Object
15
16
17
|
# File 'lib/dialed/http/response/json_body.rb', line 15
def to_h
@__to_h ||= JSON.parse(read, symbolize_names: true)
end
|
#to_json ⇒ Object
4
|
# File 'lib/dialed/http/response/json_body.rb', line 4
alias to_json to_s
|
#to_s ⇒ Object
11
12
13
|
# File 'lib/dialed/http/response/json_body.rb', line 11
def to_s
read.to_s
end
|