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") " <object type=\"application/x-shockwave-flash\" data=\"\#{@api.api_server_url}\#{API_SERVER_PLAYER_WIDGET}\#{messageId}\" width=\"\#{width}\" height=\"\#{height}\">\n <param name=\"movie\" value=\"\#{@api.api_server_url}\#{API_SERVER_PLAYER_WIDGET}\#{messageId}\" />\n <param name=\"FlashVars\" value=\"tokboxPartnerKey=\#{@api.api_key}&tokboxJid=\#{jabberId}&tokboxAccessSecret=\#{secret}\" />\n </object>\n END\nend\n" |
#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="") " <object width=\"\#{width}\" height=\"\#{height}\">\n <param name=\"movie\" value=\"\#{@api.api_server_url}\#{API_SERVER_RECORDER_WIDGET}\"></param>\n <param name=\"allowFullScreen\" value=\"true\"></param>\n <param name=\"allowScriptAccess\" value=\"true\"></param>\n <param name=\"FlashVars\" value=\"tokboxPartnerKey=\#{@api.api_key}&tokboxJid=\#{jabberId}&tokboxAccessSecret=\#{secret}&offsiteAuth=true&vmailToEmail=\#{vmailToEmail}\"></param>\n <embed id=\"tbx_recorder\" src=\"\#{@api.api_server_url}\#{API_SERVER_RECORDER_WIDGET}\"\n type=\"application/x-shockwave-flash\"\n allowfullscreen=\"true\"\n allowScriptAccess=\"always\"\n width=\"\#{width}\"\n height=\"\#{height}\"\n FlashVars=\"tokboxPartnerKey=\#{@api.api_key}&tokboxJid=\#{jabberId}&tokboxAccessSecret=\#{secret}&offsiteAuth=true&vmailToEmail=\#{vmailToEmail}\"\n >\n </embed>\n </object>\n END\nend\n" |
#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 |