Project

geocerts

0.0
No commit activity in last 3 years
No release in over 3 years
A Ruby library for interfacing with the GeoCerts REST API
2005
2006
2007
2008
2009
2010
2011
2012
2013
2014
2015
2016
2017
2018
2019
2020
2021
2022
2023
2024
 Dependencies

Development

~> 1.3.0
~> 1.3.0
~> 0.9.0
~> 2.11.0
~> 1.5.0

Runtime

~> 0.1.0
 Project Readme

GeoCerts

Gem Version Build Status Code Climate

The GeoCerts library provides a Ruby interface to the GeoCerts REST API. This API allows you to manage (lookup, create, and verify) your GeoCerts orders, events, certificates, and more.

Installation

Add the following line to your application's Gemfile:

gem 'geocerts'

And then execute:

$ bundle

Or, install it directly with:

$ gem install geocerts

Usage

require 'geocerts'

GeoCerts.partner_id = 'example'
GeoCerts.api_token  = 'abd123DEfg.....'

begin
  GeoCerts::Order.all                           # => [ GeoCerts::Order, GeoCerts::Order, ... ]
  GeoCerts::Order.find(12345).certificate       # => GeoCerts::Certificate
  GeoCerts::Product.all                         # => [ GeoCerts::Product, GeoCerts::Product, ... ]

  product = GeoCerts::Product.find('Q')
  product.user_agreement                        # => GeoCerts::Agreement
  puts product.user_agreement.text              # => "...."

  # Validate the requested order details
  validated_order = GeoCerts::Order.validate({
    :csr      => GeoCerts::CSR.new(:body => "-----BEGIN CERTIFICATE REQUEST-----\n...."),
    :product  => product
  })
  validated_order.renewal_information.indicator # => true
  validated_order.renewal_information.months    # => 1
  validated_order.csr.common_name               # => 'www.example.com'
  validated_order.csr.state                     # => 'Georgia'
  validated_order.total_price                   # => 99.00

  # Create a new Order
  order = GeoCerts::Order.new({
    :csr      => GeoCerts::CSR.new(:body => "-----BEGIN CERTIFICATE REQUEST-----\n...."),
    :product  => product,
    :years    => 3,
    :licenses => 1
  }).save

rescue GeoCerts::Exception
  puts $!.to_s
end

Exceptions

Since this library does interface with an external system, there is a much greater risk of exceptional situations. As such, this library attempts to wrap all raised exceptions (due to authorization, connection, or other unforeseen issues) in the GeoCerts::Exception object. All exceptions raised from within this library should inherit from this class.

Exceptions which are raised after successful connections, due to server or request issues, will be derived from GeoCerts::ExceptionWithResponse. This object also inherits from GeoCerts::Exception, but contains the actual response details (including HTTP status code, headers, and response body).

Contributing

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

Copyright

Copyright (c) 2009 GeoCerts Inc.. See LICENSE for details.