Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

whos_got_dirt

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

whos_got_dirt

  • 0.0.5
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Who's got dirt? A federated search API for influence data

Gem Version Build Status Dependency Status Coverage Status Code Climate

Usage

This gem provides a common API to multiple APIs. See the server for a deployment.

To add support for new APIs, see the documentation for Request and Response.

In this example, we convert generic API parameters to an OpenCorporates API URL, and request the URL with Faraday. Then, we convert the OpenCorporates API response to a generic API response.

require 'whos_got_dirt'
require 'faraday'

input = {
  'subject' => [{
    'name~=' => 'John Smith',
  }],
  'jurisdiction_code|=' => ['gb', 'ie'],
  'role' => 'director',
  'inactive' => false,
}

url = WhosGotDirt::Requests::Relation::OpenCorporates.new(input).to_s
#=> "https://api.opencorporates.com/officers/search?q=John+Smith&jurisdiction_code=gb%7Cie&position=director&inactive=false&order=score"

response = Faraday.get(url)

results = WhosGotDirt::Responses::Relation::OpenCorporates.new(response).to_a
#=> [{"@type"=>"Relation",
#  "subject"=>
#   {"name"=>"JOHN SMITH",
#    "contact_details"=>[],
#    "occupation"=>"CONTRACTS DIRECTORS"},
#  "object"=>
#   {"name"=>"IMPERIAL DUCTWORK SERVICES HOLDINGS LIMITED",
#    "identifiers"=>[{"identifier"=>"08484366", "scheme"=>"Company Register"}],
#    "links"=>[{"url"=>"https://opencorporates.com/companies/gb/08484366", "note"=>"OpenCorporates URL"}],
#    "jurisdiction_code"=>"gb"},
#  "start_date"=>"2013-04-30",
#  "identifiers"=>[{"identifier"=>"71863990", "scheme"=>"OpenCorporates"}],
#  "links"=>[{"url"=>"https://opencorporates.com/officers/71863990", "note"=>"OpenCorporates URL"}],
#  "updated_at"=>"2014-10-13T13:57:58+00:00",
#  "current_status"=>"CURRENT",
#  "jurisdiction_code"=>"gb",
#  "role"=>"director",
#  "sources"=>[{"url"=>"https://api.opencorporates.com/officers/search?inactive=false&jurisdiction_code=gb%7Cie&order=score&position=director&q=John+Smith", "note"=>"OpenCorporates"}]},
#  ...]

Acknowledgements

Most terms are from Popolo. The request and response formats are inspired from the Metaweb Query Language and the OpenRefine Reconciliation Service API.

Copyright (c) 2015 James McKinney, released under the MIT license

FAQs

Package last updated on 27 Feb 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc