uboost-client 0.1.7 → 0.1.8

Sign up to get free protection for your applications and to get access to all the features.
data/README.markdown CHANGED
@@ -39,6 +39,14 @@ response.status
39
39
  => 422
40
40
  response.message
41
41
  => "Widgets API requires a student account"
42
+ ```
43
+
44
+ ### Account
45
+
46
+ https://github.com/chriskk/uBoost-API-v2#accounts-api
47
+
48
+ ```ruby
49
+ client.account.create({ "user_name" => "test_user_2" })
42
50
 
43
51
  client.account.select(921679358)
44
52
 
@@ -51,21 +59,38 @@ client.account.find(:user_name => 'isaacnewtonx')
51
59
  client.account.find(:external_id => '3253466')
52
60
 
53
61
  client.account.token(921679358)
62
+ ```
63
+
64
+ ### Points
54
65
 
66
+ https://github.com/chriskk/uBoost-API-v2#points-api
67
+
68
+ ```ruby
55
69
  client.points.point_transactions_for_account(921679358)
56
70
 
57
71
  client.account.points_transactions(921679358)
58
72
 
59
73
  client.points.add_points_to_account(921679359, 30, {:description => 'a description'})
74
+ ```
60
75
 
76
+ ### Badges
77
+
78
+ https://github.com/chriskk/uBoost-API-v2#badges-api
79
+
80
+ ```ruby
61
81
  client.badges.award(921679359, 1)
62
82
 
63
83
  client.badges.unaward(921679359, 1)
64
84
  ```
65
85
 
66
- The widgets section can make use of a session store. Just pass a session object - something that quacks like a hash - and the first call it makes will cache the `uboost_session_id`.
86
+ ### Widgets
67
87
 
68
- ````ruby
88
+ https://github.com/chriskk/uBoost-API-v2#widgets-api
89
+
90
+ The widgets section can make use of a session store. Just pass a session object - something that quacks like a hash - and the first call it makes will cache the `_uboost_session_id` that the uBoost API returns, to `:uboost_session_id` in the session object.
91
+
92
+ ```ruby
93
+ session = Hash.new # or a Ruby on Rails session, for example
69
94
 
70
95
  # No caching
71
96
  client.widgets.profile(:account_id => 921679373)
@@ -76,26 +101,12 @@ client.widgets(:session => session).profile(:account_id => 921679373)
76
101
 
77
102
  client.widgets.my_badges(:account_id => 921679373)
78
103
  client.widgets(:session => session).my_badges(:account_id => 921679373)
79
- client.widgets(:session => session).my_badges(:account_id => 921679373)
80
104
 
81
- client.widgets.ubar(921679373)
105
+ client.widgets.ubar(:account_id => 921679373)
82
106
 
83
107
  client.widgets.list_of_leaderboards(:account_id => 921679373)
84
108
  client.widgets(:session => session).list_of_leaderboards(:account_id => 921679373)
85
- client.widgets(:session => session).list_of_leaderboards(:account_id => 921679373)
86
109
 
87
110
  client.widgets.leaderboard(:account_id => 921679373, :leaderboard_id => 226)
88
111
  client.widgets(:session => session).leaderboard(:account_id => 921679373, :leaderboard_id => 226)
89
- client.widgets(:session => session).leaderboard(:account_id => 921679373, :leaderboard_id => 226)
90
-
91
- client.widgets.profile(921679358)
92
-
93
- client.widgets.my_badges(921679358)
94
-
95
- client.widgets.ubar(921679358)
96
-
97
- client.widgets.list_of_leaderboards(921679373)
98
-
99
- client.widgets.leaderboard(921679373, 226)
100
-
101
112
  ```
@@ -238,9 +238,9 @@ module UboostClient
238
238
  OpenStruct.new(JSON.parse(response.body))
239
239
  end
240
240
 
241
- def ubar(account_id, options = Hash.new)
242
- options = {:align => "", :bar_color => '', :div_id => 'ubar'}.merge(options)
243
- token = get_sso_token(account_id)
241
+ def ubar(options = Hash.new)
242
+ options = {:align => "top", :bar_color => '0x222222', :div_id => 'ubar'}.merge(options)
243
+ token = get_sso_token(options[:account_id])
244
244
  subdomain_url = "http://" + client.subdomain + ".uboost.com"
245
245
 
246
246
  " <script type='text/javascript' src='#{subdomain_url}/javascripts/uBar.js'></script>
@@ -256,7 +256,7 @@ module UboostClient
256
256
  <param value='false' name='cacheBusting'>
257
257
  <param value='true' name='allowFullScreen'>
258
258
  <embed width='1280' height='400' wmode='transparent' allowfullscreen='true' quality='high'
259
- cachebusting='false' flashvars='url=#{subdomain_url}/ubar/&token=#{token}&align=#{options[:align]}&barColor=#{options[:bar_color]}&divId=#{:div_id}'
259
+ cachebusting='false' flashvars='url=#{subdomain_url}/ubar/&token=#{token}&align=#{options[:align]}&barColor=#{options[:bar_color]}&divId=#{options[:div_id]}'
260
260
  allowscriptaccess='always' src='#{subdomain_url}/uBar.swf'>
261
261
  </object>
262
262
  </div>"
@@ -1,3 +1,3 @@
1
1
  class UboostClient
2
- VERSION = "0.1.7"
2
+ VERSION = "0.1.8"
3
3
  end
data/spec/simple_test.rb CHANGED
@@ -28,7 +28,7 @@ client = UboostClient::Client.new(:subdomain => subdomain, :api_credentials => a
28
28
  # puts client.widgets(:session => session).my_badges(:account_id => 921679373)
29
29
  # puts client.widgets(:session => session).my_badges(:account_id => 921679373)
30
30
 
31
- # puts client.widgets.ubar(921679373)
31
+ puts client.widgets.ubar(:account_id => 921679373)
32
32
 
33
33
  # puts client.widgets.list_of_leaderboards(:account_id => 921679373)
34
34
  # puts client.widgets(:session => session).list_of_leaderboards(:account_id => 921679373)
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uboost-client
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.7
4
+ version: 0.1.8
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: