Sha256: c92e5bd773cdf53666b52508e44ca66f17d6ce029a80894e8f9891e3f58b73cc

Contents?: true

Size: 1.95 KB

Versions: 10

Compression:

Stored size: 1.95 KB

Contents

module Cloudfuji
  # Cloudfuji User enables user validation against Cloudfuji's server
  class User < Cloudfuji::Base
    class << self
      
      # Checks whether user an email and password correspond to a valid cloudfuji
      # user. Returns nil if false, or the Cloudfuji user's ID if true.
      def valid?(email, pass)
        params = {}
        params[:email] = email
        params[:pass] = pass
        Cloudfuji::Command.post_command(valid_unity_url, params)
      end

      # Checks whether email corresponds to a valid Cloudfuji user.
      # Returns true or false
      def exists?(email)
        params = {}
        params[:email] = email
        Cloudfuji::Command.post_command(exists_unity_url, params)
      end

      # send a Cloudfuji invite with a short description of the app (also a box of chocolates, if he's a Kryptonian)
      # Cloudfuji::User.invite("clark@kent-on-krypton.com")
      def invite(email)
        params = {}
        params[:email] = email
        Cloudfuji::Command.post_command(invite_unity_url, params)
      end

      # List all pending invites
      # Cloudfuji::User.pending_invites
      def pending_invites
        params = {}
        Cloudfuji::Command.get_command(pending_invites_unity_url, params)
      end

      # To remove a user from an application
      # Cloudfuji::User.remove("5z325f4knbm2f")
      def remove(ido_id)
          params = {}
          params[:ido_id] = ido_id
          Cloudfuji::Command.post_command(remove_unity_url, params)
      end

      # To send a notification to a user who belongs to your app
      # Cloudfuji::User.notify('5z325f4knbm2f', 'Example title', 'Example message', 'chat')
      def notify(ido_id, title, body, category="general")
        params            = {}
        params[:ido_id]   = ido_id
        params[:title]    = title
        params[:body]     = body
        params[:category] = category

        Cloudfuji::Command.post_command(notify_user_url, params)
      end
    end
  end
end

Version data entries

10 entries across 10 versions & 1 rubygems

Version Path
cloudfuji-0.0.46 lib/cloudfuji/user.rb
cloudfuji-0.0.45 lib/cloudfuji/user.rb
cloudfuji-0.0.44 lib/cloudfuji/user.rb
cloudfuji-0.0.43 lib/cloudfuji/user.rb
cloudfuji-0.0.42 lib/cloudfuji/user.rb
cloudfuji-0.0.41 lib/cloudfuji/user.rb
cloudfuji-0.0.40 lib/cloudfuji/user.rb
cloudfuji-0.0.39 lib/cloudfuji/user.rb
cloudfuji-0.0.38 lib/cloudfuji/user.rb
cloudfuji-0.0.37 lib/cloudfuji/user.rb