Overview

RapidAPI is the world's first opensource API marketplace. It allows developers to discover and connect to the world's top APIs more easily and manage multiple API connections in one place.

Ruby SDK

  • In case you're using gemfile:
  gem 'rapidapi', '~> 0.1.2'
  • Otherwise, you can install the gem manually using:
  gem install rapidapi

Initialization

Import RapidAPISDK by putting the following code in your header file

  require 'rapidapisdk'

Now initialize it using:

  RapidAPI.config(
    project: 'PROJECT_NAME',
    token: 'TOKEN'
  )

Usage

To use any block in the marketplace, just copy it's code snippet and paste it in your code. For example, the following is the snippet for the Delivery.sendSMS block:

  response = RapidAPI.call('MicrosoftEmotionAPI', 'getEmotionRecognition', { 'param1': 'xxxxx', 'param2': 'xxxx' })

Notice that the error event will also be called if you make an invalid block call (for example - the package you refer to does not exist).

Using Files

Whenever a block in RapidAPI requires a file, you can either pass a URL to the file or a read stream.

URL

The following code will call the block MicrosoftComputerVision.analyzeImage with a URL of an image:

  response = RapidAPI.call('MicrosoftEmotionAPI', 'getEmotionRecognition', { 'param1': 'xxxxx', 'image': 'http://image.url/' })

Post File

If the file is locally stored, you can read it using NSFileManager and pass the read stream to the block, like the following:

response = RapidAPI.call('MicrosoftEmotionAPI', 'getEmotionRecognition', { 'subscriptionKey': 'xxxxxxx', 'image': UploadIO.new(File.new("Happy-man.jpg"), "image/jpg", "Happy-man.jpg") })

Issues:

As this is a pre-release version of the SDK, you may expirience bugs. Please report them in the issues section to let us know. You may use the intercom chat on rapidapi.com for support at any time.

License:

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.