Sha256: 7885a0545f60f275d48d9e4aff0f7c44cc5071b3666810f53edca8081e593cea
Contents?: true
Size: 678 Bytes
Versions: 14
Compression:
Stored size: 678 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 output = {} end end output.extend(Urbanairship::Response::InstanceMethods) output.ua_response = response output.ua_options = options return output end end end
Version data entries
14 entries across 14 versions & 2 rubygems