Skip to content

A Ruby client for MockServer project. This client is code generated using the MockServer OpenAPI v3 specification.

Notifications You must be signed in to change notification settings

mock-server/mockserver-client-ruby

Repository files navigation

mockserver-client

MockServer - the Ruby gem for the Mock Server API

MockServer enables easy mocking of any system you integrate with via HTTP or HTTPS with clients written in Java, JavaScript and Ruby and a simple REST API (as shown below).

MockServer Proxy is a proxy that introspects all proxied traffic including encrypted SSL traffic and supports Port Forwarding, Web Proxying (i.e. HTTP proxy), HTTPS Tunneling Proxying (using HTTP CONNECT) and SOCKS Proxying (i.e. dynamic port forwarding).

Both MockServer and the MockServer Proxy record all received requests so that it is possible to verify exactly what requests have been sent by the system under test.

This SDK is automatically generated by the OpenAPI Generator project:

  • API version: 5.3.0
  • Package version: 5.3.0
  • Build package: org.openapitools.codegen.languages.RubyClientCodegen

Installation

Build a gem

To build the Ruby code into a gem:

gem build mockserver-client.gemspec

Then either install the gem locally:

gem install ./mockserver-client-5.3.0.gem

(for development, run gem install --dev ./mockserver-client-5.3.0.gem to install the development dependencies)

or publish the gem to a gem hosting service, e.g. RubyGems.

Finally add this to the Gemfile:

gem 'mockserver-client', '~> 5.3.0'

Install from Git

If the Ruby gem is hosted at a git repository: https://github.com/GIT_USER_ID/GIT_REPO_ID, then add the following in the Gemfile:

gem 'mockserver-client', :git => 'https://github.com/GIT_USER_ID/GIT_REPO_ID.git'

Include the Ruby code directly

Include the Ruby code directly using -I as follows:

ruby -Ilib script.rb

Getting Started

Please follow the installation procedure and then run the following code:

# Load the gem
require 'mockserver-client'

api_instance = MockServer::ControlApi.new
ports = MockServer::Ports.new # Ports | list of ports to bind to, where 0 indicates dynamically bind to any available port

begin
  #bind additional listening ports
  result = api_instance.bind_put(ports)
  p result
rescue MockServer::ApiError => e
  puts "Exception when calling ControlApi->bind_put: #{e}"
end

Documentation for API Endpoints

All URIs are relative to http://localhost:1080

Class Method HTTP request Description
MockServer::ControlApi bind_put PUT /bind bind additional listening ports
MockServer::ControlApi clear_put PUT /clear clears expectations and recorded requests that match the request matcher
MockServer::ControlApi reset_put PUT /reset clears all expectations and recorded requests
MockServer::ControlApi retrieve_put PUT /retrieve retrieve recorded requests, active expectations, recorded expectations or log messages
MockServer::ControlApi status_put PUT /status return listening ports
MockServer::ControlApi stop_put PUT /stop stop running process
MockServer::ExpectationApi expectation_put PUT /expectation create expectation
MockServer::VerifyApi verify_put PUT /verify verify a request has been received a specific number of times
MockServer::VerifyApi verify_sequence_put PUT /verifySequence verify a sequence of request has been received in the specific order

Documentation for Models

Documentation for Authorization

All endpoints do not require authorization.

About

A Ruby client for MockServer project. This client is code generated using the MockServer OpenAPI v3 specification.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages