{"id":20445809,"url":"https://github.com/rapid7/sonar-client","last_synced_at":"2025-04-07T07:16:08.173Z","repository":{"id":23190518,"uuid":"26546862","full_name":"rapid7/sonar-client","owner":"rapid7","description":null,"archived":false,"fork":false,"pushed_at":"2025-02-13T19:53:07.000Z","size":136,"stargazers_count":22,"open_issues_count":4,"forks_count":8,"subscribers_count":18,"default_branch":"master","last_synced_at":"2025-03-31T06:05:26.821Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Ruby","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/rapid7.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2014-11-12T17:12:09.000Z","updated_at":"2025-02-13T19:53:10.000Z","dependencies_parsed_at":"2025-02-13T10:23:15.638Z","dependency_job_id":"d1c5de80-abcc-41ae-b8b9-d78ca5b3a187","html_url":"https://github.com/rapid7/sonar-client","commit_stats":{"total_commits":132,"total_committers":8,"mean_commits":16.5,"dds":"0.26515151515151514","last_synced_commit":"69e8b465a1c3566f91de42714af84f7a8925dc25"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rapid7%2Fsonar-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rapid7%2Fsonar-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rapid7%2Fsonar-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/rapid7%2Fsonar-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/rapid7","download_url":"https://codeload.github.com/rapid7/sonar-client/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247608154,"owners_count":20965952,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-15T10:14:19.651Z","updated_at":"2025-04-07T07:16:08.101Z","avatar_url":"https://github.com/rapid7.png","language":"Ruby","funding_links":[],"categories":[],"sub_categories":[],"readme":"sonar-client\n===============\n\nRuby API Wrapper and CLI for [Sonar](https://sonar.labs.rapid7.com)\n\n[![Gem Version](https://badge.fury.io/rb/sonar-client.svg)](http://badge.fury.io/rb/sonar-client)\n[![Build Status](https://travis-ci.org/rapid7/sonar-client.svg?branch=master)](https://travis-ci.org/rapid7/sonar-client)\n\n## Installation\n\nInstall the gem by running\n\n    gem install sonar-client\n\nor add this line to your application's Gemfile:\n\n    gem 'sonar-client'\n\nAnd then execute:\n\n    $ bundle install\n\n## Gem usage\n\n```ruby\n    require 'sonar'\n\n    # If you're using Rails 3+, create an initializer\n    # config/initializers/sonar.rb\n    Sonar.configure do |config|\n      config.api_url        = 'https://sonar.labs.rapid7.com'\n      config.api_version    = 'v2'\n      config.email          = 'email@example.com'\n      config.access_token   = 'YOURTOKEN'\n    end\n\n    # If you're using straight ruby (no Rails),\n    # create a Sonar::Client Object\n    options = {\n      api_url: 'https://sonar.labs.rapid7.com',\n      api_version: 'v2',\n      access_token: 'YOURTOKEN',\n      email: 'email@example.com'\n    }\n    client = Sonar::Client.new(options)\n\n    # Create a Client Object expecting you have an initializer in place\n    # Sonar::Client Object\n    client = Sonar::Client.new\n\n    # Get fdns\n    client.search(fdns: 'rapid7.com')\n    # =\u003e responds with a Hashie object\n```\n\n## Running the specs\n\nUntil they're mocked, specs are run against a live API, either production, staging, or localhost (development).  The config in `spec/spec_helper.rb` requires several credentials to be set as environment variables to make requests.  Consider adding this to your `~/.bashrc` or export the variables before running the specs:\n\n```\n# Sonar config\nexport SONAR_TOKEN=asldkstokenalskdjf\nexport SONAR_API_URL=http://sonar.labs.rapid7.com/\nexport SONAR_EMAIL=youremail@example.com\n```\n\nOnce you have the variables set, `rspec spec` will run all the specs.\n\n## CLI dev setup\n\nFrom the project root directory\n```\n$ rake install\nsonar-client 0.0.1 built to pkg/sonar-client-0.0.1.gem.\nsonar-client (0.0.1) installed.\n$ sonar\n```\n\nOn the first run, sonar will setup a sonar.rc config file in your user folder.  Run `sonar config` to view the full path to your config file.  Here's what your file will look like when it's first created:\n```\nemail: YOUR_EMAIL\naccess_token: SONAR_TOKEN\napi_url: https://sonar.labs.rapid7.com\nformat: flat\nrecord_limit: 10000\n```\nReplace YOUR_EMAIL with the email you used to register on the [Sonar website](https://sonar.labs.rapid7.com).  Replace SONAR_TOKEN with your API token found on the [Settings page](https://sonar.labs.rapid7.com/users/edit) of the Sonar website.  The format option can either pretty-print the return JSON or display it in a flat output (by default).  The record limit is the maximum number of records to return for a query.  Responses are returned in 1000 record chunks that are streamed into the output to avoid API timeouts.  Enclosing quotes around these two settings are not needed.  These configurations can always be overwritten for a single command line query by specifying the option and argument: `--format pretty`.\n\n## CLI usage\n\nTyping `sonar help` will list all the available commands. You can type `sonar help TASK` to get help for a specific command.  If running locally from the root project directory, you may need to prefix `sonar` commands with `bundle exec`.  A rdns search command might look like `bundle exec sonar search rdns .rapid7.com`.\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b feature/my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frapid7%2Fsonar-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Frapid7%2Fsonar-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Frapid7%2Fsonar-client/lists"}