Module: PlataformaSocial

Defined in:
lib/plataforma_social.rb,
lib/plataforma_social/badge.rb,
lib/plataforma_social/domains.rb,
lib/plataforma_social/helpers.rb,
lib/plataforma_social/ranking.rb,
lib/plataforma_social/request.rb,
lib/plataforma_social/support.rb,
lib/plataforma_social/version.rb,
lib/plataforma_social/facebook.rb,
lib/plataforma_social/configuration.rb,
lib/plataforma_social/ranking/custom.rb,
lib/plataforma_social/ranking/general.rb

Defined Under Namespace

Modules: Facebook, Helpers, Support Classes: Badge, Configuration, Ranking, Request

Constant Summary collapse

VERSION =
"0.0.16"

Class Method Summary collapse

Class Method Details

.admin_controller_nameObject



52
53
54
# File 'lib/plataforma_social.rb', line 52

def admin_controller_name
  configuration.admin_controller_name || 'admin'
end

.api_keyObject



23
24
25
# File 'lib/plataforma_social.rb', line 23

def api_key
  configuration.api_key
end

.configurationObject



15
16
17
# File 'lib/plataforma_social.rb', line 15

def configuration
  @configuration ||= Configuration.new
end

.configure {|configuration| ... } ⇒ Object

Yields:



19
20
21
# File 'lib/plataforma_social.rb', line 19

def configure
  yield(configuration)
end

.domains(module_name) ⇒ Object



2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
# File 'lib/plataforma_social/domains.rb', line 2

def self.domains module_name
  domains = {
    :js => 'js',
    :analytics => 'analytics',
    :login => 'login',
    :events => 'events',
    :share => 'share',
    :comments => 'comments',
    :ranking => 'ranking',
    :badge => 'badge',
    :notification => 'notification'
  }

  if domains[module_name.to_sym].present?
    name = domains[module_name.to_sym]

    url = case Rails.env
      when "production"
        "https://#{name}.plataformasocial.com.br"
      when "development" 
        "http://#{name}.dev.plataformasocial.com.br"
      when "test"
        "http://#{name}.dev.plataformasocial.com.br"
      when "staging"
        "http://#{name}.dev.plataformasocial.com.br"
      end
      
    url
  end
end

.facebook_app_idObject



31
32
33
# File 'lib/plataforma_social.rb', line 31

def facebook_app_id
  configuration.facebook_app_id
end

.facebook_app_namespaceObject



39
40
41
# File 'lib/plataforma_social.rb', line 39

def facebook_app_namespace
  configuration.facebook_app_namespace
end

.facebook_app_secretObject



35
36
37
# File 'lib/plataforma_social.rb', line 35

def facebook_app_secret
  configuration.facebook_app_secret
end

.facebook_callback_urlObject



47
48
49
50
# File 'lib/plataforma_social.rb', line 47

def facebook_callback_url
  protocol = Rails.env.development? || Rails.env.staging? ? 'http' : 'https'
  configuration.facebook_callback_url || "#{protocol}://apps.facebook.com/#{configuration.facebook_app_namespace}/"
end

.facebook_scopeObject



43
44
45
# File 'lib/plataforma_social.rb', line 43

def facebook_scope
  configuration.facebook_scope
end

.secretObject



27
28
29
# File 'lib/plataforma_social.rb', line 27

def secret
  configuration.secret
end