fanforce 0.3.11 → 0.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/fanforce/main.rb +7 -5
- data/lib/fanforce/version.rb +1 -1
- metadata +1 -1
data/lib/fanforce/main.rb
CHANGED
@@ -4,20 +4,22 @@ require 'rest-client'
|
|
4
4
|
|
5
5
|
class Fanforce
|
6
6
|
include Fanforce::Utils
|
7
|
-
attr_reader :params
|
8
7
|
########################################################################
|
9
8
|
def initialize(arg={})
|
10
9
|
if arg.is_a?(Hash)
|
11
10
|
add_params(arg)
|
12
|
-
auth(
|
11
|
+
auth(params) if params.length > 0
|
13
12
|
elsif arg.is_a?(String)
|
14
13
|
auth(arg)
|
15
14
|
end
|
16
15
|
end
|
17
16
|
|
18
|
-
def
|
17
|
+
def params
|
19
18
|
@params ||= {}
|
20
|
-
|
19
|
+
end
|
20
|
+
|
21
|
+
def add_params(params)
|
22
|
+
params.merge!(collect_known_params params)
|
21
23
|
end
|
22
24
|
|
23
25
|
def get(path, params={})
|
@@ -95,7 +97,7 @@ class Fanforce
|
|
95
97
|
return @auth_hash if is_blank?(auth_data)
|
96
98
|
auth_data = auth_data.is_a?(Hash) ? auth_data.symbolize_keys : {api_key: auth_data.to_s}
|
97
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], module_id: auth_data[:module_id], behavior_id: auth_data[:behavior_id], widget_id: auth_data[:widget_id])
|
98
|
-
|
100
|
+
params.merge!(@auth_hash)
|
99
101
|
valid_auth?
|
100
102
|
end
|
101
103
|
|
data/lib/fanforce/version.rb
CHANGED