Class: TokBoxer::User
- Inherits:
-
Object
- Object
- TokBoxer::User
- Defined in:
- lib/TokBoxer/User.rb
Instance Attribute Summary collapse
-
#jabberId ⇒ Object
(also: #id)
readonly
Returns the value of attribute jabberId.
-
#secret ⇒ Object
readonly
Returns the value of attribute secret.
Instance Method Summary collapse
- #access_token_valid? ⇒ Boolean
- #create_call(full_name, persistent = false) ⇒ Object
- #display_name ⇒ Object
-
#initialize(jabberId, secret, api) ⇒ User
constructor
A new instance of User.
- #is_online? ⇒ Boolean
-
#login ⇒ Object
TODO add a method which calls get_request_token from the API to get the jabberId and secret from the email and password.
- #player_embed_code(messageId, width = "425", height = "344") ⇒ Object
- #received_vmails ⇒ Object
- #recorder_embed_code(width = "322", height = "321", vmailToEmail = "") ⇒ Object
- #sent_vmails ⇒ Object
- #show ⇒ Object
- #userid ⇒ Object
- #username ⇒ Object
- #vmails ⇒ Object
Constructor Details
#initialize(jabberId, secret, api) ⇒ User
Returns a new instance of User.
8 9 10 11 12 13 |
# File 'lib/TokBoxer/User.rb', line 8 def initialize(jabberId, secret, api) @jabberId = jabberId @secret = secret @api = api self.login end |
Instance Attribute Details
#jabberId ⇒ Object (readonly) Also known as: id
Returns the value of attribute jabberId.
5 6 7 |
# File 'lib/TokBoxer/User.rb', line 5 def jabberId @jabberId end |
#secret ⇒ Object (readonly)
Returns the value of attribute secret.
5 6 7 |
# File 'lib/TokBoxer/User.rb', line 5 def secret @secret end |
Instance Method Details
#access_token_valid? ⇒ Boolean
36 37 38 39 |
# File 'lib/TokBoxer/User.rb', line 36 def access_token_valid? result = @api.validate_access_token(@jabberId, @secret) result['validateAccessToken'].first["isValid"].first == "true" end |
#create_call(full_name, persistent = false) ⇒ Object
22 23 24 25 26 27 28 29 30 31 32 33 34 |
# File 'lib/TokBoxer/User.rb', line 22 def create_call(full_name,persistent=false) result = @api.create_call(@jabberId, full_name, persistent) if result['createCall'] and (createCall=result['createCall'].first) Call.new createCall['callerName'], createCall['callId'].first, createCall['callerJabberId'], createCall['persistent'], createCall['server'].first, @api else nil end end |
#display_name ⇒ Object
102 103 104 |
# File 'lib/TokBoxer/User.rb', line 102 def display_name info["displayName"].first end |
#is_online? ⇒ Boolean
98 99 100 |
# File 'lib/TokBoxer/User.rb', line 98 def is_online? info["isOnline"].first == "true" end |
#login ⇒ Object
TODO add a method which calls get_request_token from the API to get the jabberId and secret from the email and password
18 19 20 |
# File 'lib/TokBoxer/User.rb', line 18 def login @api.login_user(self.jabberId,self.secret) end |
#player_embed_code(messageId, width = "425", height = "344") ⇒ Object
89 90 91 92 93 94 95 96 |
# File 'lib/TokBoxer/User.rb', line 89 def (, width="425", height="344") <<-END <object type="application/x-shockwave-flash" data="#{@api.api_server_url}#{API_SERVER_PLAYER_WIDGET}#{}" width="#{width}" height="#{height}"> <param name="movie" value="#{@api.api_server_url}#{API_SERVER_PLAYER_WIDGET}#{}" /> <param name="FlashVars" value="tokboxPartnerKey=#{@api.api_key}&tokboxJid=#{jabberId}&tokboxAccessSecret=#{secret}" /> </object> END end |
#received_vmails ⇒ Object
65 66 67 |
# File 'lib/TokBoxer/User.rb', line 65 def received_vmails build_vmails_array("vmailRecv") end |
#recorder_embed_code(width = "322", height = "321", vmailToEmail = "") ⇒ Object
69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 |
# File 'lib/TokBoxer/User.rb', line 69 def (width="322", height="321",vmailToEmail="") <<-END <object width="#{width}" height="#{height}"> <param name="movie" value="#{@api.api_server_url}#{API_SERVER_RECORDER_WIDGET}"></param> <param name="allowFullScreen" value="true"></param> <param name="allowScriptAccess" value="true"></param> <param name="FlashVars" value="tokboxPartnerKey=#{@api.api_key}&tokboxJid=#{jabberId}&tokboxAccessSecret=#{secret}&offsiteAuth=true&vmailToEmail=#{vmailToEmail}"></param> <embed id="tbx_recorder" src="#{@api.api_server_url}#{API_SERVER_RECORDER_WIDGET}" type="application/x-shockwave-flash" allowfullscreen="true" allowScriptAccess="always" width="#{width}" height="#{height}" FlashVars="tokboxPartnerKey=#{@api.api_key}&tokboxJid=#{jabberId}&tokboxAccessSecret=#{secret}&offsiteAuth=true&vmailToEmail=#{vmailToEmail}" > </embed> </object> END end |
#sent_vmails ⇒ Object
61 62 63 |
# File 'lib/TokBoxer/User.rb', line 61 def sent_vmails build_vmails_array("vmailSent") end |
#show ⇒ Object
114 115 116 |
# File 'lib/TokBoxer/User.rb', line 114 def show info["show"].first end |
#userid ⇒ Object
110 111 112 |
# File 'lib/TokBoxer/User.rb', line 110 def userid info["userid"].first end |
#username ⇒ Object
106 107 108 |
# File 'lib/TokBoxer/User.rb', line 106 def username info["username"].first end |
#vmails ⇒ Object
57 58 59 |
# File 'lib/TokBoxer/User.rb', line 57 def vmails build_vmails_array("all") end |