Sha256: fdd2a3a91ca6811225ec5ecac505ad954233b788bdcc9ecf8c77b1e0457e99d0

Contents?: true

Size: 589 Bytes

Versions: 36

Compression:

Stored size: 589 Bytes

Contents

module Sinatra::FanforceHelpers
  require 'fanforce/api'

  def organization_id
    @organization_id = params[:organization_id] || ff.params[:organization_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[:organization_id])
    @ff
  end

  def self.find_api_key(organization_id, addon_type=:app, addon_id=FanforceApp._id)
    $Redis.get("installed:#{addon_type}-#{addon_id}:#{organization_id}")
  end

end

Version data entries

36 entries across 36 versions & 1 rubygems

Version Path
fanforce-app-factory-1.4.3 lib/fanforce/app_factory/config/helpers/fanforce.rb
fanforce-app-factory-1.4.2 lib/fanforce/app_factory/config/helpers/fanforce.rb
fanforce-app-factory-1.4.1 lib/fanforce/app_factory/config/helpers/fanforce.rb
fanforce-app-factory-1.4.0 lib/fanforce/app_factory/config/helpers/fanforce.rb
fanforce-app-factory-0.40.1 lib/fanforce/app_factory/config/helpers/fanforce.rb
fanforce-app-factory-0.40.0 lib/fanforce/app_factory/config/helpers/fanforce.rb
fanforce-app-factory-0.39.1 lib/fanforce/app_factory/config/helpers/fanforce.rb
fanforce-app-factory-0.39.0 lib/fanforce/app_factory/config/helpers/fanforce.rb
fanforce-app-factory-0.38.2 lib/fanforce/app_factory/config/helpers/fanforce.rb
fanforce-app-factory-0.38.1 lib/fanforce/app_factory/config/helpers/fanforce.rb
fanforce-app-factory-0.38.0 lib/fanforce/app_factory/config/helpers/fanforce.rb
fanforce-app-factory-0.37.1 lib/fanforce/app_factory/config/helpers/fanforce.rb
fanforce-app-factory-0.37.0 lib/fanforce/app_factory/config/helpers/fanforce.rb
fanforce-app-factory-0.36.0 lib/fanforce/app_factory/config/helpers/fanforce.rb
fanforce-app-factory-0.35.1 lib/fanforce/app_factory/config/helpers/fanforce.rb
fanforce-app-factory-0.34.2 lib/fanforce/app_factory/config/helpers/fanforce.rb
fanforce-app-factory-0.34.1 lib/fanforce/app_factory/config/helpers/fanforce.rb
fanforce-app-factory-0.34.0 lib/fanforce/app_factory/config/helpers/fanforce.rb
fanforce-app-factory-0.31.1 lib/fanforce/app_factory/config/helpers/fanforce.rb
fanforce-app-factory-0.31.0 lib/fanforce/app_factory/config/helpers/fanforce.rb