Giter Club home page Giter Club logo

gertrude's Introduction

Gertrude

Gertrude is your librarian. It's a simple rest service that feeds you unique items, that you define, by type. Those items are reserved until you release them back to the service.

As an example, this can be used to limit conflicts in users when testing. Testers (or automation) can request users from the service, and use them for testing. The service won't provide that specific user to another request, until the original requester releases it back to the service. Check your stuff back in to Gertrude. Dont be that guy.

How do I use this?

  • Install the gem.
  • Define your items in a yaml file, by type.
  • Start the service, using your created yaml file.
  • Request items from the service.
  • Use the requested items to your hearts content.
  • Release the item back to the service when you are done.
  • ???
  • PROFIT.

Define items in a yaml file, by type

Create a yaml file, using the following format:

---
item_type1:
  type1_item1:
    item1_property1: property1_value
    items1_property2: property2_value
  type1_item2:
    item2_property1: property1_value
    items2_property2: property2_value

Example (for an implementation to provide users):

---
admin:
  admin1:
    password: admin_password_1
    other: admin_other
  admin2:
    password: admin_password_2
    other: admin_other
  admin3:
    password: admin_password_3
    other: admin_other
basic:
  basic1:
  basic2:
  basic3:
custom_user:
  john_smith:
    password: jsmithpw
    rep_id: 8675309
    other_info:
      - foo
      - bar
          - baz

Alternately, you can replace the "all_items.yml" file in the repo with your yaml file, and then start the service.

Install the Gem

Install the gem

$gem install gertrude

Start service, using created yaml file

Start the service. In this example, we use rack:

$gertrude start -f path/to/yml

Request items from the service

Routes are as follows (please replace with your host address, item type, and port)

See all available items, and their properties.

  http://0.0.0.0:8080/

Get a list of all items available for reservation

  http://0.0.0.0:8080/available

Reserve an item.

  http:/0.0.0.0:8080/reserve/item?type=admin

Gertrude will return you the requested item as a hash.

 {'admin1' => {'password' => 'admin_password_1', 'other' => 'admin_other'}

You can pass a timeout, in seconds (default is 30). Sometimes you have to wait for an item to become available.

  http://0.0.0.0:8080/reserve/item?type=admin&timeout=120

Get a list of all items that are currently reserved.

  http://0.0.0.0:8080/reserved

Use the requested items to your hearts content

Enjoy your item, for however long you need to. Go ahead. Have a blast.

Release the item back to the service when you are done

Release an item back to the service. You can't keep it forever.

  http://0.0.0.0:8080/release/item?item=admin1

Release all currently reserved items.

  http://0.0.0.0:8080/release

gertrude's People

Contributors

adairjk avatar zion avatar wallaceh avatar uchagani avatar

Watchers

James Cloos avatar

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.