Class: JapaneseAddressParser::Fetcher::Response
- Inherits:
-
Data
- Object
- Data
- JapaneseAddressParser::Fetcher::Response
- Defined in:
- lib/japanese_address_parser/fetcher.rb,
lib/japanese_address_parser/fetcher.rb,
sig/fetcher.rbs
Overview
取得結果。JS の FetchResponseLike { json(), text(), ok } に対応する。
body は UTF-8 の生文字列、ok は取得成功フラグ。
Instance Attribute Summary collapse
-
#body ⇒ Object
readonly
Returns the value of attribute body.
-
#ok ⇒ Object
readonly
Returns the value of attribute ok.
Class Method Summary collapse
Instance Method Summary collapse
-
#json ⇒ Object
JS: json: async () => JSON.parse(contents.toString('utf-8')).
-
#text ⇒ String
JS: text: async () => contents.toString('utf-8').
Instance Attribute Details
#body ⇒ Object (readonly)
Returns the value of attribute body
19 20 21 |
# File 'lib/japanese_address_parser/fetcher.rb', line 19 def body @body end |
#ok ⇒ Object (readonly)
Returns the value of attribute ok
19 20 21 |
# File 'lib/japanese_address_parser/fetcher.rb', line 19 def ok @ok end |
Class Method Details
Instance Method Details
#json ⇒ Object
JS: json: async () => JSON.parse(contents.toString('utf-8'))
24 25 26 |
# File 'lib/japanese_address_parser/fetcher.rb', line 24 def json ::JSON.parse(body) end |
#text ⇒ String
JS: text: async () => contents.toString('utf-8')
29 30 31 |
# File 'lib/japanese_address_parser/fetcher.rb', line 29 def text body end |