Sha256: 2d3647b7df2d3090d7b003bde49e3d4a479ad1c42400bd9b94560644c7acf699

Contents?: true

Size: 558 Bytes

Versions: 1

Compression:

Stored size: 558 Bytes

Contents

module Sinatra::FanforceHelpers
  require 'fanforce'

  def fanforce_id
    @fanforce_id = params[:fanforce_id] || ff.params[:fanforce_id]
  end

  def ff
    return @ff if @ff.present?
    @ff = Fanforce.new(params)
    #return @ff if !@ff.valid_fanforce_request? and !@ff.valid_fanforce_js_request?

    @ff.auth Sinatra::FanforceHelpers.find_api_key(ff.params[:fanforce_id])
    @ff
  end

  def self.find_api_key(fanforce_id, addon_type=:plugin, addon_id=FanforcePlugin._id)
    $Redis.get("installed:#{addon_type}-#{addon_id}:#{fanforce_id}")
  end

end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
fanforce-plugin-factory-0.7.0 lib/fanforce/plugin_factory/config/helpers/fanforce.rb