Sha256: 4572e8ed4f6f41c0cd4691a600266968d7cf77c03f6202cc9c6a26f059d00c55

Contents?: true

Size: 1.04 KB

Versions: 1

Compression:

Stored size: 1.04 KB

Contents

module LJ
  class Base
    
    def initialize(auth)
      @client = auth
    end
    
    def event(title,body,keywords)
      options = base_event
      perform('postevent',options)
    end
    
    def comunity(comynity_name,title,body,keywords)
      options = base_event
      options["usejournal"]=comynity_name
      perform('perform',options)
    end
    
    
    
    private
      def perform(function, options={})
        LJ::Request.perform(function, options)
      end
      
      def common_options
        t=Time.now
        options = {}
        options["year"]=t.year
        options["mon"]=t.mon
        options["day"]=t.day
        options["hour"]=t.hour
        options["min"]=t.min
        options['username'] = @client.username
        options['password'] = @client.password
        options
      end
      
      def base_event
        options = common_options()
        options["mode"]="postevent"
        options["lineendings"]=keywords
        options["subject"]=title
        options["event"]=body
        options
      end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
lj-0.1.0 lib/lj/base.rb