Sha256: 4c84bcb6d90e937d261e6357846e1ff30e1783e05c394bc4c7d2a1f32db01d09

Contents?: true

Size: 512 Bytes

Versions: 2

Compression:

Stored size: 512 Bytes

Contents

class Jawbit::FitbitRack
  delegate :instrument, to: ActiveSupport::Notifications

  def initialize(subscriber_id, consumer_secret)
    @subscriber_id, @consumer_secret = subscriber_id, consumer_secret
  end

  def call(env)
    request = Rack::Request.new env

    instrument 'notification.fitbit', json: json(request)

    [204, {}, ['']]
  end

  private

  attr_reader :subscriber_id, :consumer_secret

  def json(request)
    MultiJson.load request.body.read
  rescue MultiJson::ParseError
    []
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
jawbit-0.0.3 lib/jawbit/fitbit_rack.rb
jawbit-0.0.2 lib/jawbit/fitbit_rack.rb