An API for securitytext.org
How to Build
This client library is a Ruby gem which can be compiled and used in your Ruby and Ruby on Rails project. This library requires a few gems from the RubyGems repository.
- Open the command line interface or the terminal and navigate to the folder containing the source code.
gem build securitytext_org_api.gemspecto build the gem.
- Once built, the gem can be installed on the current work environment using
gem install securitytext_org_api-1.0.0.gem
How to Use
The following section explains how to use the SecuritytextOrgApi Ruby Gem in a new Rails project using RubyMine™. The basic workflow presented here is also applicable if you prefer using a different editor or IDE.
1. Starting a new project
Close any existing projects in RubyMine™ by selecting
File -> Close Project. Next, click on
Create New Project to create a new project from scratch.
TestApp as the project name, choose
Rails Application as the project type, and click
In the next dialog make sure that correct Ruby SDK is being used (minimum 2.0.0) and click
This will create a new Rails Application project with an existing set of files and folder.
2. Add reference of the gem
In order to use the SecuritytextOrgApi gem in the new project we must add a gem reference. Locate the
Gemfile in the Project Explorer window under the
TestApp project node. The file contains references to all gems being used in the project. Here, add the reference to the library gem by adding the following line:
gem 'securitytext_org_api', '~> 1.0.0'
3. Adding a new Rails Controller
TestApp project is created, a folder named
controllers will be visible in the Project Explorer under the following path:
TestApp > app > controllers. Right click on this folder and select
New -> Run Rails Generator....
Selecting the said option will popup a small window where the generator names are displayed. Here, select the
Next, a popup window will ask you for a Controller name and included Actions. For controller name provide
Hello and include an action named
Index and click
A new controller class anmed
HelloController will be created in a file named
hello_controller.rb containing a method named
Index. In this method, add code for initialization and a sample for its usage.
How to Test
You can test the generated SDK and the server with automatically generated test cases as follows:
- From terminal/cmd navigate to the root directory of the SDK.
bundle exec rake
API client can be initialized as following.
client = SecuritytextOrgApi::SecuritytextOrgApiClient.new
The added initlization code can be debugged by putting a breakpoint in the
Index method and running the project in debug mode by selecting
Run -> Debug 'Development: TestApp'.
Get singleton instance
The singleton instance of the
WhoisController class can be accessed from the API Client.
whois_controller = client.whois
Query the server for a Domain object
def create_api_whois_query(body); end
||Body of API request|
body = RequestsQueryModel.new result = whois_controller.create_api_whois_query(body)
|Error Code||Error Description|
|500||Internal Server Error|