Class: WiMP::Configuration
- Inherits:
-
Object
- Object
- WiMP::Configuration
- Defined in:
- lib/wimp.rb
Constant Summary collapse
- P_USERNAME =
"wimpse"
- P_PASSWORD =
"slbh4UUgH"
- D_CLIENT_NAME =
"Android_WIMP-2.5.2.se"
- D_CLIENT_ID =
"8263371084"
- SECURE_LOGIN_URL =
"https://client.wimpmusic.com/clientapi/servicelogin"
Instance Attribute Summary collapse
-
#client_id ⇒ Object
Returns the value of attribute client_id.
-
#client_name ⇒ Object
Returns the value of attribute client_name.
-
#password ⇒ Object
Returns the value of attribute password.
-
#username ⇒ Object
Returns the value of attribute username.
Instance Method Summary collapse
-
#logged_in? ⇒ Boolean
Boolean.
- #logout! ⇒ Object
-
#session ⇒ Object
String.
Instance Attribute Details
#client_id ⇒ Object
Returns the value of attribute client_id.
27 28 29 |
# File 'lib/wimp.rb', line 27 def client_id @client_id end |
#client_name ⇒ Object
Returns the value of attribute client_name.
27 28 29 |
# File 'lib/wimp.rb', line 27 def client_name @client_name end |
#password ⇒ Object
Returns the value of attribute password.
27 28 29 |
# File 'lib/wimp.rb', line 27 def password @password end |
#username ⇒ Object
Returns the value of attribute username.
27 28 29 |
# File 'lib/wimp.rb', line 27 def username @username end |
Instance Method Details
#logged_in? ⇒ Boolean
Returns Boolean.
56 57 58 |
# File 'lib/wimp.rb', line 56 def logged_in? !! session end |
#logout! ⇒ Object
60 61 62 |
# File 'lib/wimp.rb', line 60 def logout! @_session = nil end |
#session ⇒ Object
Returns String.
32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 |
# File 'lib/wimp.rb', line 32 def session @_session ||= begin transport = Thrift::HTTPClientTransport.new(SECURE_LOGIN_URL) protocol = Thrift::BinaryProtocol.new(transport) client = Gen::ClientApiLoginService::Client.new(protocol) transport.open result = client.simpleLogin( username, password, P_USERNAME, P_PASSWORD, client_name || D_CLIENT_NAME, client_id || D_CLIENT_ID ) transport.close result.sessionId end rescue Thrift::ApplicationException raise LoginFailed.new("Login failed, invalid credentials. Are you really a premium user?") end |