Project

onyphe

0.0
No commit activity in last 3 years
No release in over 3 years
ONYPHE API wrapper for Ruby
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 2.1
~> 0.8
~> 13.0
~> 3.9
~> 5.1
~> 3.8
 Project Readme

Onyphe-rb

Gem Version Build Status Coverage Status Codacy Badge

Onyphe v2 API wrapper for Ruby.

Installation

Add this line to your application's Gemfile:

gem 'onyphe'

And then execute:

$ bundle

Or install it yourself as:

$ gem install onyphe

Usage

As a library

require "ohyphe"

# When given nothing, it tries to load your API key from ENV["ONYPHE_API_KEY"]
api = Onyphe::API.new
# or you can pass your API key as an argument
api = Onyphe::API.new(YOUR_API_KEY)

api.summary.ip("1.1.1.1")
api.summary.domain("example.com")
api.summary.hostname("example.com")

api.simple.geoloc("1.1.1.1")
api.simple.ctl("example.com")

api.search("category:datascan product:Nginx protocol:http os:Windows tls:true")

api.alert.list
api.alert.add(name: "foo", query:"bar", email: "foo@bar.com")
api.alert.delete("id")

Pagination

Enumerable style pagination is not supported at the present time.

You can specify page index by passing page argument to the method.

res = api.simple.threatlist(country: "RU", page: 1)
page = res.dig("page")
max_page = res.dig("max_page")

((page + 1)..max_page).each do |index|
  res = api.simple.threatlist({ country: "RU" }, page = index)
end

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/nioseki/onyphe.

License

The gem is available as open source under the terms of the MIT License.