Sha256: 1387a00a6d3cdf936770e38469aee81018c3411061f3a657530b58a5e0bf573b

Contents?: true

Size: 567 Bytes

Versions: 34

Compression:

Stored size: 567 Bytes

Contents

module Sinatra::FanforceHelpers
  require 'fanforce/api'

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

  def ff
    return @ff if @ff.present?
    @ff = Fanforce::API.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

34 entries across 34 versions & 1 rubygems

Version Path
fanforce-plugin-factory-0.20.2 lib/fanforce/plugin_factory/config/helpers/fanforce.rb
fanforce-plugin-factory-0.20.1 lib/fanforce/plugin_factory/config/helpers/fanforce.rb
fanforce-plugin-factory-0.20.0 lib/fanforce/plugin_factory/config/helpers/fanforce.rb
fanforce-plugin-factory-0.19.3 lib/fanforce/plugin_factory/config/helpers/fanforce.rb
fanforce-plugin-factory-0.19.1 lib/fanforce/plugin_factory/config/helpers/fanforce.rb
fanforce-plugin-factory-0.19.0 lib/fanforce/plugin_factory/config/helpers/fanforce.rb
fanforce-plugin-factory-0.18.0 lib/fanforce/plugin_factory/config/helpers/fanforce.rb
fanforce-plugin-factory-0.17.2 lib/fanforce/plugin_factory/config/helpers/fanforce.rb
fanforce-plugin-factory-0.17.1 lib/fanforce/plugin_factory/config/helpers/fanforce.rb
fanforce-plugin-factory-0.17.0 lib/fanforce/plugin_factory/config/helpers/fanforce.rb
fanforce-plugin-factory-0.16.1 lib/fanforce/plugin_factory/config/helpers/fanforce.rb
fanforce-plugin-factory-0.16.0 lib/fanforce/plugin_factory/config/helpers/fanforce.rb
fanforce-plugin-factory-0.15.1 lib/fanforce/plugin_factory/config/helpers/fanforce.rb
fanforce-plugin-factory-0.14.1 lib/fanforce/plugin_factory/config/helpers/fanforce.rb
fanforce-plugin-factory-0.14.0 lib/fanforce/plugin_factory/config/helpers/fanforce.rb
fanforce-plugin-factory-0.13.5 lib/fanforce/plugin_factory/config/helpers/fanforce.rb
fanforce-plugin-factory-0.13.4 lib/fanforce/plugin_factory/config/helpers/fanforce.rb
fanforce-plugin-factory-0.13.3 lib/fanforce/plugin_factory/config/helpers/fanforce.rb
fanforce-plugin-factory-0.13.2 lib/fanforce/plugin_factory/config/helpers/fanforce.rb
fanforce-plugin-factory-0.13.1 lib/fanforce/plugin_factory/config/helpers/fanforce.rb