Module: MySpace
- Defined in:
- lib/myspace.rb,
lib/myspace/error.rb,
lib/myspace/object.rb,
lib/myspace/connection.rb
Overview
Base class for all the MySpace objects
Defined Under Namespace
Classes: Album, Connection, Detail, FriendStatus, Friends, Friendship, Group, Groups, Interest, InvalidClassDefinition, InvalidCredentials, InvalidDataFormat, InvalidObjectMap, InvalidRequest, InvalidRequestParams, InvalidResponse, Mood, Object, Photo, Photos, Profile, Status, UnknownDataType, User, Video, Videos
Constant Summary collapse
- VERSION =
"0.7"
- API_FORMATS =
["json","xml"]
- API_HOST =
"api.msappspace.com"
- API_VERSION =
"v1"
- API_CONF =
if File.exist?("myspace.conf") "myspace.conf" elsif ENV["MYSPACE_CONF"] && File.exist?(ENV["MYSPACE_CONF"]) ENV["MYSPACE_CONF"] else File.dirname(__FILE__)+"/myspace.conf" end
Class Method Summary collapse
-
.connect(apiKey = , secretKey = ) {|@connection| ... } ⇒ Object
Connect to MySpace’s API servers.
- .connection ⇒ Object
Class Method Details
.connect(apiKey = , secretKey = ) {|@connection| ... } ⇒ Object
Connect to MySpace’s API servers
27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/myspace.rb', line 27 def self.connect(apiKey=CONF["apiKey"],secretKey=CONF["secretKey"]) raise InvalidCredentials.new("No apiKey or secretKey, aborting connect. You need to pass them to MySpace.connect or put them in myspace.conf") \ if apiKey.empty? || secretKey.empty? || apiKey =~ /x{7}/ || secretKey =~ /x{7}/ @connection = Connection.new(:apiKey => apiKey, :secretKey => secretKey) yield @connection if block_given? @connection end |
.connection ⇒ Object
39 40 41 |
# File 'lib/myspace.rb', line 39 def self.connection @connection ||= self.connect end |