Class: Fcmpush::JsonResponse

Inherits:
Net::HTTPResponse
  • Object
show all
Defined in:
lib/fcmpush/json_response.rb

Constant Summary collapse

HAS_SYMBOL_GC =
RUBY_VERSION > '2.2.0'

Instance Method Summary collapse

Instance Method Details

#inspectObject Also known as: to_s



14
15
16
# File 'lib/fcmpush/json_response.rb', line 14

def inspect
  "#<JsonResponse response: #{response.inspect}, json: #{json}>"
end

#jsonObject



10
11
12
# File 'lib/fcmpush/json_response.rb', line 10

def json
  parsable? ? JSON.parse(body, symbolize_names: HAS_SYMBOL_GC) : nil
end

#parsable?Boolean

Returns:

  • (Boolean)


19
20
21
# File 'lib/fcmpush/json_response.rb', line 19

def parsable?
  !body.nil? && !body.empty?
end