Sha256: 601bebba96e3342157c278c9014313bc056c062cd319338293c063ef4e5f1315

Contents?: true

Size: 291 Bytes

Versions: 17

Compression:

Stored size: 291 Bytes

Contents

require 'json'

module PushbulletRuby
  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

17 entries across 16 versions & 2 rubygems

Version Path
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/pushbullet_ruby-1.1.4/lib/pushbullet_ruby/parse_json.rb
tdiary-5.1.6 vendor/bundle/ruby/2.7.0/gems/tdiary-5.1.5/vendor/bundle/ruby/3.0.0/gems/pushbullet_ruby-1.1.4/lib/pushbullet_ruby/parse_json.rb
tdiary-5.1.5 vendor/bundle/ruby/3.0.0/gems/pushbullet_ruby-1.1.4/lib/pushbullet_ruby/parse_json.rb
tdiary-5.1.2 vendor/bundle/ruby/2.6.0/gems/pushbullet_ruby-1.1.4/lib/pushbullet_ruby/parse_json.rb
tdiary-5.1.1 vendor/bundle/ruby/2.6.0/gems/pushbullet_ruby-1.1.4/lib/pushbullet_ruby/parse_json.rb
pushbullet_ruby-1.1.4 lib/pushbullet_ruby/parse_json.rb
tdiary-5.0.8 vendor/bundle/gems/pushbullet_ruby-1.1.3/lib/pushbullet_ruby/parse_json.rb
pushbullet_ruby-1.1.3 lib/pushbullet_ruby/parse_json.rb
pushbullet_ruby-1.1.2 lib/pushbullet_ruby/parse_json.rb
pushbullet_ruby-1.1.1 lib/pushbullet_ruby/parse_json.rb
pushbullet_ruby-1.1.0 lib/pushbullet_ruby/parse_json.rb
pushbullet_ruby-1.0.4.1 lib/pushbullet_ruby/parse_json.rb
pushbullet_ruby-1.0.4 lib/pushbullet_ruby/parse_json.rb
pushbullet_ruby-1.0.3 lib/pushbullet_ruby/parse_json.rb
pushbullet_ruby-1.0.2.1 lib/pushbullet_ruby/parse_json.rb
pushbullet_ruby-1.0.2 lib/pushbullet_ruby/parse_json.rb
pushbullet_ruby-1.0.1 lib/pushbullet_ruby/parse_json.rb