playapi 0.1.6 → 0.1.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -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(campaign_name = "index")
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(campaign_name, opts = {})
30
+ def get_interactions(opts = {})
31
31
  #* This could just called Playapi::Interaction.list....
32
- url = "api/v2/campaigns/#{campaign_name}/interactions"
33
- get_object(:get, "interactions", url, opts).interactions
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(campaign_name, opts = {})
41
+ def leaders(opts = {})
42
42
  #* This could just call Playapi::Interactions.list with most points params...
43
- url = "api/v2/campaigns/#{campaign_name}/leaders"
44
- get_object(:get, "results", url, opts)
43
+ url = "api/v2/interactions/leaders"
44
+ get_objects(:get, "interactions", url, opts)
45
45
  end
46
46
 
47
47
  def features
@@ -32,7 +32,7 @@ module Playapi
32
32
  end
33
33
  end
34
34
 
35
- def request(method, path, params={}, signature_params=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)
@@ -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://api.papi.io/"}
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"},
@@ -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
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: playapi
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.6
4
+ version: 0.1.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: