badgeville_berlin 0.1.0
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +5 -0
- data/.rspec +1 -0
- data/.rvmrc +1 -0
- data/.yardoc/checksums +17 -0
- data/.yardoc/objects/root.dat +0 -0
- data/.yardoc/proxy_types +0 -0
- data/Gemfile +4 -0
- data/LICENSE.md +7 -0
- data/README.md +150 -0
- data/README_ADVANCED.md +120 -0
- data/Rakefile +11 -0
- data/badgeville.gemspec +36 -0
- data/doc/BadgevilleBerlin.html +131 -0
- data/doc/BadgevilleBerlin/Activity.html +135 -0
- data/doc/BadgevilleBerlin/ActivityDefinition.html +135 -0
- data/doc/BadgevilleBerlin/BaseResource.html +462 -0
- data/doc/BadgevilleBerlin/Config.html +280 -0
- data/doc/BadgevilleBerlin/Errors.html +276 -0
- data/doc/BadgevilleBerlin/Group.html +135 -0
- data/doc/BadgevilleBerlin/Leaderboard.html +135 -0
- data/doc/BadgevilleBerlin/Player.html +135 -0
- data/doc/BadgevilleBerlin/Reward.html +135 -0
- data/doc/BadgevilleBerlin/RewardDefinition.html +135 -0
- data/doc/BadgevilleBerlin/Site.html +135 -0
- data/doc/BadgevilleBerlin/Track.html +135 -0
- data/doc/BadgevilleBerlin/User.html +135 -0
- data/doc/BadgevilleBerlinJsonFormat.html +530 -0
- data/doc/_index.html +285 -0
- data/doc/class_list.html +47 -0
- data/doc/css/common.css +1 -0
- data/doc/css/full_list.css +53 -0
- data/doc/css/style.css +320 -0
- data/doc/file.README.html +182 -0
- data/doc/file_list.html +49 -0
- data/doc/frames.html +13 -0
- data/doc/index.html +182 -0
- data/doc/js/app.js +205 -0
- data/doc/js/full_list.js +150 -0
- data/doc/js/jquery.js +16 -0
- data/doc/method_list.html +118 -0
- data/doc/top-level-namespace.html +103 -0
- data/examples/.DS_Store +0 -0
- data/examples/shell/.DS_Store +0 -0
- data/examples/shell/lib/.DS_Store +0 -0
- data/examples/shell/lib/berlin_shell.rb +34 -0
- data/examples/shell/lib/berlin_shell/.DS_Store +0 -0
- data/examples/shell/lib/berlin_shell/cd.rb +17 -0
- data/examples/shell/lib/berlin_shell/core.rb +118 -0
- data/examples/shell/lib/berlin_shell/ls.rb +72 -0
- data/examples/shell/lib/berlin_shell/prompt.rb +39 -0
- data/examples/shell/shell_demo.rb +319 -0
- data/examples/shell/spec/integration/basic_spec.rb +7 -0
- data/lib/.yardoc/checksums +0 -0
- data/lib/.yardoc/objects/root.dat +0 -0
- data/lib/.yardoc/proxy_types +0 -0
- data/lib/badgeville_berlin.rb +24 -0
- data/lib/badgeville_berlin/.yardoc/checksums +0 -0
- data/lib/badgeville_berlin/.yardoc/objects/root.dat +0 -0
- data/lib/badgeville_berlin/.yardoc/proxy_types +0 -0
- data/lib/badgeville_berlin/activity.rb +5 -0
- data/lib/badgeville_berlin/activity_definition.rb +5 -0
- data/lib/badgeville_berlin/base_resource.rb +68 -0
- data/lib/badgeville_berlin/config.rb +36 -0
- data/lib/badgeville_berlin/doc/_index.html +84 -0
- data/lib/badgeville_berlin/doc/class_list.html +47 -0
- data/lib/badgeville_berlin/doc/css/common.css +1 -0
- data/lib/badgeville_berlin/doc/css/full_list.css +53 -0
- data/lib/badgeville_berlin/doc/css/style.css +320 -0
- data/lib/badgeville_berlin/doc/file_list.html +46 -0
- data/lib/badgeville_berlin/doc/frames.html +13 -0
- data/lib/badgeville_berlin/doc/index.html +84 -0
- data/lib/badgeville_berlin/doc/js/app.js +205 -0
- data/lib/badgeville_berlin/doc/js/full_list.js +150 -0
- data/lib/badgeville_berlin/doc/js/jquery.js +16 -0
- data/lib/badgeville_berlin/doc/method_list.html +46 -0
- data/lib/badgeville_berlin/doc/top-level-namespace.html +93 -0
- data/lib/badgeville_berlin/errors.rb +28 -0
- data/lib/badgeville_berlin/formats/badgeville_berlin_json_format.rb +55 -0
- data/lib/badgeville_berlin/group.rb +5 -0
- data/lib/badgeville_berlin/leaderboard.rb +5 -0
- data/lib/badgeville_berlin/player.rb +5 -0
- data/lib/badgeville_berlin/reward.rb +5 -0
- data/lib/badgeville_berlin/reward_definition.rb +5 -0
- data/lib/badgeville_berlin/site.rb +5 -0
- data/lib/badgeville_berlin/track.rb +5 -0
- data/lib/badgeville_berlin/user.rb +5 -0
- data/lib/badgeville_berlin/version.rb +3 -0
- data/lib/doc/_index.html +84 -0
- data/lib/doc/class_list.html +47 -0
- data/lib/doc/css/common.css +1 -0
- data/lib/doc/css/full_list.css +53 -0
- data/lib/doc/css/style.css +320 -0
- data/lib/doc/file_list.html +46 -0
- data/lib/doc/frames.html +13 -0
- data/lib/doc/index.html +84 -0
- data/lib/doc/js/app.js +205 -0
- data/lib/doc/js/full_list.js +150 -0
- data/lib/doc/js/jquery.js +16 -0
- data/lib/doc/method_list.html +46 -0
- data/lib/doc/top-level-namespace.html +93 -0
- data/spec/factories.rb +54 -0
- data/spec/integration/activity_spec.rb +0 -0
- data/spec/integration/basic_spec.rb +68 -0
- data/spec/integration/player_spec.rb +6 -0
- data/spec/integration/site_spec.rb +11 -0
- data/spec/integration/user_spec.rb +3 -0
- data/spec/response_json.yml +36 -0
- data/spec/spec_helper.rb +60 -0
- data/spec/unit/badgeville_berlin_json_format_spec.rb +68 -0
- data/spec/unit/base_resource_spec.rb +47 -0
- data/spec/unit/config_spec.rb +65 -0
- data/spec/unit/errors_spec.rb +47 -0
- data/spec/use_case/readme_use_case_spec.rb +262 -0
- metadata +286 -0
data/.rspec
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
--colour -d -r ./spec/spec_helper.rb
|
data/.rvmrc
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
rvm use 1.9.2-p290@badgeville.badgeville.master --create
|
data/.yardoc/checksums
ADDED
@@ -0,0 +1,17 @@
|
|
1
|
+
lib/badgeville-berlin.rb 1543d72a75b231f8fa8a7d5b11cf462346b19e12
|
2
|
+
lib/badgeville-berlin/user.rb b70c2750c03dd6e43a92e577d3ca99e93b3d4393
|
3
|
+
lib/badgeville-berlin/site.rb eecf141020b23fead4f92b6e53604e8c8fccd51a
|
4
|
+
lib/badgeville-berlin/group.rb 0c834789d7709714274e97c9f8ace0afd592cc69
|
5
|
+
lib/badgeville-berlin/track.rb 83a40a1838fc533cf92363f2c04b58192b6456d2
|
6
|
+
lib/badgeville-berlin/errors.rb 72e69af99f07f0dee3580ba89172c86e3e89e301
|
7
|
+
lib/badgeville-berlin/config.rb b596e2e690b6b99eba8f5ef64fbb693acbbb0d40
|
8
|
+
lib/badgeville-berlin/reward.rb 0b2ee38fe0d198f1ad7c06020e0c2d2905321f78
|
9
|
+
lib/badgeville-berlin/player.rb bedaabc39b28a63e9836c3dcfa29fda509c7f187
|
10
|
+
lib/badgeville-berlin/logger.rb 3ca3162076ed8de34802f87736caafbb29f62e63
|
11
|
+
lib/badgeville-berlin/version.rb 9f2de3caf725256bbebd4f6230fd2e20c242a8aa
|
12
|
+
lib/badgeville-berlin/activity.rb 03ae14bff804e9baa369b47e70768f6c6e57ff05
|
13
|
+
lib/badgeville-berlin/leaderboard.rb d35917d02a46e9d05abeae463db0f44d931cfbc9
|
14
|
+
lib/badgeville-berlin/base_resource.rb 707e506beb5b45f72a83d4c51f4518ef9c2d397d
|
15
|
+
lib/badgeville-berlin/reward_definition.rb f5194f6b3da163e851ff497f379f4e7370363142
|
16
|
+
lib/badgeville-berlin/activity_definition.rb 8b780f21c343748b012f359492c3a9fc503b4554
|
17
|
+
lib/badgeville-berlin/formats/badgeville_berlin_json_format.rb c5b6c4a54a35fe13957d318d1f86cfe3bb48dc1d
|
Binary file
|
data/.yardoc/proxy_types
ADDED
Binary file
|
data/Gemfile
ADDED
data/LICENSE.md
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
Copyright (c) 2012 Badgeville
|
2
|
+
|
3
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
4
|
+
|
5
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
6
|
+
|
7
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,150 @@
|
|
1
|
+
# Badgeville RESTful Wrapper for Berlin API -- Basic README
|
2
|
+
|
3
|
+
This is an open source Ruby wrapper for interacting with the [Badgeville RESTful Berlin API](http://rules.badgeville.com/display/doc/2.0+Core+API+Documentation).
|
4
|
+
|
5
|
+
|
6
|
+
## Features
|
7
|
+
* Uses the activeresource (3.1.3) gem to map ActiveModel-like RESTful methods to resources on the remote Badgeville server.
|
8
|
+
* Allows creating, reading (finding), updating and deleting the following classes of remote resources: Site, User, Player, ActivityDefinition, Activity, Reward and RewardDefinition.
|
9
|
+
|
10
|
+
##Basic Examples
|
11
|
+
|
12
|
+
### 1. Configure the gem to use your Badgeville Private API Key and the site to which your requests should go.
|
13
|
+
```ruby
|
14
|
+
BadgevilleBerlin::Config.conf(
|
15
|
+
:host_name => "http://example.com",
|
16
|
+
:api_key => MY_API_KEY)
|
17
|
+
```
|
18
|
+
|
19
|
+
### 2. Add a new site to your network. Find your network ID the Publisher Module's tabbed menu ( Develop > Home ) or contact <support@badgeville.com>
|
20
|
+
```ruby
|
21
|
+
new_site = BadgevilleBerlin::Site.new(
|
22
|
+
:name => "My Website",
|
23
|
+
:url => "mydomain.com",
|
24
|
+
:network_id => MY_NETWORK_ID )
|
25
|
+
success = new_site.save
|
26
|
+
```
|
27
|
+
|
28
|
+
### 3. Create a user on your network.
|
29
|
+
<ul>
|
30
|
+
<li>See the API Explorer for required and optional parameters.</li>
|
31
|
+
</ul>
|
32
|
+
|
33
|
+
```ruby
|
34
|
+
new_user = BadgevilleBerlin::User.new(
|
35
|
+
:name => 'visitor_username',
|
36
|
+
:network_id => MY_NETWORK_ID,
|
37
|
+
:email => 'visitor@emailserver.com',
|
38
|
+
:password => 'visitor_password' )
|
39
|
+
success = new_user.save
|
40
|
+
```
|
41
|
+
|
42
|
+
### 4. See error messages from the remote server.
|
43
|
+
<ul>
|
44
|
+
<li>Here we attempt to create a second user on the network with the same email as the first user.</li>
|
45
|
+
<li>See the API Explorer for required and optional parameters.</li>
|
46
|
+
</ul>
|
47
|
+
|
48
|
+
```ruby
|
49
|
+
new_user2 = BadgevilleBerlin::User.new(
|
50
|
+
:name => 'visitor_username',
|
51
|
+
:network_id => MY_NETWORK_ID,
|
52
|
+
:email => 'visitor@emailserver.com',
|
53
|
+
:password => 'visitor_password' )
|
54
|
+
success = new_user2.save
|
55
|
+
|
56
|
+
puts new_user2.errors.messages # {:email=>["user email is already taken"]}
|
57
|
+
puts new_user2.errors[:email] # ["user email is already taken"]
|
58
|
+
|
59
|
+
```
|
60
|
+
|
61
|
+
### 5. Find a user to update user properties.
|
62
|
+
<ul>
|
63
|
+
<li>Here we find the newly created user by ID to update their email address.</li>
|
64
|
+
<li>See the API Explorer for a full list of user properties to update.</li>
|
65
|
+
</ul>
|
66
|
+
```ruby
|
67
|
+
user_found_by_id = BadgevilleBerlin::User.find( new_user.id )
|
68
|
+
user_found_by_id.email = 'revised_visitor@emailserver.com'
|
69
|
+
success = user_found_by_id.save
|
70
|
+
|
71
|
+
updated_user = BadgevilleBerlin::User.find( new_user.id )
|
72
|
+
puts updated_user.email # revised_visitor@emailserver.com
|
73
|
+
```
|
74
|
+
|
75
|
+
### 6. Create a player.
|
76
|
+
<ul>
|
77
|
+
<li>Here we create a player for the new site, corresponding to the user with the updated email address.</li>
|
78
|
+
<li>See the API Explorer for required and optional parameters.</li>
|
79
|
+
</ul>
|
80
|
+
```ruby
|
81
|
+
new_player = BadgevilleBerlin::Player.new(
|
82
|
+
:site_id => new_site.id,
|
83
|
+
:user_id => user_found_by_id.id )
|
84
|
+
success = new_player.save
|
85
|
+
```
|
86
|
+
|
87
|
+
### 7. Register a player behavior.
|
88
|
+
<ul>
|
89
|
+
<li>Here we record the fact that the newly created player performed a "share" behavior.</li>
|
90
|
+
<li>See the API Explorer for required and optional parameters.</li>
|
91
|
+
</ul>
|
92
|
+
```ruby
|
93
|
+
new_activity = BadgevilleBerlin::Activity.new(
|
94
|
+
:verb => 'share',
|
95
|
+
:player_id => new_player.id )
|
96
|
+
success = new_activity.save
|
97
|
+
```
|
98
|
+
|
99
|
+
## Monitoring HTTP Requests and JSON Responses
|
100
|
+
Print HTTP requests and JSON responses by installing the "logger" gem and including this code in your script.
|
101
|
+
|
102
|
+
```ruby
|
103
|
+
require 'logger'
|
104
|
+
BadgevilleBerlin::BaseResource.logger = Logger.new(STDOUT)
|
105
|
+
BadgevilleBerlin::BaseResource.logger.level = Logger::DEBUG
|
106
|
+
```
|
107
|
+
|
108
|
+
## Dependencies
|
109
|
+
* activeresource (3.1.3) - Provides Ruby classes to RESTfully interact with remote resources.
|
110
|
+
|
111
|
+
|
112
|
+
## Installation
|
113
|
+
gem install badgeville_berlin
|
114
|
+
|
115
|
+
|
116
|
+
## Documentation
|
117
|
+
For more documentation on how the Badgeville RESTful Berlin API works, see [here] (http://rules.badgeville.com/display/doc/2.0+Core+API+Documentation).
|
118
|
+
|
119
|
+
|
120
|
+
## Submitting an Issue
|
121
|
+
You can use the [GitHub issue tracker](https://github.com/badgeville/badgeville-ruby/issues) to report bugs. After ensuring that the bug has not already been submitted, please submit:
|
122
|
+
|
123
|
+
1. A [gist](https://gist.github.com/) a that contains a stack trace.
|
124
|
+
2. Details needed to reproduce the bug, including gem version, Ruby version and operating system.
|
125
|
+
|
126
|
+
|
127
|
+
## Submitting a Pull Request
|
128
|
+
1. Click the GitHub "Fork" button to fork this project.
|
129
|
+
2. Clone the repository for a local copy:
|
130
|
+
|
131
|
+
git clone git@github.com:username/badgeville-ruby.git
|
132
|
+
|
133
|
+
3. Create a topic branch:
|
134
|
+
|
135
|
+
git checkout -b my_bug_fix_or_feature_branch
|
136
|
+
|
137
|
+
4. Add documentation and specs for your bug fix or feature.
|
138
|
+
5. Implement your bug fix or feature.
|
139
|
+
6. Run the following command to ensure your tests cover your changes:
|
140
|
+
|
141
|
+
bundle exec rake spec
|
142
|
+
|
143
|
+
7. Commit and push your changes.
|
144
|
+
8. Click the GitHub "Pull Request" to submit a pull request. Please do not include changes to the gemspec, version or history file.
|
145
|
+
|
146
|
+
## Contributors
|
147
|
+
David Czarnecki of Major League Gaming wrote the initial gem that inspired this wrapper.
|
148
|
+
|
149
|
+
|
150
|
+
Copyright (c) 2012 Badgeville.
|
data/README_ADVANCED.md
ADDED
@@ -0,0 +1,120 @@
|
|
1
|
+
# Badgeville RESTful Wrapper for Berlin API -- Advanced README
|
2
|
+
|
3
|
+
This is an open source Ruby wrapper for interacting with the [Badgeville RESTful Berlin API](http://rules.badgeville.com/display/doc/2.0+Core+API+Documentation).
|
4
|
+
|
5
|
+
|
6
|
+
## Features
|
7
|
+
* Uses the activeresource (3.1.3) gem to map ActiveModel-like RESTful methods to resources on the remote Badgeville server.
|
8
|
+
* Allows creating, reading (finding), updating and deleting the following classes of remote resources: Site, User, Player, ActivityDefinition, Activity, Reward and RewardDefinition.
|
9
|
+
|
10
|
+
##Advanced Examples
|
11
|
+
|
12
|
+
|
13
|
+
### 0. Please see Basic Examples in the [Basic README](https://github.com/badgeville/badgeville-ruby/blob/alpha/README.markdown) first.
|
14
|
+
|
15
|
+
|
16
|
+
### 1. Configure the gem to use your Badgeville Private API Key and the site to which your requests should go.
|
17
|
+
```ruby
|
18
|
+
BadgevilleBerlin::Config.conf(
|
19
|
+
:host_name => "http://example.com",
|
20
|
+
:api_key => MY_API_KEY)
|
21
|
+
```
|
22
|
+
|
23
|
+
### 2. Create an activity definition. [(more on activity definition)](http://rules.badgeville.com/display/doc/Creating+and+Managing+Behaviors#CreatingandManagingBehaviors-CreatingAdvancedBehaviors)
|
24
|
+
<ul>
|
25
|
+
<li>Create an activity definition to store additional information you want to use in rewards determination.</li>
|
26
|
+
<li>Here we create an activity definition to specify that a player will earn 4 points each time they perform the "comment" behavior.</li>
|
27
|
+
<li>See the API Explorer for required and optional parameters.</li>
|
28
|
+
</ul>
|
29
|
+
```ruby
|
30
|
+
new_activity_definition = ActivityDefinition.new(
|
31
|
+
:adjustment => '{"points": 4}',
|
32
|
+
:name => 'A Cool Comment Behavior',
|
33
|
+
:site_id => new_site.id,
|
34
|
+
:selector => '{"verb":"vote"}' )
|
35
|
+
success = new_activity_definition.save
|
36
|
+
```
|
37
|
+
|
38
|
+
### 3. Update the properties of activity definition: points. [(more on points)](http://rules.badgeville.com/display/doc/Creating+and+Managing+Behaviors#CreatingandManagingBehaviors-CreatingSimpleBehaviors)
|
39
|
+
<ul>
|
40
|
+
<li>Here we update the activity definition so that a player on our site will earn 3 points rather than 4 each time they perform the "comment" behavior.
|
41
|
+
</li>
|
42
|
+
<li>See the API Explorer for a full list of activity definition properties to update.</li>
|
43
|
+
</ul>
|
44
|
+
```ruby
|
45
|
+
new_activity_definition.adjustment.points = 3
|
46
|
+
success = new_activity_definition.save
|
47
|
+
|
48
|
+
activity_def_points_updated = BadgevilleBerlin::ActivityDefinition.find(new_activity_definition.id)
|
49
|
+
puts activity_def_points_updated.points # 3.0
|
50
|
+
```
|
51
|
+
|
52
|
+
### 4. Update the properties of activity definition: enable rate-limiting. [(more on rate-limiting)](http://rules.badgeville.com/display/doc/Creating+and+Managing+Behaviors#CreatingandManagingBehaviors-BehaviorRateLimits)
|
53
|
+
<ul>
|
54
|
+
<li>Here we update the activity definition to make it rate-limiting to prevent players from gaming the system.</li>
|
55
|
+
<li>See the API Explorer for a full list of activity definition properties to update.</li>
|
56
|
+
</ul>
|
57
|
+
```ruby
|
58
|
+
activity_def_points_updated.enable_rate_limiting = true
|
59
|
+
activity_def_points_updated.bucket_drain_rate = 180
|
60
|
+
activity_def_points_updated.bucket_max_capacity = 25
|
61
|
+
activity_def_points_updated.save
|
62
|
+
|
63
|
+
activity_def_rate_limit_updated = BadgevilleBerlin::ActivityDefinition.find(new_activity_definition.id)
|
64
|
+
puts activity_def_rate_limit_updated.enable_rate_limiting # true
|
65
|
+
```
|
66
|
+
|
67
|
+
### 5. Create a reward definition. [(more on rewards)](http://rules.badgeville.com/display/doc/Creating+and+Managing+DGE+Rewards)
|
68
|
+
<ul>
|
69
|
+
<li>Create a reward definition to specify criteria to earn a particular reward.</li>
|
70
|
+
<li>Here we create a reward definition to specify that a player receive a reward for making at least 1 comment.</li>
|
71
|
+
<li>See the API Explorer for required and optional parameters.</li>
|
72
|
+
</ul>
|
73
|
+
```ruby
|
74
|
+
new_reward_def = BadgevilleBerlin::RewardDefinition.new(
|
75
|
+
:site_id => new_site.id,
|
76
|
+
:name => 'Comment Rockstar',
|
77
|
+
:reward_template => '{"message":"Congrats, you are a Comment Rockstar!"}',
|
78
|
+
:components => '[{"comparator":{"$gte":1},"where":{"verb":"comment","player_id":"%player_id"},"command":"count"}]',
|
79
|
+
:active => true )
|
80
|
+
new_reward_def_created = new_reward_def.save
|
81
|
+
```
|
82
|
+
|
83
|
+
### 6. Register a player behavior.
|
84
|
+
<ul>
|
85
|
+
<li>Here we record the fact that the newly created player performed a "comment" behavior.</li>
|
86
|
+
<li>See the API Explorer for required and optional parameters.</li>
|
87
|
+
</ul>
|
88
|
+
```ruby
|
89
|
+
new_activity = BadgevilleBerlin::Activity.new(
|
90
|
+
:verb => 'comment',
|
91
|
+
:player_id => new_player.id )
|
92
|
+
success = new_activity.save
|
93
|
+
```
|
94
|
+
|
95
|
+
### 7. Find the updated player to verify properties and rewards.
|
96
|
+
<ul>
|
97
|
+
<li>Here we verify that the player was credited 4 points and received a reward for the comment behavior.</li>
|
98
|
+
<li>Print out the BadgevilleBerlin::Player object (i.e. updated_player) to get a full list of player properties.</li>
|
99
|
+
</ul>
|
100
|
+
```ruby
|
101
|
+
updated_player = BadgevilleBerlin::Player.find(new_player.id)
|
102
|
+
puts updated_player.points_all # 3.0
|
103
|
+
|
104
|
+
player_specific_rewards = BadgevilleBerlin::Reward.find(:all, :params => {:player_id => @new_player.id})
|
105
|
+
puts player_specific_rewards[0].name # "Comment Rockstar"
|
106
|
+
|
107
|
+
```
|
108
|
+
|
109
|
+
### 8. Delete a reward definition.
|
110
|
+
```ruby
|
111
|
+
BadgevilleBerlin::RewardDefinition.delete(new_reward_def.id)
|
112
|
+
```
|
113
|
+
## Dependencies, Installation & Documentation
|
114
|
+
Please see the [Basic README](https://github.com/badgeville/badgeville-ruby/blob/alpha/README.markdown) for details.
|
115
|
+
|
116
|
+
## Contributors
|
117
|
+
David Czarnecki of Major League Gaming wrote the initial gem that inspired this wrapper.
|
118
|
+
|
119
|
+
|
120
|
+
Copyright (c) 2012 Badgeville.
|
data/Rakefile
ADDED
@@ -0,0 +1,11 @@
|
|
1
|
+
require "bundler"
|
2
|
+
Bundler::GemHelper.install_tasks
|
3
|
+
require 'rspec/core/rake_task'
|
4
|
+
|
5
|
+
desc "Run specs"
|
6
|
+
RSpec::Core::RakeTask.new do |t|
|
7
|
+
t.pattern = "./spec/**/*_spec.rb" # don't need this, it's default.
|
8
|
+
# Put spec opts in a file named .rspec in root
|
9
|
+
end
|
10
|
+
|
11
|
+
task :default => :spec
|
data/badgeville.gemspec
ADDED
@@ -0,0 +1,36 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
$:.push File.expand_path("../lib", __FILE__)
|
3
|
+
require "badgeville_berlin/version"
|
4
|
+
|
5
|
+
Gem::Specification.new do |s|
|
6
|
+
s.name = "badgeville_berlin"
|
7
|
+
s.version = BadgevilleBerlin::VERSION
|
8
|
+
s.authors = ["Andrija Perovic", "Alex Tran", "Jimmy Zhang", "Supraja Narasimhan"]
|
9
|
+
s.email = ["supraja.n@gmail.com"]
|
10
|
+
s.homepage = "https://github.com/badgeville/badgeville-ruby"
|
11
|
+
s.summary = %q{A Ruby wrapper for the Badgeville RESTful Berlin API.}
|
12
|
+
s.description = %q{Uses the activeresource (3.0.5) gem to map ActiveModel-like RESTful methods to resources on the remote Badgeville server.}
|
13
|
+
|
14
|
+
s.rubyforge_project = "badgeville_berlin"
|
15
|
+
|
16
|
+
s.files = `git ls-files`.split("\n")
|
17
|
+
s.test_files = `git ls-files -- {test,spec,features}/*`.split("\n")
|
18
|
+
s.executables = `git ls-files -- bin/*`.split("\n").map{ |f| File.basename(f) }
|
19
|
+
s.require_paths = ["lib"]
|
20
|
+
|
21
|
+
# specify any dependencies here
|
22
|
+
|
23
|
+
# development-only dependencies
|
24
|
+
s.add_development_dependency "ruby-debug19"
|
25
|
+
s.add_development_dependency "rake"
|
26
|
+
s.add_development_dependency "rspec"
|
27
|
+
s.add_development_dependency "fakeweb"
|
28
|
+
s.add_development_dependency "factory_girl", '=2.4.0'
|
29
|
+
s.add_development_dependency "ZenTest"
|
30
|
+
s.add_development_dependency "autotest"
|
31
|
+
s.add_development_dependency "autotest-growl"
|
32
|
+
s.add_development_dependency "logger", ">=1.2.8"
|
33
|
+
|
34
|
+
s.add_runtime_dependency "activeresource", '= 3.1.3'
|
35
|
+
# s.add_runtime_dependency "rest-client"
|
36
|
+
end
|
@@ -0,0 +1,131 @@
|
|
1
|
+
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
2
|
+
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
3
|
+
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
4
|
+
<head>
|
5
|
+
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
6
|
+
<title>
|
7
|
+
Module: BadgevilleBerlin
|
8
|
+
|
9
|
+
— Documentation by YARD 0.7.1
|
10
|
+
|
11
|
+
</title>
|
12
|
+
|
13
|
+
<link rel="stylesheet" href="css/style.css" type="text/css" media="screen" charset="utf-8" />
|
14
|
+
|
15
|
+
<link rel="stylesheet" href="css/common.css" type="text/css" media="screen" charset="utf-8" />
|
16
|
+
|
17
|
+
<script type="text/javascript" charset="utf-8">
|
18
|
+
relpath = '';
|
19
|
+
if (relpath != '') relpath += '/';
|
20
|
+
</script>
|
21
|
+
|
22
|
+
<script type="text/javascript" charset="utf-8" src="js/jquery.js"></script>
|
23
|
+
|
24
|
+
<script type="text/javascript" charset="utf-8" src="js/app.js"></script>
|
25
|
+
|
26
|
+
|
27
|
+
</head>
|
28
|
+
<body>
|
29
|
+
<script type="text/javascript" charset="utf-8">
|
30
|
+
if (window.top.frames.main) document.body.className = 'frames';
|
31
|
+
</script>
|
32
|
+
|
33
|
+
<div id="header">
|
34
|
+
<div id="menu">
|
35
|
+
|
36
|
+
<a href="_index.html">Index (B)</a> »
|
37
|
+
|
38
|
+
|
39
|
+
<span class="title">BadgevilleBerlin</span>
|
40
|
+
|
41
|
+
|
42
|
+
<div class="noframes"><span class="title">(</span><a href="." target="_top">no frames</a><span class="title">)</span></div>
|
43
|
+
</div>
|
44
|
+
|
45
|
+
<div id="search">
|
46
|
+
|
47
|
+
<a id="class_list_link" href="#">Class List</a>
|
48
|
+
|
49
|
+
<a id="method_list_link" href="#">Method List</a>
|
50
|
+
|
51
|
+
<a id="file_list_link" href="#">File List</a>
|
52
|
+
|
53
|
+
</div>
|
54
|
+
<div class="clear"></div>
|
55
|
+
</div>
|
56
|
+
|
57
|
+
<iframe id="search_frame"></iframe>
|
58
|
+
|
59
|
+
<div id="content"><h1>Module: BadgevilleBerlin
|
60
|
+
|
61
|
+
|
62
|
+
|
63
|
+
</h1>
|
64
|
+
|
65
|
+
<dl class="box">
|
66
|
+
|
67
|
+
|
68
|
+
|
69
|
+
|
70
|
+
|
71
|
+
|
72
|
+
|
73
|
+
|
74
|
+
<dt class="r1 last">Defined in:</dt>
|
75
|
+
<dd class="r1 last">lib/badgeville-berlin/user.rb<span class="defines">,<br />
|
76
|
+
lib/badgeville-berlin.rb,<br /> lib/badgeville-berlin/site.rb,<br /> lib/badgeville-berlin/group.rb,<br /> lib/badgeville-berlin/track.rb,<br /> lib/badgeville-berlin/errors.rb,<br /> lib/badgeville-berlin/config.rb,<br /> lib/badgeville-berlin/reward.rb,<br /> lib/badgeville-berlin/player.rb,<br /> lib/badgeville-berlin/logger.rb,<br /> lib/badgeville-berlin/version.rb,<br /> lib/badgeville-berlin/activity.rb,<br /> lib/badgeville-berlin/leaderboard.rb,<br /> lib/badgeville-berlin/base_resource.rb,<br /> lib/badgeville-berlin/reward_definition.rb,<br /> lib/badgeville-berlin/activity_definition.rb</span>
|
77
|
+
</dd>
|
78
|
+
|
79
|
+
</dl>
|
80
|
+
<div class="clear"></div>
|
81
|
+
|
82
|
+
<h2>Overview</h2><div class="docstring">
|
83
|
+
<div class="discussion">
|
84
|
+
<p>
|
85
|
+
Subclasses BaseResource to represent a remote resource model class.
|
86
|
+
</p>
|
87
|
+
|
88
|
+
|
89
|
+
</div>
|
90
|
+
</div>
|
91
|
+
<div class="tags">
|
92
|
+
|
93
|
+
</div><h2>Defined Under Namespace</h2>
|
94
|
+
<p class="children">
|
95
|
+
|
96
|
+
|
97
|
+
|
98
|
+
|
99
|
+
<strong class="classes">Classes:</strong> <span class='object_link'><a href="BadgevilleBerlin/Activity.html" title="BadgevilleBerlin::Activity (class)">Activity</a></span>, <span class='object_link'><a href="BadgevilleBerlin/ActivityDefinition.html" title="BadgevilleBerlin::ActivityDefinition (class)">ActivityDefinition</a></span>, <span class='object_link'><a href="BadgevilleBerlin/BaseResource.html" title="BadgevilleBerlin::BaseResource (class)">BaseResource</a></span>, <span class='object_link'><a href="BadgevilleBerlin/Config.html" title="BadgevilleBerlin::Config (class)">Config</a></span>, <span class='object_link'><a href="BadgevilleBerlin/Errors.html" title="BadgevilleBerlin::Errors (class)">Errors</a></span>, <span class='object_link'><a href="BadgevilleBerlin/Group.html" title="BadgevilleBerlin::Group (class)">Group</a></span>, <span class='object_link'><a href="BadgevilleBerlin/Leaderboard.html" title="BadgevilleBerlin::Leaderboard (class)">Leaderboard</a></span>, <span class='object_link'><a href="BadgevilleBerlin/Player.html" title="BadgevilleBerlin::Player (class)">Player</a></span>, <span class='object_link'><a href="BadgevilleBerlin/Reward.html" title="BadgevilleBerlin::Reward (class)">Reward</a></span>, <span class='object_link'><a href="BadgevilleBerlin/RewardDefinition.html" title="BadgevilleBerlin::RewardDefinition (class)">RewardDefinition</a></span>, <span class='object_link'><a href="BadgevilleBerlin/Site.html" title="BadgevilleBerlin::Site (class)">Site</a></span>, <span class='object_link'><a href="BadgevilleBerlin/Track.html" title="BadgevilleBerlin::Track (class)">Track</a></span>, <span class='object_link'><a href="BadgevilleBerlin/User.html" title="BadgevilleBerlin::User (class)">User</a></span>
|
100
|
+
|
101
|
+
|
102
|
+
</p>
|
103
|
+
|
104
|
+
<h2>Constant Summary</h2>
|
105
|
+
|
106
|
+
<dl class="constants">
|
107
|
+
|
108
|
+
<dt id="VERSION-constant" class="">VERSION =
|
109
|
+
|
110
|
+
</dt>
|
111
|
+
<dd><pre class="code"><span class='tstring'><span class='tstring_beg'>"</span><span class='tstring_content'>0.0.6</span><span class='tstring_end'>"</span></span></pre></dd>
|
112
|
+
|
113
|
+
</dl>
|
114
|
+
|
115
|
+
|
116
|
+
|
117
|
+
|
118
|
+
|
119
|
+
|
120
|
+
|
121
|
+
|
122
|
+
</div>
|
123
|
+
|
124
|
+
<div id="footer">
|
125
|
+
Generated on Tue Jan 24 14:21:13 2012 by
|
126
|
+
<a href="http://yardoc.org" title="Yay! A Ruby Documentation Tool" target="_parent">yard</a>
|
127
|
+
0.7.1 (ruby-1.9.2).
|
128
|
+
</div>
|
129
|
+
|
130
|
+
</body>
|
131
|
+
</html>
|