Sha256: c7be6c1312e5082b7bdbb5a7d26a3e59a66342c955de43a4e55c732ff3f0877f

Contents?: true

Size: 912 Bytes

Versions: 2

Compression:

Stored size: 912 Bytes

Contents

libdir = File.dirname(__FILE__)
$LOAD_PATH.unshift(libdir) unless $LOAD_PATH.include?(libdir)

require 'siteleaf/version'
require 'siteleaf/client'
require 'siteleaf/server'
require 'siteleaf/entity'
require 'siteleaf/site'
require 'siteleaf/page'
require 'siteleaf/post'
require 'siteleaf/meta'
require 'siteleaf/user'

module Siteleaf

  @api_base = 'https://api.siteleaf.com/v1'
  
  class << self
    attr_accessor :api_key, :api_secret, :api_base
  end
  
  def self.api_url(url='')
    "#{@api_base}/#{url}"
  end
  
  def self.settings_file
    "#{Etc.getpwuid.dir}/.siteleaf"
  end
  
  def self.load_settings
    if File.exists?(self.settings_file)
      config = File.open(self.settings_file) do|file|
        Marshal.load(file)
      end
      self.api_key = config[:api_key] if config.has_key?(:api_key)
      self.api_secret = config[:api_secret] if config.has_key?(:api_secret)
    end
  end
  
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
siteleaf-0.8.1 lib/siteleaf.rb
siteleaf-0.8.0 lib/siteleaf.rb