Sha256: 5d1e5ed6464218ce440441f96f568257e5797e41912c0f2bdc5d556d43e6f0d8
Contents?: true
Size: 683 Bytes
Versions: 4
Compression:
Stored size: 683 Bytes
Contents
module Urbanairship module Response module InstanceMethods attr_accessor :ua_response, :ua_options def code (ua_options[:code] || ua_response.code).to_s end def success? !!(code =~ /^2/) end end def self.wrap(response, options = {}) if options[:body] output = options[:body] else begin output = JSON.parse(response.body || '{}') rescue JSON::ParserError => e output = {} end end output.extend(Urbanairship::Response::InstanceMethods) output.ua_response = response output.ua_options = options return output end end end
Version data entries
4 entries across 4 versions & 2 rubygems