fanforce 0.1.3 → 0.1.4
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/fanforce/main.rb +5 -5
- data/lib/fanforce/utils.rb +3 -3
- data/lib/fanforce/version.rb +1 -1
- metadata +1 -1
data/lib/fanforce/main.rb
CHANGED
@@ -63,17 +63,17 @@ class Fanforce
|
|
63
63
|
response
|
64
64
|
end
|
65
65
|
|
66
|
-
def auth(
|
67
|
-
if present?(
|
68
|
-
|
69
|
-
@auth_hash
|
66
|
+
def auth(auth_hash=nil)
|
67
|
+
if present?(auth_hash)
|
68
|
+
auth_hash = auth_hash.is_a?(Hash) ? auth_hash.symbolize_keys : {api_key: auth_hash}
|
69
|
+
@auth_hash[:api_key] if present?(auth_hash[:api_key])
|
70
70
|
@auth_hash[:fanforce_id] if present?(auth_hash[:fanforce_id])
|
71
71
|
end
|
72
72
|
@auth_hash
|
73
73
|
end
|
74
74
|
|
75
75
|
def valid_auth?
|
76
|
-
present?(@auth_hash) and present?(@auth_hash[:
|
76
|
+
present?(@auth_hash) and present?(@auth_hash[:api_key])
|
77
77
|
end
|
78
78
|
|
79
79
|
def apply_auth(params)
|
data/lib/fanforce/utils.rb
CHANGED
@@ -22,7 +22,7 @@ module Fanforce::Utils
|
|
22
22
|
return false if !params.is_a?(Hash)
|
23
23
|
return false if blank?(params[:fanforce_id])
|
24
24
|
return false if blank?(params[:app_id]) and blank?(params[:behavior_id]) and blank?(params[:module_id]) and blank?(params[:widget_id])
|
25
|
-
return false if blank?(params[:
|
25
|
+
return false if blank?(params[:api_key])
|
26
26
|
return true
|
27
27
|
end
|
28
28
|
|
@@ -30,7 +30,7 @@ module Fanforce::Utils
|
|
30
30
|
return false if !params.is_a?(Hash)
|
31
31
|
return false if blank?(params[:fanforce_id])
|
32
32
|
return false if blank?(params[:app_id]) and blank?(params[:behavior_id]) and blank?(params[:module_id]) and blank?(params[:widget_id])
|
33
|
-
return false if blank?(params[:
|
33
|
+
return false if blank?(params[:api_key])
|
34
34
|
return true
|
35
35
|
end
|
36
36
|
|
@@ -48,7 +48,7 @@ module Fanforce::Utils
|
|
48
48
|
plugin_type = :widget
|
49
49
|
plugin_id = params[:widget_id]
|
50
50
|
end
|
51
|
-
{:"#{plugin_type}_id" => params["#{plugin_type}_id"], plugin_type: plugin_type, plugin_id: plugin_id, fanforce_id: params[:fanforce_id],
|
51
|
+
{:"#{plugin_type}_id" => params["#{plugin_type}_id"], plugin_type: plugin_type, plugin_id: plugin_id, fanforce_id: params[:fanforce_id], api_key: params[:api_key]}
|
52
52
|
end
|
53
53
|
|
54
54
|
def self.parse_url(raw_url)
|
data/lib/fanforce/version.rb
CHANGED