Sha256: 357f476c59518553f822d4d8f1e735cfab20c4fd03f95bb4a1a3f988176c84cd

Contents?: true

Size: 587 Bytes

Versions: 11

Compression:

Stored size: 587 Bytes

Contents

module Fanforce::Plugin::Sinatra::FanforceHelpers
  require 'fanforce/api'

  def organization_id
    @organization_id ||= params[:organization_id] || (params[:bie_metadata][:oid] if params[:bie_metadata].is_a?(Hash))
  end

  def ff
    return @ff if @ff.present?
    api_key = Fanforce::Plugin::Sinatra::FanforceHelpers.find_api_key(organization_id) if organization_id
    @ff = Fanforce::API.new(api_key)
  end

  def self.find_api_key(organization_id, addon_type=:plugin, addon_id=Plugin._id)
    Plugin.redis.get("installed:#{addon_type}-#{addon_id}:#{organization_id}")
  end

end

Version data entries

11 entries across 11 versions & 1 rubygems

Version Path
fanforce-plugin-factory-2.0.0.rc3 lib/fanforce/plugin_factory/sinatra/helpers/fanforce.rb
fanforce-plugin-factory-1.6.1 lib/fanforce/plugin_factory/sinatra/helpers/fanforce.rb
fanforce-plugin-factory-2.0.0.rc2 lib/fanforce/plugin_factory/sinatra/helpers/fanforce.rb
fanforce-plugin-factory-2.0.0.rc1 lib/fanforce/plugin_factory/sinatra/helpers/fanforce.rb
fanforce-plugin-factory-1.6.0 lib/fanforce/plugin_factory/sinatra/helpers/fanforce.rb
fanforce-plugin-factory-1.6.0.rc6 lib/fanforce/plugin_factory/sinatra/helpers/fanforce.rb
fanforce-plugin-factory-1.6.0.rc5 lib/fanforce/plugin_factory/sinatra/helpers/fanforce.rb
fanforce-plugin-factory-1.6.0.rc4 lib/fanforce/plugin_factory/sinatra/helpers/fanforce.rb
fanforce-plugin-factory-1.6.0.rc3 lib/fanforce/plugin_factory/sinatra/helpers/fanforce.rb
fanforce-plugin-factory-1.6.0.rc2 lib/fanforce/plugin_factory/sinatra/helpers/fanforce.rb
fanforce-plugin-factory-1.6.0.rc1 lib/fanforce/plugin_factory/sinatra/helpers/fanforce.rb