Class: Bushido::User
Overview
Bushido User enables user validation against Bushido’s server
Class Method Summary collapse
-
.exists?(email) ⇒ Boolean
Checks whether email corresponds to a valid Bushido user.
-
.invite(email) ⇒ Object
send a Bushido invite with a short description of the app (also a box of chocolates, if he’s a Kryptonian) Bushido::User.invite(“[email protected]”).
-
.notify(ido_id, title, body, category = "general") ⇒ Object
To send a notification to a user who belongs to your app Bushido::User.notify(‘5z325f4knbm2f’, ‘Example title’, ‘Example message’, ‘chat’).
-
.pending_invites ⇒ Object
List all pending invites Bushido::User.pending_invites.
-
.remove(ido_id) ⇒ Object
To remove a user from an application Bushido::User.remove(“5z325f4knbm2f”).
-
.valid?(email, pass) ⇒ Boolean
Checks whether user an email and password correspond to a valid bushido user.
Methods inherited from Base
Class Method Details
.exists?(email) ⇒ Boolean
Checks whether email corresponds to a valid Bushido user. Returns true or false
17 18 19 20 21 |
# File 'lib/bushido/user.rb', line 17 def exists?(email) params = {} params[:email] = email Bushido::Command.post_command(exists_unity_url, params) end |
.invite(email) ⇒ Object
send a Bushido invite with a short description of the app (also a box of chocolates, if he’s a Kryptonian) Bushido::User.invite(“[email protected]”)
25 26 27 28 29 |
# File 'lib/bushido/user.rb', line 25 def invite(email) params = {} params[:email] = email Bushido::Command.post_command(invite_unity_url, params) end |
.notify(ido_id, title, body, category = "general") ⇒ Object
To send a notification to a user who belongs to your app Bushido::User.notify(‘5z325f4knbm2f’, ‘Example title’, ‘Example message’, ‘chat’)
48 49 50 51 52 53 54 55 56 |
# File 'lib/bushido/user.rb', line 48 def notify(ido_id, title, body, category="general") params = {} params[:ido_id] = ido_id params[:title] = title params[:body] = body params[:category] = category Bushido::Command.post_command(notify_user_url, params) end |
.pending_invites ⇒ Object
List all pending invites Bushido::User.pending_invites
33 34 35 36 |
# File 'lib/bushido/user.rb', line 33 def pending_invites params = {} Bushido::Command.get_command(pending_invites_unity_url, params) end |
.remove(ido_id) ⇒ Object
To remove a user from an application Bushido::User.remove(“5z325f4knbm2f”)
40 41 42 43 44 |
# File 'lib/bushido/user.rb', line 40 def remove(ido_id) params = {} params[:ido_id] = ido_id Bushido::Command.post_command(remove_unity_url, params) end |
.valid?(email, pass) ⇒ Boolean
Checks whether user an email and password correspond to a valid bushido user. Returns nil if false, or the Bushido user’s ID if true.
8 9 10 11 12 13 |
# File 'lib/bushido/user.rb', line 8 def valid?(email, pass) params = {} params[:email] = email params[:pass] = pass Bushido::Command.post_command(valid_unity_url, params) end |