Module: Ansa

Defined in:
lib/ansa.rb,
lib/ansa/news.rb,
lib/ansa/client.rb,
lib/ansa/errors.rb,
lib/ansa/constants.rb,
lib/ansa/docs/dynamic_docs.rb

Defined Under Namespace

Classes: AnsaError, News

Constant Summary collapse

HOMEPAGE =

Constant for homepage news.

Since:

  • 1.0.0

'homepage'
NEWS =

Constant for main news.

Since:

  • 1.0.0

'news'
POLITICS =

Constant for politics news.

Since:

  • 1.0.0

'politics'
WORLD =

Constant for world news.

Since:

  • 1.0.0

'world'
ECONOMY =

Constant for economy news.

Since:

  • 1.0.0

'economy'
SOCCER =

Constant for soccer news.

Since:

  • 1.0.0

'soccer'
SPORT =

Constant for sport news.

Since:

  • 1.0.0

'sport'

Class Method Summary collapse

Class Method Details

.get_economy_newsArray<Ansa::News>

Note:

This method is autogenerated, it fetches www.ansa.it/sito/notizie/economia/economia_rss.xml

Get news for “economy” category.

Returns:

  • (Array<Ansa::News>)

    all the news of category “economy”.

Raises:

Since:

  • 1.0.0



6
# File 'lib/ansa/docs/dynamic_docs.rb', line 6

generate_get_news 'economy', 'http://www.ansa.it/sito/notizie/economia/economia_rss.xml', '1.0.0'

.get_homepage_newsArray<Ansa::News>

Note:

This method is autogenerated, it fetches www.ansa.it/sito/ansait_rss.xml

Get news for “homepage” category.

Returns:

  • (Array<Ansa::News>)

    all the news of category “homepage”.

Raises:

Since:

  • 1.0.0



2
# File 'lib/ansa/docs/dynamic_docs.rb', line 2

generate_get_news 'homepage', 'http://www.ansa.it/sito/ansait_rss.xml', '1.0.0'

.get_news(category) ⇒ Array<Ansa::News>

Get news given a category.

Parameters:

  • category

    name, ‘:text`

Returns:

  • (Array<Ansa::News>)

    all the news of the given category.

Raises:

Since:

  • 1.0.0



48
49
50
51
52
53
# File 'lib/ansa/client.rb', line 48

def self.get_news(category)
  if not LINKS.include? category
    raise AnsaError.new("Category #{category} not available")
  end
  get_news_by_url(LINKS[category])
end

.get_news_newsArray<Ansa::News>

Note:

This method is autogenerated, it fetches www.ansa.it/sito/notizie/cronaca/cronaca_rss.xml

Get news for “news” category.

Returns:

  • (Array<Ansa::News>)

    all the news of category “news”.

Raises:

Since:

  • 1.0.0



3
# File 'lib/ansa/docs/dynamic_docs.rb', line 3

generate_get_news 'news', 'http://www.ansa.it/sito/notizie/cronaca/cronaca_rss.xml', '1.0.0'

.get_politics_newsArray<Ansa::News>

Note:

This method is autogenerated, it fetches www.ansa.it/sito/notizie/politica/politica_rss.xml

Get news for “politics” category.

Returns:

  • (Array<Ansa::News>)

    all the news of category “politics”.

Raises:

Since:

  • 1.0.0



4
# File 'lib/ansa/docs/dynamic_docs.rb', line 4

generate_get_news 'politics', 'http://www.ansa.it/sito/notizie/politica/politica_rss.xml', '1.0.0'

.get_soccer_newsArray<Ansa::News>

Note:

This method is autogenerated, it fetches www.ansa.it/sito/notizie/sport/calcio/calcio_rss.xml

Get news for “soccer” category.

Returns:

  • (Array<Ansa::News>)

    all the news of category “soccer”.

Raises:

Since:

  • 1.0.0



7
# File 'lib/ansa/docs/dynamic_docs.rb', line 7

generate_get_news 'soccer', 'http://www.ansa.it/sito/notizie/sport/calcio/calcio_rss.xml', '1.0.0'

.get_sport_newsArray<Ansa::News>

Note:

This method is autogenerated, it fetches www.ansa.it/sito/notizie/sport/sport_rss.xml

Get news for “sport” category.

Returns:

  • (Array<Ansa::News>)

    all the news of category “sport”.

Raises:

Since:

  • 1.0.0



8
# File 'lib/ansa/docs/dynamic_docs.rb', line 8

generate_get_news 'sport', 'http://www.ansa.it/sito/notizie/sport/sport_rss.xml', '1.0.0'

.get_world_newsArray<Ansa::News>

Note:

This method is autogenerated, it fetches www.ansa.it/sito/notizie/mondo/mondo_rss.xml

Get news for “world” category.

Returns:

  • (Array<Ansa::News>)

    all the news of category “world”.

Raises:

Since:

  • 1.0.0



5
# File 'lib/ansa/docs/dynamic_docs.rb', line 5

generate_get_news 'world', 'http://www.ansa.it/sito/notizie/mondo/mondo_rss.xml', '1.0.0'