Sha256: 9c9679c34e5066b4efc9b55997f9bb7dfd81e312755c4792318b27f33f871117

Contents?: true

Size: 1.08 KB

Versions: 3

Compression:

Stored size: 1.08 KB

Contents

%w{rubygems nokogiri active_support httparty base64}.each { |f| require f }

$:.unshift(File.join(File.dirname(__FILE__), '..', 'lib'))

module Postly
  
  SITE_ATTRS    = [:name,    :url,      :private, :primary,   :hostname,  :commentsenabled, :num_posts, :id]
  POST_ATTRS    = [:site_id, :title,    :body,    :autopost,  :private,   :date,            :tags,      :source, :sourceLink, :id, :url]
  COMMENT_ATTRS = [:post_id, :comment,  :name,    :email,     :date]
  
  extend self
  
  # Base64 Encoding credentials for Basic Auth
  def encoded_credentials  
    @credentials ||= Base64.encode64("#{config['username']}:#{config['password']}")
  end
  
  def config
    @config ||= File.open(File.join(Dir.getwd, 'config/posterous.yml'), 'r') { |f| YAML.load(f) }
  end
  
  def config=(path)
    @config =  File.open(path, 'r') { |f| YAML.load(f) }
  end
  
  #
  def base_uri
    @base_uri ||= "http://posterous.com/api"
  end
  
  # Not sure if I need this yet
  class PostlyError < StandardError; end
end

%w{connection many_proxy post site blog_importer comment}.each {|f| require "postly/#{f}"}




Version data entries

3 entries across 3 versions & 2 rubygems

Version Path
progressions-postly-0.2.2 lib/postly.rb
postly-0.2.2 lib/postly.rb
postly-0.2.1 lib/postly.rb