Class: Fugle::Response Private
- Inherits:
-
Object
- Object
- Fugle::Response
- Defined in:
- lib/fugle/response.rb
Overview
This class is part of a private API. You should avoid using this class if possible, as it may be removed or be changed in the future.
API Response
Instance Attribute Summary collapse
- #body ⇒ Object readonly private
- #info ⇒ Object readonly private
- #version ⇒ Object readonly private
Instance Method Summary collapse
-
#initialize(body, attributes) ⇒ Response
constructor
private
Create a new response.
-
#to_h ⇒ Hash
private
Convert to Hash.
-
#to_json(*args) ⇒ String
private
Convert to JSON.
Constructor Details
#initialize(body, attributes) ⇒ Response
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Create a new response
19 20 21 22 23 |
# File 'lib/fugle/response.rb', line 19 def initialize(body, attributes) @version = attributes.fetch('apiVersion', nil) @info = Information.new(attributes.dig('data', 'info')) @body = body.new(attributes.dig('data', body.data_name)) end |
Instance Attribute Details
#body ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/fugle/response.rb', line 11 def body @body end |
#info ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/fugle/response.rb', line 11 def info @info end |
#version ⇒ Object (readonly)
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
11 12 13 |
# File 'lib/fugle/response.rb', line 11 def version @version end |
Instance Method Details
#to_h ⇒ Hash
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Convert to Hash
31 32 33 34 35 36 37 |
# File 'lib/fugle/response.rb', line 31 def to_h { version: @version, info: @info, body: @body } end |
#to_json(*args) ⇒ String
This method is part of a private API. You should avoid using this method if possible, as it may be removed or be changed in the future.
Convert to JSON
45 46 47 |
# File 'lib/fugle/response.rb', line 45 def to_json(*args) to_h.to_json(*args) end |