badgeville_berlin 1.0.0 → 1.0.1
Sign up to get free protection for your applications and to get access to all the features.
- data/README.md +11 -1
- data/lib/badgeville_berlin/version.rb +1 -1
- data/spec/use_case/readme_use_case_spec.rb +23 -3
- metadata +2 -2
data/README.md
CHANGED
@@ -85,7 +85,17 @@ This is an open source Ruby wrapper for interacting with the [Badgeville RESTful
|
|
85
85
|
success = new_player.save
|
86
86
|
```
|
87
87
|
|
88
|
-
### 7.
|
88
|
+
### 7. Find existing players by email.
|
89
|
+
<ul>
|
90
|
+
<li>Here we find an existing player by email.</li>
|
91
|
+
<li>To get all players on the network that match the email, we have passed :all.</li>
|
92
|
+
<li>You can alternatively pass :first or :last in the place of :all.</li>
|
93
|
+
</ul>
|
94
|
+
``` ruby
|
95
|
+
@existing_player = Player.find(:all, :params => {:email => "revised_visitor@emailserver.com"})
|
96
|
+
```
|
97
|
+
|
98
|
+
### 8. Register a player behavior.
|
89
99
|
<ul>
|
90
100
|
<li>Here we record the fact that the newly created player performed a "share" behavior.</li>
|
91
101
|
<li>See the API Explorer for required and optional parameters.</li>
|
@@ -13,8 +13,9 @@ module BadgevilleBerlin
|
|
13
13
|
FakeWeb.allow_net_connect = true
|
14
14
|
|
15
15
|
# Configure the gem with the host site and the API Key
|
16
|
-
my_api_key
|
17
|
-
my_hostname = "http://myhostname.com"
|
16
|
+
my_api_key = "<myapikey>"
|
17
|
+
my_hostname = "<http://myhostname.com>"
|
18
|
+
|
18
19
|
Config.conf(:host_name => my_hostname, :api_key => my_api_key)
|
19
20
|
|
20
21
|
# Basic README: Create a new site
|
@@ -42,6 +43,7 @@ module BadgevilleBerlin
|
|
42
43
|
@attr_specific_err = @new_user2.errors[:email]
|
43
44
|
|
44
45
|
# Basic README: Create a player
|
46
|
+
# Basic README: Find existing players that match the given email
|
45
47
|
@new_player = Player.new(
|
46
48
|
:site_id => @new_site.id,
|
47
49
|
:user_id => @new_user.id ,
|
@@ -138,6 +140,24 @@ module BadgevilleBerlin
|
|
138
140
|
@new_player.user_id.should == @new_user.id
|
139
141
|
end
|
140
142
|
|
143
|
+
# FIND Players by email (:all matches)
|
144
|
+
it "should return all players that match the email address as a collection", :affects_bv_server => true do
|
145
|
+
@existing_player = Player.find(:all, :params => {:email => "visitor#{@rand1}@emailserver.com"})
|
146
|
+
@existing_player.first.email.should == "visitor#{@rand1}@emailserver.com"
|
147
|
+
end
|
148
|
+
|
149
|
+
# FIND Player by email (:first match)
|
150
|
+
it "should return the first player that matches the email address as a single record", :affects_bv_server => true do
|
151
|
+
@existing_player = Player.find(:first, :params => {:email => "visitor#{@rand1}@emailserver.com"})
|
152
|
+
@existing_player.email.should == "visitor#{@rand1}@emailserver.com"
|
153
|
+
end
|
154
|
+
|
155
|
+
# FIND Player by email (:last match)
|
156
|
+
it "should return the first player that matches the email address as a single record", :affects_bv_server => true do
|
157
|
+
@existing_player = Player.find(:last, :params => {:email => "visitor#{@rand1}@emailserver.com"})
|
158
|
+
@existing_player.email.should == "visitor#{@rand1}@emailserver.com"
|
159
|
+
end
|
160
|
+
|
141
161
|
# CREATE Activity (share)
|
142
162
|
it "should have created a 1st activity", :affects_bv_server => true do
|
143
163
|
@share_activity_created.should == true
|
@@ -273,7 +293,7 @@ module BadgevilleBerlin
|
|
273
293
|
lambda { Site.find(@new_site.id) }.should raise_error(ActiveResource::ResourceNotFound)
|
274
294
|
end
|
275
295
|
|
276
|
-
#FIND Group
|
296
|
+
# FIND Group (a.k.a. Mission)
|
277
297
|
# Not integration test!
|
278
298
|
it "should parse correctly a group index call which includes rewards keyed under reward definitions", :affects_bv_server => true do
|
279
299
|
BadgevilleBerlinJsonFormat.stub!(:decode).and_return([JSON.parse(BadgevilleBerlin.response_json["valid_group_all"])])
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: badgeville_berlin
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -12,7 +12,7 @@ authors:
|
|
12
12
|
autorequire:
|
13
13
|
bindir: bin
|
14
14
|
cert_chain: []
|
15
|
-
date: 2012-
|
15
|
+
date: 2012-10-30 00:00:00.000000000 Z
|
16
16
|
dependencies:
|
17
17
|
- !ruby/object:Gem::Dependency
|
18
18
|
name: ruby-debug19
|