fanforce 0.3.19 → 0.4.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/lib/fanforce/main.rb +3 -3
- data/lib/fanforce/utils.rb +15 -15
- data/lib/fanforce/version.rb +1 -1
- data/lib/ff_globals.rb +4 -8
- metadata +1 -1
data/Gemfile.lock
CHANGED
data/lib/fanforce/main.rb
CHANGED
@@ -65,8 +65,8 @@ class Fanforce
|
|
65
65
|
{success: true}
|
66
66
|
end
|
67
67
|
|
68
|
-
def track(
|
69
|
-
post '/bie/track', req_params.merge(
|
68
|
+
def track(behavior_plugin_id, req_params)
|
69
|
+
post '/bie/track', req_params.merge(behavior_plugin_id: behavior_plugin_id)
|
70
70
|
{success: true}
|
71
71
|
end
|
72
72
|
|
@@ -96,7 +96,7 @@ class Fanforce
|
|
96
96
|
@auth_hash ||= {}
|
97
97
|
return @auth_hash if is_blank?(auth_data)
|
98
98
|
auth_data = auth_data.is_a?(Hash) ? auth_data.symbolize_keys : {api_key: auth_data.to_s}
|
99
|
-
@auth_hash.merge! remove_nil_values(api_key: auth_data[:api_key], fanforce_id: auth_data[:fanforce_id], fanforce_slug: auth_data[:fanforce_slug], app_id: auth_data[:app_id],
|
99
|
+
@auth_hash.merge! remove_nil_values(api_key: auth_data[:api_key], fanforce_id: auth_data[:fanforce_id], fanforce_slug: auth_data[:fanforce_slug], app_id: auth_data[:app_id], plugin_id: auth_data[:plugin_id], behavior_plugin_id: auth_data[:behavior_plugin_id], widget_id: auth_data[:widget_id])
|
100
100
|
params.merge!(@auth_hash)
|
101
101
|
valid_auth?
|
102
102
|
end
|
data/lib/fanforce/utils.rb
CHANGED
@@ -21,14 +21,14 @@ module Fanforce::Utils
|
|
21
21
|
def valid_fanforce_request?(params=@params)
|
22
22
|
return false if !params.is_a?(Hash)
|
23
23
|
return false if is_blank?(params[:fanforce_id])
|
24
|
-
return false if is_blank?(params[:app_id]) and is_blank?(params[:
|
24
|
+
return false if is_blank?(params[:app_id]) and is_blank?(params[:behavior_plugin_id]) and is_blank?(params[:plugin_id]) and is_blank?(params[:widget_id])
|
25
25
|
return true
|
26
26
|
end
|
27
27
|
|
28
28
|
def valid_install_request?(params=@params)
|
29
29
|
return false if !params.is_a?(Hash)
|
30
30
|
return false if is_blank?(params[:fanforce_id])
|
31
|
-
return false if is_blank?(params[:app_id]) and is_blank?(params[:
|
31
|
+
return false if is_blank?(params[:app_id]) and is_blank?(params[:behavior_plugin_id]) and is_blank?(params[:plugin_id]) and is_blank?(params[:widget_id])
|
32
32
|
return false if is_blank?(params[:api_key])
|
33
33
|
return true
|
34
34
|
end
|
@@ -36,7 +36,7 @@ module Fanforce::Utils
|
|
36
36
|
def valid_uninstall_request?(params=@params)
|
37
37
|
return false if !params.is_a?(Hash)
|
38
38
|
return false if is_blank?(params[:fanforce_id])
|
39
|
-
return false if is_blank?(params[:app_id]) and is_blank?(params[:
|
39
|
+
return false if is_blank?(params[:app_id]) and is_blank?(params[:behavior_plugin_id]) and is_blank?(params[:plugin_id]) and is_blank?(params[:widget_id])
|
40
40
|
return false if is_blank?(params[:api_key])
|
41
41
|
return true
|
42
42
|
end
|
@@ -48,23 +48,23 @@ module Fanforce::Utils
|
|
48
48
|
def collect_known_params(params)
|
49
49
|
params = params.symbolize_keys
|
50
50
|
if is_present?(params[:app_id])
|
51
|
-
|
52
|
-
|
53
|
-
elsif is_present?(params[:
|
54
|
-
|
55
|
-
|
56
|
-
elsif is_present?(params[:
|
57
|
-
|
58
|
-
|
51
|
+
addon_type = :app
|
52
|
+
addon_id = params[:app_id]
|
53
|
+
elsif is_present?(params[:behavior_plugin_id])
|
54
|
+
addon_type = :plugin
|
55
|
+
addon_id = params[:behavior_plugin_id]
|
56
|
+
elsif is_present?(params[:plugin_id])
|
57
|
+
addon_type = :plugin
|
58
|
+
addon_id = params[:plugin_id]
|
59
59
|
elsif is_present?(params[:widget_id])
|
60
|
-
|
61
|
-
|
60
|
+
addon_type = :widget
|
61
|
+
addon_id = params[:widget_id]
|
62
62
|
end
|
63
|
-
remove_nil_values(:"#{
|
63
|
+
remove_nil_values(:"#{addon_type}_id" => params[:"#{addon_type}_id"], addon_type: addon_type, addon_id: addon_id, fanforce_id: params[:fanforce_id], fanforce_slug: params[:fanforce_slug], api_key: params[:api_key], session_id: params[:session_id])
|
64
64
|
end
|
65
65
|
|
66
66
|
def remove_internal_params(params)
|
67
|
-
params.clone.delete_if { |k,v| [:app_id, :
|
67
|
+
params.clone.delete_if { |k,v| [:app_id, :behavior_plugin_id, :plugin_id, :widget_id, :addon_type, :addon_id, :fanforce_id, :fanforce_slug, :api_key].include? k }
|
68
68
|
end
|
69
69
|
|
70
70
|
def remove_sensitive_params(params)
|
data/lib/fanforce/version.rb
CHANGED
data/lib/ff_globals.rb
CHANGED
@@ -6,8 +6,7 @@ if !ENV['RACK_ENV'] or ENV['RACK_ENV'] == 'development'
|
|
6
6
|
$WEBSITE_DOMAIN = $BASE_DOMAIN
|
7
7
|
|
8
8
|
$SMARTURL_DOMAIN = 'fanforc.gg'
|
9
|
-
$
|
10
|
-
$FF_BEHAVIOR_DOMAIN = 'ffbehavior.gg'
|
9
|
+
$FF_PLUGIN_DOMAIN = 'ffmodule.gg'
|
11
10
|
$FF_APP_DOMAIN = 'ffapp.gg'
|
12
11
|
$FF_WIDGET_DOMAIN = 'ffwidget.gg'
|
13
12
|
|
@@ -25,8 +24,7 @@ elsif ENV['RACK_ENV'] == 'test'
|
|
25
24
|
$WEBSITE_DOMAIN = $BASE_DOMAIN
|
26
25
|
|
27
26
|
$SMARTURL_DOMAIN = 'fanforc.gg'
|
28
|
-
$
|
29
|
-
$FF_BEHAVIOR_DOMAIN = 'ffbehavior.gg'
|
27
|
+
$FF_PLUGIN_DOMAIN = 'ffmodule.gg'
|
30
28
|
$FF_WIDGET_DOMAIN = 'ffwidget.gg'
|
31
29
|
$FF_APP_DOMAIN = 'ffapp.gg'
|
32
30
|
|
@@ -44,8 +42,7 @@ elsif ENV['RACK_ENV'] == 'qa'
|
|
44
42
|
$WEBSITE_DOMAIN = $BASE_DOMAIN
|
45
43
|
|
46
44
|
$SMARTURL_DOMAIN = 'fanforc.us'
|
47
|
-
$
|
48
|
-
$FF_BEHAVIOR_DOMAIN = 'ffbehavior.us'
|
45
|
+
$FF_PLUGIN_DOMAIN = 'ffmodule.us'
|
49
46
|
$FF_APP_DOMAIN = 'ffapp.us'
|
50
47
|
$FF_WIDGET_DOMAIN = 'ffwidget.us'
|
51
48
|
|
@@ -63,8 +60,7 @@ elsif ENV['RACK_ENV'] == 'production'
|
|
63
60
|
$WEBSITE_DOMAIN = $BASE_DOMAIN
|
64
61
|
|
65
62
|
$SMARTURL_DOMAIN = 'fanforce.io'
|
66
|
-
$
|
67
|
-
$FF_BEHAVIOR_DOMAIN = 'ffbehavior.io'
|
63
|
+
$FF_PLUGIN_DOMAIN = 'ffmodule.io'
|
68
64
|
$FF_APP_DOMAIN = 'ffapp.io'
|
69
65
|
$FF_WIDGET_DOMAIN = 'ffwidget.io'
|
70
66
|
|