Skip to content

astagi/ruby-ansa

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

17 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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