A Ruby library for driving certain Ingenico payment terminals via ethernet, USB or serial connection.
Warning: this library is incomplete and still under active development! The APIs may change at any time, without notice, and all that jazz.
This gem was written for Ruby v1.9.2 and later. If you're not using at least v1.9.2, it will likely not work. Due to both architectural and time constraints, this gem will not be compatible with any version of Ruby prior to v1.9.2.
Add 'rpos' to your Gemfile:
Then install your bundle:
Don't forget to
bundle update frequently. Since the gem is still under active development, there will probably be a lot of frequent releases.
Using Regular RubyGems
Not using Bundler? Shame on you!
Install the gem:
gem install rpos
Require the gem:
Using the gem is pretty easy. First, connect to the terminal via ethernet:
connection = Rpos::Adapter::Ethernet.new @ethernet_ip, @ethernet_port
NOTE: USB and serial support is not implemented at this time, but will be available in the near future.
Now that you have a connection, let's perform a simple Unit Data request:
response = connection.request :unit_data
If it is a request that does not produce a response, the response returned will be
if response.nil? # no response from terminal else # dump the response to STDOUT puts response.inspect end
If you need to pass data as part of the request, it will be named and take the form of a ruby Hash:
response = connection.request :set_variable, :response_type => "1", :variable_id => "scrolling_line", :variable_data => "Hello"
Which data to pass into the request, as well as the exact format of the response, depends entirely upon which type of request you are actually performing. See the classes documented at http://rubydoc.info/gems/rpos/Rpos/Messages for more information on a per-request/response level.