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

dsx-dml

Package Overview
Dependencies
Maintainers
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dsx-dml

  • 0.0.3
  • Rubygems
  • Socket score

Version published
Maintainers
1
Created
Source

DSX::Dml

Provides tools to ease working with the DSX DML command syntax, an archaic and obnoxious format used by DSX Access systems' SFTP APIs for making changes to records in their access control system's database(s).

Installation

Add this line to your application's Gemfile:

gem 'dsx-dml'

And then execute:

$ bundle

Or install it yourself as:

$ gem install dsx-dml

Usage

Zones (Locations) and Changesets (Batches of commands)

require 'dsx/dml'


# Declare what Location Number (zone) to make changes in and set the UDF field for UID string. 
# Optionally include sftp credentials.

zone = Dsx::Dml::Zone.new(1111, 2, {address: '127.0.0.1', user: 'dsx_user', password: 'dsx_password'})


# Use a unique identifier to create a changeset for that unique identifier

changeset_0 = zone.use('123456789100')


# Chain together changes for tables related to that unique identifier

changeset_0.table('Names').write({
            FName: 'Harry', 
            LName: 'Bird',
            Company: 'Harry Bird Co',
            Visitor: '',
            Trace: '',
            Notes: 'Often wears bowties'
        }).table('UDF').write({
            UdfNum: 2,
            UdfText: '123456789100'
        }).table('Cards').write({
            Code: '123456789100',
            PIN: 1234,
            StartDate: '01/01/2001',
            StopDate: '11/11/2111',
            NumUses: 9999
        })


# create another changeset for a different unique identifier

changeset_1 = zone.use('123456789101')

changeset_1.table('Cards').add_acl('Parking Garage').write()


# Push changesets to SFTP receiver (using the credentials passed to Zone.new)

changeset_0.net_sftp() # Uses ruby Net::SFTP library
changeset_1.curl() # requires system curl with SFTP support


Operations

Dsx::Dml::Operation is a wraper intended to make it easier to set up and use certain DML operations.

    require 'dsx/operation'

    op = Dsx::Dml::Operation.new({ location_num:  1111, 
                                   udf_num:       2, 
                                   first_name:    'Harry', 
                                   last_name:     'Bird', 
                                   company:       'Harry Bird Co', 
                                   identifier:    '123456789100' },
                                 { address: '127.0.0.1', 
                                   user: 'dsx_user',
                                   password: 'dsx_password' })
    op.access_levels += ['Top Secret Lab 1', 'Top Secret Lab 2']
    op.access_levels -= ['Super Secret Lab 0']
    op.linking_level = 3
    
    op.net_sftp()

Writer

Dsx::Dml::Writer is used to push commands to DSX SFTP endpoints. Supports Net::SFTP and curl.

While writer credentials can be passed through to Dsx::Dml::Operation and Dsx::Dml::Zone, writers can also be instantiated separately and passed at write time.

    
    require 'dsx/operation'
    require 'dsx/writer'

    writer = Dsx::Dml::Writer.new({ address: '127.0.0.1', 
                                   user: 'dsx_user',
                                   password: 'dsx_password' })

    op = Dsx::Dml::Operation.new({ location_num:  1111, 
                                   udf_num:       2, 
                                   first_name:    'Harry', 
                                   last_name:     'Bird', 
                                   company:       'Harry Bird Co', 
                                   identifier:    '123456789100' })
    op.access_levels += ['Top Secret Lab 3']

    op.net_sftp(writer)
    

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Push to the branch (git push origin my-new-feature)
  5. Create new Pull Request

FAQs

Package last updated on 26 Sep 2013

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