Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

runa-ruby-client

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

runa-ruby-client

  • 0.3.1
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

Runa Ruby Client

A simple client for Runa.io B2B Synchronous API (Document Version 1.7).

Installation

Add this line to your application's Gemfile:

gem 'runa-ruby-client'

And then execute:

$ bundle

Or install it yourself as:

$ gem install runa-ruby-client

Usage

Simple example for ordering a Digital Card

# a simple client
client = Runa::Client.new(
      :api_host => 'https://playground.runa.io',
      :api_path => '/api/b2b-sync/v1',
      :api_key => ENV['AUTH_NAME'],
      :api_secret => ENV['AUTH_PASS'],
      :proxy => ENV['PROXY']
)

# with all available products
get_products = client.products

if get_products.is_successful?
  # it provides a list of all vouchers
  vouchers = products.all
else
  # get_products.status => 403
  # get_products.error_details => "Forbidden"
end

# or just a single one
product = client.products('PROD-ID')

# and data
product.description
product.redeem_instructions_html
product.e_code_usage_type
# ... etc

# post a simple order
order = client.order(
        :product_code => product.code,
        :currency_code => 'USD',
        :amount => '42.00',
        :delivery_method => 'direct', # default
        :delivery_format => 'raw', # default
        :external_ref => '123' # optional
)

# which returns
if order.is_successful?

  # some nice data
  order.code
  order.order_id
  order.pin
  order.barcode_format
  order.barcode_string
  order.expiry_date
  order.delivery_url

end

Development

After checking out the repo, run bin/setup to install dependencies. Then, run rake spec to run the tests. You can also run bin/console for an interactive prompt that will allow you to experiment.

To install this gem onto your local machine, run bundle exec rake install. To release a new version, update the version number in version.rb, and then run bundle exec rake release, which will create a git tag for the version, push git commits and tags, and push the .gem file to rubygems.org.

Testing

Run it!

rspec

It will load all tapes found in spec/tapes, we are using VCR.

To remaster all recordings, you will need a playground account. Add an .env file to your root:

# .env
AUTH_NAME='playground_username'
AUTH_PASS='playground_password'
PROXY='proxy_uri'

Start the VCR with rspec - this should add all Tapes to spec/tapes.

Contributing

Bug reports and pull requests are welcome on GitHub at https://github.com/mo-work/runa-ruby-client. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.

License

The gem is available as open source under the terms of the MIT License.

FAQs

Package last updated on 17 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc