Class: Mirrored::Base
- Inherits:
-
Object
- Object
- Mirrored::Base
- Defined in:
- lib/mirrored/base.rb
Class Method Summary collapse
- .api_url ⇒ Object
- .connection ⇒ Object
-
.establish_connection(s, u, p) ⇒ Object
Sets up the login information for either magnolia or delicious.
-
.remove_connection ⇒ Object
Removes the current connection information.
- .service ⇒ Object
-
.valid_service?(s) ⇒ Boolean
:nodoc:.
Class Method Details
.api_url ⇒ Object
32 33 34 |
# File 'lib/mirrored/base.rb', line 32 def api_url API_URL[@@service] end |
.connection ⇒ Object
40 41 42 |
# File 'lib/mirrored/base.rb', line 40 def connection @@connection end |
.establish_connection(s, u, p) ⇒ Object
15 16 17 18 19 20 |
# File 'lib/mirrored/base.rb', line 15 def establish_connection(s, u, p) remove_connection raise InvalidService unless valid_service?(s) @@service = s @@connection = Connection.new(api_url, :username => u, :password => p) end |
.remove_connection ⇒ Object
Removes the current connection information
23 24 25 |
# File 'lib/mirrored/base.rb', line 23 def remove_connection @@service, @@connection = nil, nil end |
.service ⇒ Object
36 37 38 |
# File 'lib/mirrored/base.rb', line 36 def service @@service end |
.valid_service?(s) ⇒ Boolean
:nodoc:
27 28 29 30 |
# File 'lib/mirrored/base.rb', line 27 def valid_service?(s) #:nodoc: s = s.nil? ? '' : s API_URL.keys.include?(s) end |