Module: Ubiquitously

Defined in:
lib/ubiquitously/services/mmo.rb,
lib/ubiquitously.rb,
lib/ubiquitously/models/base.rb,
lib/ubiquitously/models/page.rb,
lib/ubiquitously/models/post.rb,
lib/ubiquitously/models/user.rb,
lib/ubiquitously/commands/base.rb,
lib/ubiquitously/commands/post.rb,
lib/ubiquitously/commands/user.rb,
lib/ubiquitously/services/digg.rb,
lib/ubiquitously/services/gist.rb,
lib/ubiquitously/services/mixx.rb,
lib/ubiquitously/services/diigo.rb,
lib/ubiquitously/services/dzone.rb,
lib/ubiquitously/services/faves.rb,
lib/ubiquitously/services/snipt.rb,
lib/ubiquitously/services/zabox.rb,
lib/ubiquitously/services/reddit.rb,
lib/ubiquitously/services/scribd.rb,
lib/ubiquitously/services/sphinn.rb,
lib/ubiquitously/services/tumblr.rb,
lib/ubiquitously/services/tweako.rb,
lib/ubiquitously/services/youblr.rb,
lib/ubiquitously/support/storage.rb,
lib/ubiquitously/services/chetzit.rb,
lib/ubiquitously/services/digzign.rb,
lib/ubiquitously/services/flikode.rb,
lib/ubiquitously/services/kailoon.rb,
lib/ubiquitously/services/nestdev.rb,
lib/ubiquitously/services/queness.rb,
lib/ubiquitously/services/smipple.rb,
lib/ubiquitously/services/snipplr.rb,
lib/ubiquitously/services/twitter.rb,
lib/ubiquitously/services/webdev5.rb,
lib/ubiquitously/services/facebook.rb,
lib/ubiquitously/services/favshare.rb,
lib/ubiquitously/services/identica.rb,
lib/ubiquitously/services/my_space.rb,
lib/ubiquitously/services/newsvine.rb,
lib/ubiquitously/services/wordtaps.rb,
lib/ubiquitously/services/delicious.rb,
lib/ubiquitously/services/jump_tags.rb,
lib/ubiquitously/services/mvc_forge.rb,
lib/ubiquitously/services/posterous.rb,
lib/ubiquitously/services/propeller.rb,
lib/ubiquitously/services/shoutwire.rb,
lib/ubiquitously/services/stumpedia.rb,
lib/ubiquitously/services/web_blend.rb,
lib/ubiquitously/models/service/post.rb,
lib/ubiquitously/services/friendfeed.rb,
lib/ubiquitously/services/sharebrain.rb,
lib/ubiquitously/services/slideshare.rb,
lib/ubiquitously/services/yahoo_buzz.rb,
lib/ubiquitously/services/blogger_den.rb,
lib/ubiquitously/services/design_bump.rb,
lib/ubiquitously/services/designgizer.rb,
lib/ubiquitously/services/designr_fix.rb,
lib/ubiquitously/services/google_buzz.rb,
lib/ubiquitously/services/meta_filter.rb,
lib/ubiquitously/services/code_project.rb,
lib/ubiquitously/services/pixel_groovy.rb,
lib/ubiquitously/services/stumble_upon.rb,
lib/ubiquitously/support/active_record.rb,
lib/ubiquitously/models/service/account.rb,
lib/ubiquitously/services/who_freelance.rb,
lib/ubiquitously/services/dzone_snippets.rb,
lib/ubiquitously/services/script_and_style.rb,
lib/ubiquitously/models/service/post/ownable.rb,
lib/ubiquitously/models/service/post/restful.rb,
lib/ubiquitously/services/programmers_heaven.rb,
lib/ubiquitously/models/service/post/loggable.rb,
lib/ubiquitously/models/service/post/postable.rb,
lib/ubiquitously/models/service/account/restful.rb,
lib/ubiquitously/models/service/account/loggable.rb,
lib/ubiquitously/models/service/account/authorizable.rb

Overview

Defined Under Namespace

Modules: Account, BloggerDen, Chetzit, CodeProject, Command, Delicious, DesignBump, Designgizer, DesignrFix, Digg, Digzign, Diigo, Dzone, DzoneSnippets, Facebook, Faves, Favshare, Flikode, Friendfeed, Gist, GoogleBuzz, Identica, JumpTags, Kailoon, Loggable, MetaFilter, Mixx, Mmo, MvcForge, MySpace, Nestdev, Newsvine, Ownable, PixelGroovy, Postable, Posterous, ProgrammersHeaven, Propeller, Queness, Reddit, Restful, Scribd, ScriptAndStyle, Service, Sharebrain, Shoutwire, Slideshare, Smipple, Snipplr, Snipt, Sphinn, Storage, StumbleUpon, Stumpedia, Support, Tumblr, Tweako, Twitter, WebBlend, Webdev5, WhoFreelance, Wordtaps, YahooBuzz, Youblr, Zabox Classes: AuthenticationError, Base, CommandInvalid, DuplicateError, Page, Post, RecordInvalid, SettingsError, User

Class Attribute Summary collapse

Class Method Summary collapse

Class Attribute Details

.configObject

Returns the value of attribute config.



25
26
27
# File 'lib/ubiquitously.rb', line 25

def config
  @config
end

.loggerObject

Returns the value of attribute logger.



25
26
27
# File 'lib/ubiquitously.rb', line 25

def logger
  @logger
end

Class Method Details

.configure(value) ⇒ Object



41
42
43
# File 'lib/ubiquitously.rb', line 41

def configure(value)
  self.config = value.is_a?(String) ? YAML.load_file(value) : value
end

.credentials(service) ⇒ Object



68
69
70
71
72
73
74
# File 'lib/ubiquitously.rb', line 68

def credentials(service)
  result = key(service)
  unless result && result.has_key?("key") && result.has_key?("secret")
    raise SettingsError.new("Please specify both a key and secret for ':#{service}'")
  end
  result
end

.debug?Boolean

Returns:

  • (Boolean)


54
55
56
# File 'lib/ubiquitously.rb', line 54

def debug?
  logger.debug?
end

.include?(service) ⇒ Boolean

Returns:

  • (Boolean)


64
65
66
# File 'lib/ubiquitously.rb', line 64

def include?(service)
  services.include?(service)
end

.key(path) ⇒ Object



58
59
60
61
62
# File 'lib/ubiquitously.rb', line 58

def key(path)
  result = self.config
  path.to_s.split(".").each { |node| result = result[node.to_s] if result }
  result.to_s
end

.run(args) ⇒ Object



27
28
29
30
31
32
33
34
35
36
37
38
39
# File 'lib/ubiquitously.rb', line 27

def run(args)
  command = args.shift
  if command =~ /(secrets|tokens|cookies|credentials)/
    system("open", File.expand_path("~/.u.me/#{$1}.yml"))
    exit
  end
  unless command =~ /(?:post|user)/
    message = "\nUbiquitously command must be for either 'post' or 'user', e.g.:\n"
    message << "u.me post twitter 'Working with Rails today...'"
    raise CommandInvalid.new(message)
  end
  "Ubiquitously::Command::#{command.camelize}".constantize.run(args)
end

.servicesObject



76
77
78
79
80
# File 'lib/ubiquitously.rb', line 76

def services
  Dir.entries(File.dirname(__FILE__) + '/ubiquitously/services')[2..-1].collect do |service|
    service = File.basename(service).split(".").first
  end
end