Class: Minecraft::JSONAPIv2::Response
- Inherits:
-
Object
- Object
- Minecraft::JSONAPIv2::Response
- Defined in:
- lib/minecraft_jsonapiv2/response.rb
Instance Attribute Summary collapse
-
#raw_response ⇒ Object
readonly
Returns the value of attribute raw_response.
-
#response ⇒ Object
readonly
Returns the value of attribute response.
Instance Method Summary collapse
-
#initialize(data) ⇒ Response
constructor
A new instance of Response.
Constructor Details
#initialize(data) ⇒ Response
Returns a new instance of Response.
5 6 7 8 9 10 11 12 13 14 15 16 17 |
# File 'lib/minecraft_jsonapiv2/response.rb', line 5 def initialize(data) @response = {} data = JSON.parse(data) @raw_response = data if data.is_a? Array data.each do |d| @response[d['source'].gsub(/\./, '_')] = d['success'] end else @response[data['source'].gsub(/\./, '_')] = data['success'] end @response.rubyify_keys! end |
Instance Attribute Details
#raw_response ⇒ Object (readonly)
Returns the value of attribute raw_response.
4 5 6 |
# File 'lib/minecraft_jsonapiv2/response.rb', line 4 def raw_response @raw_response end |
#response ⇒ Object (readonly)
Returns the value of attribute response.
4 5 6 |
# File 'lib/minecraft_jsonapiv2/response.rb', line 4 def response @response end |