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
31 32 33 |
# File 'lib/mirrored/base.rb', line 31 def self.api_url API_URL[@@service] end |
.connection ⇒ Object
39 40 41 |
# File 'lib/mirrored/base.rb', line 39 def self.connection @@connection end |
.establish_connection(s, u, p) ⇒ Object
14 15 16 17 18 19 |
# File 'lib/mirrored/base.rb', line 14 def self.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
22 23 24 |
# File 'lib/mirrored/base.rb', line 22 def self.remove_connection @@service, @@connection = nil, nil end |
.service ⇒ Object
35 36 37 |
# File 'lib/mirrored/base.rb', line 35 def self.service @@service end |
.valid_service?(s) ⇒ Boolean
:nodoc:
26 27 28 29 |
# File 'lib/mirrored/base.rb', line 26 def self.valid_service?(s) #:nodoc: s = s.nil? ? '' : s API_URL.keys.include?(s) end |