Skip to content

Latest commit

 

History

History
47 lines (30 loc) · 1.21 KB

README.md

File metadata and controls

47 lines (30 loc) · 1.21 KB

Ansa Library for Ruby

Read news from Ansa 🗞

Yard Docs Gem Version Build Status codecov

Install

Add to your Gemfile

gem 'ansa'

Usage

Import using

require 'ansa'

Get all the news about soccer

news = Ansa::get_soccer_news()
puts news[0].title

You can also use get_news method, specifying the category you want

news = Ansa::get_news(Ansa::SOCCER)

For more methods see the documentation.

Example

require 'ansa'

puts "\n⚽️  SOCCER NEWS ⚽️\n\n"

begin
  Ansa::get_soccer_news.each do |news|
    puts "🥅  [#{news.date.strftime("%d/%m %H:%M:%S")}] #{news.title}"
    puts news.description
    puts "\n"
  end
rescue Ansa::AnsaError
  puts "🚨  Something went wrong, news not available"
end