Zipmark Ruby Client
The Zipmark Ruby Client library is used to interact with Zipmark's API.
gem install zipmark
or in your Gemfile
Instantiating a client
require 'zipmark' client = Zipmark::Client.new( :application_id => "app-id", :application_secret => "my-secret", :vendor_identifier => "vendor-ident" )
Vendor Identifier, Application Identifier, Application Secret should be replaced with the values provided by Zipmark.
By default, Zipmark::Client sends all requests to our sandbox environment. This environment is identical to production except money never actually is moved. When you are putting your application into production and want people to actually be able to pay, you need to turn production mode on.
client = Zipmark::Client.new( :application_id => "app-id", :application_secret => "my-secret", :vendor_identifier => "vendor-ident", :production => true )
Loading a Bill from a known Bill ID
Discovering available resources
Resources will contain an array of all available resources.
Creating a new Bill
Create a bill object, set required attributes, send it to Zipmark
As an alternative, it is possible to build an object first and then save it afterwards
Updating an existing Bill
Get the bill, make a change, send it back to Zipmark
Retrieving a list of all Bills
Retrieve a list of all bills.
Get the number of objects available.
The Zipmark_Iterator class understands Zipmark's pagination system. It loads one page of objects at a time and will retrieve more objects as necessary while iterating through the objects.
Get the current object (returns null if the iterator has passed either end of the list)
Get the next/previous object (returns null if the next/previous object would pass either end of the list)
Iterating through a list of all Bills
The Zipmark_Iterator can be used to iterate through all objects of a given resource type.
The client is able to process, verify and extract data from callbacks received from the Zipmark service.
Loading a callback response
Verifying a callback
Retrieving the callback data
Valid callbacks contain events, object types and objects. The below functions will return their respective values/objects, or null if the callback is invalid.