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

testr1

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

testr1

  • 1.0.0
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Getting Started with APIMATIC Calculator

Getting Started

Introduction

Simple calculator API hosted on APIMATIC

Install the Package

Install the gem from the command line:

gem install testr1 -v 1.0.0

Or add the gem to your Gemfile and run bundle:

gem 'testr1', '1.0.0'

For additional gem details, see the RubyGems page for the testr1 gem.

Initialize the API Client

The following parameters are configurable for the API Client:

ParameterTypeDescription
environmentEnvironmentThe API environment.
Default: Environment.PRODUCTION
timeoutFloatThe value to use for connection timeout.
Default: 60
max_retriesIntegerThe number of times to retry an endpoint call if it fails.
Default: 0
retry_intervalFloatPause in seconds between retries.
Default: 1
backoff_factorFloatThe amount to multiply each successive retry's interval amount by in order to provide backoff.
Default: 1

The API client can be initialized as follows:

client = ApimaticCalculator::Client.new(
  environment: Environment::PRODUCTION,
)

Test the SDK

To run the tests, navigate to the root directory of the SDK in your terminal and execute the following command:

rake

Client Class Documentation

APIMATIC CalculatorClient

The gateway for the SDK. This class acts as a factory for the Controllers and also holds the configuration of the SDK.

Controllers

NameDescription
simple_calculatorProvides access to SimpleCalculatorController

API Reference

List of APIs

Simple Calculator

Overview
Get instance

An instance of the SimpleCalculatorController class can be accessed from the API Client.

simple_calculator_controller = client.simple_calculator
Get Calculate

Calculates the expression using the specified operation.

:information_source: Note This endpoint does not require authentication.

def get_calculate(options = {})
Parameters
ParameterTypeTagsDescription
operationOperationTypeEnumTemplate, RequiredThe operator to apply on the variables
xFloatQuery, RequiredThe LHS value
yFloatQuery, RequiredThe RHS value
Response Type

Float

Example Usage
collect = {}

operation = OperationTypeEnum::MULTIPLY
collect['operation'] = operation;

x = 222.14
collect['x'] = x;

y = 165.14
collect['y'] = y;

result = simple_calculator_controller.get_calculate(collect)

Model Reference

Enumerations

Operation Type

Possible operators are sum, subtract, multiply, divide

Class Name

OperationTypeEnum

Fields
NameDescription
SUMRepresents the sum operator
SUBTRACTRepresents the subtract operator
MULTIPLYRepresents the multiply operator
DIVIDERepresents the divide operator

Utility Classes Documentation

ApiHelper Class

API utility class.

Methods

NameReturn TypeDescription
json_deserializeHashDeserializes a JSON string to a Ruby Hash.
rfc3339DateTimeSafely converts a string into an RFC3339 DateTime object.

Common Code Documentation

HttpResponse

Http response received.

Properties
NameTypeDescription
status_codeIntegerThe status code returned by the server.
reason_phraseStringThe reason phrase returned by the server.
headersHashResponse headers.
raw_bodyStringResponse body.
requestHttpRequestThe request that resulted in this response.

HttpRequest

Represents a single Http Request.

Properties
NameTypeTagDescription
http_methodHttpMethodEnumThe HTTP method of the request.
query_urlStringThe endpoint URL for the API request.
headersHashOptionalRequest headers.
parametersHashOptionalRequest body.

FAQs

Package last updated on 04 Jan 2021

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