playapi 0.1.6 → 0.1.7
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/playapi/campaign.rb +8 -8
- data/lib/playapi/client.rb +1 -1
- data/lib/playapi/configurable.rb +2 -1
- data/lib/playapi/interaction.rb +2 -2
- metadata +1 -1
data/lib/playapi/campaign.rb
CHANGED
@@ -13,8 +13,8 @@ module Playapi
|
|
13
13
|
# Get the primary campaign for which you are currently authorized, one will be able to
|
14
14
|
# pass the name of the campaign, if your credentials are good for multiple campaigns...
|
15
15
|
# but not yet.
|
16
|
-
def get
|
17
|
-
url = "api/v2/campaigns
|
16
|
+
def get
|
17
|
+
url = "api/v2/campaigns"
|
18
18
|
#url += "/#{campaign_name}" unless campaign_name == nil
|
19
19
|
get_object(:get, "campaign", url)
|
20
20
|
end
|
@@ -27,10 +27,10 @@ module Playapi
|
|
27
27
|
# :limit=INTEGER (Limit to a number of entries, defaults to 10)
|
28
28
|
# :page=INTEGER (Determines the offset for limit, defaults to 1)
|
29
29
|
# :type=STRING (Valid options are Instapic, Tweet, Checkin)
|
30
|
-
def get_interactions(
|
30
|
+
def get_interactions(opts = {})
|
31
31
|
#* This could just called Playapi::Interaction.list....
|
32
|
-
url = "api/v2/
|
33
|
-
|
32
|
+
url = "api/v2/interactions"
|
33
|
+
get_objects(:get, "interactions", url, opts).interactions
|
34
34
|
end
|
35
35
|
|
36
36
|
# Get interactions with the most points (highest score) for a campaign
|
@@ -38,10 +38,10 @@ module Playapi
|
|
38
38
|
# :limit=INTEGER (Limit to a number of entries, defaults to 10)
|
39
39
|
# :page=INTEGER (Determines the offset for limit, defaults to 1)
|
40
40
|
# :type=STRING (Valid options are Instapic, Tweet, Checkin)
|
41
|
-
def leaders(
|
41
|
+
def leaders(opts = {})
|
42
42
|
#* This could just call Playapi::Interactions.list with most points params...
|
43
|
-
url = "api/v2/
|
44
|
-
|
43
|
+
url = "api/v2/interactions/leaders"
|
44
|
+
get_objects(:get, "interactions", url, opts)
|
45
45
|
end
|
46
46
|
|
47
47
|
def features
|
data/lib/playapi/client.rb
CHANGED
@@ -32,7 +32,7 @@ module Playapi
|
|
32
32
|
end
|
33
33
|
end
|
34
34
|
|
35
|
-
def request(method, path, params={}, signature_params=
|
35
|
+
def request(method, path, params={}, signature_params={})
|
36
36
|
connection.send(method.to_sym, path, params) do |request|
|
37
37
|
request.headers["x-authorization"] = auth_header(method.to_sym, path, signature_params).to_s
|
38
38
|
request.headers.merge!(default_headers)
|
data/lib/playapi/configurable.rb
CHANGED
@@ -24,6 +24,7 @@ module Playapi
|
|
24
24
|
:connection_options,
|
25
25
|
:identity_map,
|
26
26
|
:connection_middleware,
|
27
|
+
:campaign_name
|
27
28
|
]
|
28
29
|
end
|
29
30
|
|
@@ -45,7 +46,7 @@ module Playapi
|
|
45
46
|
end
|
46
47
|
|
47
48
|
def reset!
|
48
|
-
defaultz = {client_id: "F1Ox4PEhf1eiNGRge7kscIRgay1mh8cbi2zruIC1OI", client_secret: "xLeR0lXVdEtfjwP04w4FJKZm8KxS97Qg5o8Xbyw3JeE", oauth_token: "KqoCXCoyhrJTyGFtCYmiUcWModkTYBILiMHyKGQCBYg", token_secret: "b63V8SyY9ip8yigE5o6bsf3HFyza1wRfLnl3HyhhPz4", endpoint: "http://
|
49
|
+
defaultz = {campaign_name: "fishing", client_id: "F1Ox4PEhf1eiNGRge7kscIRgay1mh8cbi2zruIC1OI", client_secret: "xLeR0lXVdEtfjwP04w4FJKZm8KxS97Qg5o8Xbyw3JeE", oauth_token: "KqoCXCoyhrJTyGFtCYmiUcWModkTYBILiMHyKGQCBYg", token_secret: "b63V8SyY9ip8yigE5o6bsf3HFyza1wRfLnl3HyhhPz4", endpoint: "http://localhost:5000/"}
|
49
50
|
# we can probably chuck conn_ops
|
50
51
|
conn_ops = {
|
51
52
|
:connection_options => {:headers => {:accept => "application/json", :user_agent => "PlayAPI Gem 0.1.1"},
|
data/lib/playapi/interaction.rb
CHANGED
@@ -107,8 +107,8 @@ module Playapi
|
|
107
107
|
|
108
108
|
def classed_interaction(type="Custom", opts = {})
|
109
109
|
url = "api/v2/interactions"
|
110
|
-
validator = "Playapi::Validation::#{type.split('_').map {|w| w.capitalize}.join}".split("::").inject(Module) {|acc, val| acc.const_get(val)}
|
111
|
-
validator.validate(opts)
|
110
|
+
#validator = "Playapi::Validation::#{type.split('_').map {|w| w.capitalize}.join}".split("::").inject(Module) {|acc, val| acc.const_get(val)}
|
111
|
+
#validator.validate(opts)
|
112
112
|
get_object(:post, "interaction", url, {:interaction => opts, :type => type})
|
113
113
|
end
|
114
114
|
|