Sha256: a85c89611cc78b700ea931a0671c06972580f476952e693494b237683a8fade9

Contents?: true

Size: 1.15 KB

Versions: 2

Compression:

Stored size: 1.15 KB

Contents

module LJ
  class Base
    
    def initialize(auth)
      @client = auth
    end
    
    def event(title,body,keywords)
      options = base_event(title,body,keywords)
      perform('postevent',options)
    end
    
    def comunity(comynity_name,title,body,keywords)
      options = base_event(title,body,keywords)
      options["usejournal"]=comynity_name
      perform('postevent',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["ver"] = 1
        options['username'] = @client.username
        options['password'] = @client.password
        options
      end
      
      def base_event(title,body,keywords)
        options = common_options()
        options["mode"] = "postevent"
        options["props"] = {:taglist => keywords}
        options["subject"] = title
        options["event"] = body
        options
      end
  end
end

Version data entries

2 entries across 2 versions & 1 rubygems

Version Path
lj-0.3.0 lib/lj/base.rb
lj-0.2.0 lib/lj/base.rb