Sha256: d466ac23dd6193bdb31d27dc0d092739cbbb3b9c0568716e6b67cc5069d40254

Contents?: true

Size: 779 Bytes

Versions: 7

Compression:

Stored size: 779 Bytes

Contents

Dir[File.dirname(__FILE__) + '/wikipedia/**/*.rb'].each { |f| require f }

require 'uri'

module Wikipedia
  # Examples : 
  # page = Wikipedia.find('Rails') 
  # => #<Wikipedia:0x123102>
  # page.content
  # => wiki content appears here
  
  # basically just a wrapper for doing 
  # client = Wikipedia::Client.new
  # client.find('Rails')
  #
  def self.find( page, options = {} )
    client.find( page, options )
  end
  def self.find_image( title, options = {} )
    client.find_image( title, options )
  end
  
  def self.Configure(&block)
    Configuration.instance.instance_eval(&block)
  end
  
  Configure {
    protocol  'http'
    domain    'en.wikipedia.org'
    path      'w/api.php'
  }

  private

  def self.client
    @client ||= Wikipedia::Client.new
  end
end

Version data entries

7 entries across 7 versions & 1 rubygems

Version Path
wikipedia-client-1.3.3 lib/wikipedia.rb
wikipedia-client-1.3.2 lib/wikipedia.rb
wikipedia-client-1.3.0 lib/wikipedia.rb
wikipedia-client-1.2.0 lib/wikipedia.rb
wikipedia-client-1.1.2 lib/wikipedia.rb
wikipedia-client-1.1.1 lib/wikipedia.rb
wikipedia-client-1.1.0 lib/wikipedia.rb