GithubHelp home page GithubHelp logo

ngrok-api-ruby's Introduction

ngrok API client library for Ruby

This library wraps the ngrok HTTP API to make it easier to consume in Ruby.

Installation

This library is published on Rubygems

gem install ngrok-api

Support

The best place to get support using this library is through the ngrok Slack Community. If you find any bugs, please contribute by opening a new GitHub issue.

Documentation

A quickstart guide and a full API reference are included in the ngrok Ruby API documentation

Quickstart

Please consult the documentation for additional examples.

require 'ngrokapi'
client = NgrokAPI::Client.new(api_key: '<API KEY>')

# Get an instance of the api_keys client and list all API keys
keys_client = client.api_keys
keys_client.list

# Or set up an edge and backend with the ability to change your configuration later
edge = client.edges.https.create!(
  description: "A Ruby Created Edge",
  metadata: '{"client": "ruby"}',
  hostports: ["your-subdomain.ngrok.io:443"]
)

backend = client.backends.tunnel_group.create!(
  description: "A Ruby Created Backend",
  labels: {"client_example": "ruby"}
)

route = client.edges.https_routes.create!(
  edge_id: edge.id,
  match_type: "path_prefix",
  match: "/",
  description: "Root",
  backend: NgrokAPI::Models::EndpointBackendMutate.new(attrs: {"enabled": true, "backend_id": backend.id}),
  compression: NgrokAPI::Models::EndpointCompression.new(attrs: {"enabled": true})
)

client.edge_modules.https_edge_route_compression.replace!(
  edge_id: edge.id,
  id: route.id,
  a_module: NgrokAPI::Models::EndpointCompression.new(attrs: {"enabled": false})
)

Local Documentation

Documentation can be generated with the command:

bundle exec yard doc 'lib/**/*.rb'

This will generate documentation which can be viewed within the doc folder.

Specs

Specs can be run with the command:

bundle exec rake

This will generate a coverage report which can be viewed within the coverage folder.

Rubocop

Rubocop can be run with the command:

# Run rubocop on lib folder
bundle exec rubocop 'lib'

# Run rubcop on all files
bundle exec rubocop

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.