Class: Fcmpush::BatchResponse
- Inherits:
-
Net::HTTPResponse
- Object
- Net::HTTPResponse
- Fcmpush::BatchResponse
- Defined in:
- lib/fcmpush/batch_response.rb
Constant Summary collapse
- HAS_SYMBOL_GC =
RUBY_VERSION > '2.2.0'
Instance Method Summary collapse
- #failure_count ⇒ Object
- #inspect ⇒ Object (also: #to_s)
- #json ⇒ Object
- #parsable? ⇒ Boolean
- #success_count ⇒ Object
Instance Method Details
#failure_count ⇒ Object
26 27 28 |
# File 'lib/fcmpush/batch_response.rb', line 26 def failure_count @failure_count ||= json.select { |i| i[:error] }.size end |
#inspect ⇒ Object Also known as: to_s
13 14 15 |
# File 'lib/fcmpush/batch_response.rb', line 13 def inspect "#<BatchResponse response: #{response.inspect}, json: #{json}>" end |
#json ⇒ Object
9 10 11 |
# File 'lib/fcmpush/batch_response.rb', line 9 def json parsable? ? @parsed ||= parse_body(body) : nil end |
#parsable? ⇒ Boolean
18 19 20 |
# File 'lib/fcmpush/batch_response.rb', line 18 def parsable? !body.nil? && !body.empty? end |
#success_count ⇒ Object
22 23 24 |
# File 'lib/fcmpush/batch_response.rb', line 22 def success_count @success_count ||= json.length - failure_count end |