gamifier 1.0.4 → 1.0.5

Sign up to get free protection for your applications and to get access to all the features.
@@ -7,14 +7,22 @@ module Gamifier
7
7
  mutable_attributes :first_name, :last_name, :nickname, :display_name, :picture_url, :admin
8
8
 
9
9
  module FinderMethods
10
+
10
11
  def find_by_site_and_email(site, email, params = {})
11
12
  res = engine.transmit(:get, path, :query => params.merge({:site => site, :email => email}))
12
13
  select_first_entry_if_any(res)
13
14
  end
15
+
16
+ def find_by_player_id(player_id, params = {})
17
+ res = engine.transmit(:get, [path, player_id].join('/'))
18
+ select_first_entry_if_any(res)
19
+ end
20
+
14
21
  end
15
22
 
16
23
  def credit(verb, metadata = {})
17
24
  engine.activities.build(metadata.merge({:player_id => _id, :verb => verb})).save
18
25
  end
26
+
19
27
  end
20
28
  end
@@ -1,3 +1,3 @@
1
1
  module Gamifier
2
- VERSION = "1.0.4" unless defined?(Gamifier::VERSION)
2
+ VERSION = "1.0.5" unless defined?(Gamifier::VERSION)
3
3
  end
@@ -35,6 +35,17 @@ describe Gamifier::Player do
35
35
  @engine.should_receive(:transmit).with(:get, "players", :query => {:site=>"test.ltd", :email=>"hi@hello.com", :limit => 5})
36
36
  @collection.find_by_site_and_email 'test.ltd', 'hi@hello.com', :limit => 5
37
37
  end
38
- end
38
+ end
39
+
40
+ describe "find_by_player_id" do
41
+
42
+ let(:player_id) { '123456789' }
43
+
44
+ it "should issue a get request with the correct params" do
45
+ @engine.should_receive(:transmit).with(:get, "players/#{player_id}")
46
+ @collection.find_by_player_id(player_id)
47
+ end
48
+
49
+ end
39
50
  end
40
51
  end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gamifier
3
3
  version: !ruby/object:Gem::Version
4
- hash: 31
4
+ hash: 29
5
5
  prerelease:
6
6
  segments:
7
7
  - 1
8
8
  - 0
9
- - 4
10
- version: 1.0.4
9
+ - 5
10
+ version: 1.0.5
11
11
  platform: ruby
12
12
  authors:
13
13
  - Cyril Rohr
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2012-07-20 00:00:00 Z
18
+ date: 2012-09-19 00:00:00 Z
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency
21
21
  name: faraday
@@ -169,7 +169,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
169
169
  requirements: []
170
170
 
171
171
  rubyforge_project:
172
- rubygems_version: 1.8.17
172
+ rubygems_version: 1.8.24
173
173
  signing_key:
174
174
  specification_version: 3
175
175
  summary: Currently supports Badgeville Core API