Skip to content
StdLib Ruby Bindings
Branch: master
Clone or download
Latest commit 629490d Feb 25, 2017
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
lib Update gem details Feb 10, 2017
test Update gemspec Feb 7, 2017
.gitignore Update gemspec Feb 7, 2017
LICENSE Update gemspec Feb 7, 2017
README.md copy fix Feb 25, 2017
Rakefile Update gemspec Feb 7, 2017
lib.gemspec Update gem details Feb 10, 2017

README.md

StdLib Ruby Bindings

StdLib Setup | Node | Python | Ruby | Web

Basic Ruby bindings for StdLib service accession.

Used to interface with services built using StdLib and the StdLib Command Line Tools.

The lib package is available on RubyGems: lib and operates as zero-dependency interface to run StdLib functions. This means that you can utilize any service on StdLib without installing any additional dependencies, and when you've deployed services to StdLib, you have a pre-built Ruby SDK --- for example;

Inline Style

require 'lib'

begin
  result = Lib.yourUsername.hostStatus.exec! name: 'Dolores Abernathy'
rescue Exception => err
  # Handle Error
end

Block Style

require 'lib'

Lib.yourUsername.hostStatus.exec! name: 'Dolores Abernathy' do |err, result|
  puts err
  puts result
end

To discover StdLib services, visit https://stdlib.com/search. To build a service, get started with the StdLib CLI tools.

Installation

To install in an existing Ruby project;

$ gem install lib

Usage

require 'lib'

# [1]: Call "stdlib.reflect" function, the latest version, from StdLib
result = Lib.stdlib.reflect.exec! 0, 1, kwarg: 'value'

# [2]: Call "stdlib.reflect" function from StdLib, with "dev" environment
result = Lib.stdlib.reflect['@dev'].exec! 0, 1, kwarg: 'value'

# [3]: Call "stdlib.reflect" function from StdLib, with "release" environment
#      This is equivalent to (1)
result = Lib.stdlib.reflect['@release'].exec! 0, 1, kwarg: 'value'

# [4]: Call "stdlib.reflect" function from StdLib, with specific version
#      This is equivalent to (1)
result = Lib.stdlib.reflect['@0.0.1'].exec! 0, 1, kwarg: 'value'

# [5]: Call functions within the service (not just the defaultFunction)
#      This is equivalent to (1) when "main" is the default function
result = Lib.stdlib.reflect.main.exec! 0, 1, kwarg: 'value'

# Valid string composition from first object property only:
result = Lib['stdlib.reflect'].exec! 0, 1, kwarg: 'value'
result = Lib['stdlib.reflect[@dev]'].exec! 0, 1, kwarg: 'value'
result = Lib['stdlib.reflect[@release]'].exec! 0, 1, kwarg: 'value'
result = Lib['stdlib.reflect[@0.0.1]'].exec! 0, 1, kwarg: 'value'
result = Lib['stdlib.reflect.main'].exec! 0, 1, kwarg: 'value'
result = Lib['stdlib.reflect[@dev].main'].exec! 0, 1, kwarg: 'value'
result = Lib['stdlib.reflect[@release].main'].exec! 0, 1, kwarg: 'value'
result = Lib['stdlib.reflect[@0.0.1].main'].exec! 0, 1, kwarg: 'value'

Additional Information

To learn more about StdLib, visit stdlib.com or read the StdLib CLI documentation on GitHub.

You can follow the development team on Twitter, @StdLibHQ

StdLib is © 2016 - 2017 Polybit Inc.

You can’t perform that action at this time.