Sha256: 566649daea88ae598463db9453c3e9ca5cf5cc2d63ead54ab5e87b4496cf661f

Contents?: true

Size: 274 Bytes

Versions: 3

Compression:

Stored size: 274 Bytes

Contents

require 'json'

module Washbullet
  class ParseJSON < Faraday::Response::Middleware
    def on_complete(env)
      env[:body] = JSON.parse(env[:body]) unless unparsable_status_codes.include?(env.status)
    end

    def unparsable_status_codes
      [204]
    end
  end
end

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
washbullet-0.4.0 lib/washbullet/parse_json.rb
washbullet-0.3.1 lib/washbullet/parse_json.rb
washbullet-0.3.0 lib/washbullet/parse_json.rb