четвер, 12 січня 2012 р.

ex_ua ruby gem

Recently, I've published a ruby gem (ex_ua) to access http://ex.ua content.
Here is how it works:

ex.ua site contains categories and items.
Every content page is a category.
So video, movies, and "[en] People Under The Stairs (1991) - American movie" are categories.
There are 6 "basic" categories: Video, Audio, Images, Texts, Games, Software.
Each of them is available in different languages.

You get available languages this way:
client = ExUA::Client.new
client.available_languages
#=> {"ru"=>"русский", "uk"=>"українська", "en"=>"english", "es"=>"espanol", "de"=>"deutsch", "fr"=>"français", "pl"=>"polski", "ja"=>"日本語", "kk"=>"қазақ"}
To get basic categories, use:
base_categories = client.base_categories('ru')
This will give array of basic categories for a specified language.
You can do
sub_categories = base_categories[0].categories
to get sub categories of a category and so on.

Category can have items:
sub_categories[0].items
Items are actual download links.