Getting Started with BATester with custom parameters

Getting Started

Install the Package

Install the gem from the command line:

gem install BATester -v 1.1.0

Or add the gem to your Gemfile and run bundle:

gem 'BATester', '1.1.0'

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

Environments

The SDK can be configured to use a different environment for making API calls. Available environments are:

Fields

Name Description
production -
testing Default

Initialize the API Client

The following parameters are configurable for the API Client:

Parameter Type Description
username String Default: 'farhan'
password String Default: 'apimatic'
port String Default: '80'
suites SuiteCodeEnum Default: SuiteCodeEnum::HEARTS
environment Environment The API environment.
Default: Environment.TESTING
timeout Float The value to use for connection timeout.
Default: 60
max_retries Integer The number of times to retry an endpoint call if it fails.
Default: 0
retry_interval Float Pause in seconds between retries.
Default: 1
backoff_factor Float The 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 = BaTesterWithCustomParameters::Client.new(
  username: 'farhan',
  password: 'apimatic',
  environment: Environment::TESTING,
  port: '80',
  suites: SuiteCodeEnum::HEARTS,
)

Authorization

This API uses Basic Authentication.

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

BATester with custom parameters Client

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

Controllers

Name Description
api Gets APIController

API Reference

List of APIs

API

Overview

Get instance

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

client_controller = client.client

Get Basic Auth Test

def get_basic_auth_test
Response Type

String

Example Usage
result = client_controller.get_basic_auth_test()

Model Reference

Enumerations

Suite Code

A integer based enum representing a Suite in a game of cards

Class Name

SuiteCodeEnum

Fields
Name
HEARTS
SPADES
CLUBS
DIAMONDS

Utility Classes Documentation

ApiHelper Class

API utility class.

Methods

Name Return Type Description
json_deserialize Hash Deserializes a JSON string to a Ruby Hash.
rfc3339 DateTime Safely converts a string into an RFC3339 DateTime object.

Common Code Documentation

HttpResponse

Http response received.

Properties

Name Type Description
status_code Integer The status code returned by the server.
reason_phrase String The reason phrase returned by the server.
headers Hash Response headers.
raw_body String Response body.
request HttpRequest The request that resulted in this response.

HttpRequest

Represents a single Http Request.

Properties

Name Type Tag Description
http_method HttpMethodEnum The HTTP method of the request.
query_url String The endpoint URL for the API request.
headers Hash Optional Request headers.
parameters Hash Optional Request body.