https://github.com/prx/open_calais
Ruby gem to access and parse OpenCalais API
https://github.com/prx/open_calais
Last synced: 9 months ago
JSON representation
Ruby gem to access and parse OpenCalais API
- Host: GitHub
- URL: https://github.com/prx/open_calais
- Owner: PRX
- License: mit
- Created: 2013-04-08T17:42:18.000Z (about 13 years ago)
- Default Branch: master
- Last Pushed: 2020-12-02T17:07:33.000Z (over 5 years ago)
- Last Synced: 2025-09-14T21:44:09.168Z (10 months ago)
- Language: Ruby
- Size: 49.8 KB
- Stars: 32
- Watchers: 8
- Forks: 21
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# OpenCalais
[](http://opensource.org/licenses/MIT)
[](https://travis-ci.org/PRX/open_calais)
[](https://codeclimate.com/github/PRX/open_calais)
[](https://coveralls.io/r/PRX/open_calais?branch=master)
_Gem Version 0.1.* supports the original OpenCalais API_
_Gem Version 0.2.* now uses the upgraded API http://www.opencalais.com/_
_Gem Version 0.4.* supports refinitiv API_
Open Calais is now found at: https://developers.refinitiv.com/open-permid/intelligent-tagging-restful-api
It has a new default endpoint: https://api-eit.refinitiv.com/permid/calais
This is a ruby gem to access the (formerly OpenCalais) [Refinitiv Intelligent Tagging API](https://developers.refinitiv.com/open-permid/intelligent-tagging-restful-api), using the REST API, and JSON responses.
It uses [Faraday](https://github.com/lostisland/faraday) to abstract HTTP library (defaults to use excon because it is excellent), and multi_json to abstract JSON parsing.
It returns a parsed version of the response, but the response also contains the raw response (converted from json to hashes/arrays/string/etc).
## Installation
Add this line to your application's Gemfile:
gem 'open_calais'
And then execute:
$ bundle
Or install it yourself as:
$ gem install open_calais
## Usage
Intelligent Tagging (OpenCalais) has one main method, `enrich`, and so does the gem:
```ruby
require 'open_calais'
# you can configure for all calls
OpenCalais.configure do |c|
c.api_key = "this is a test key"
end
# or you can configure for a single call
open_calais = OpenCalais::Client.new(:api_key => 'an api key')
# it returns a OpenCalais::Response instance
response = open_calais.enrich('Ruby on Rails is a fantastic web framework. It uses MVC, and the Ruby programming language invented by Matz in Japan.')
# which has the 'raw' response
response.raw
# and has been parsed a bit to get :language, :topics, :tags, :entities, :relations, :locations
# as lists of hashes
response.tags.each { |t| puts t[:name] }
```
## Contributing
1. Fork it
2. Create your feature branch (`git checkout -b my-new-feature`)
3. Commit your changes (`git commit -am 'Add some feature'`)
4. Push to the branch (`git push origin my-new-feature`)
5. Create new Pull Request