Sha256: f993ffb535cb515bf2a6d6d00fd99a4283986494c12c81b164b0cd3580dcd855

Contents?: true

Size: 1.06 KB

Versions: 12

Compression:

Stored size: 1.06 KB

Contents

require 'relax'
require 'cgi'

##
# To properly configure the GeoCerts library, you must provide your partner ID and api token:
# 
#   GeoCerts.partner_id = 'ex4Mpl3'
#   GeoCerts.api_token  = 'abc123DEF456gHi...'
# 
# After that, most interaction is performed through other objects within the library, such
# as GeoCerts::Order, GeoCerts::Certificate, GeoCerts::CSR, etc.
# 
module GeoCerts
  
  def self.api_token
    @api_token
  end
  
  def self.api_token=(token)
    @api_token = token
  end
  
  def self.partner_id
    @partner_id
  end
  
  def self.partner_id=(partner_id)
    @partner_id = partner_id
  end
  
  def self.api # :nodoc:
    @api = API.new({
      :version      => 1,
      :host         => host
    }, {
      :credentials  => [partner_id, api_token]
    })
  end
  
  def self.escape(value) # :nodoc:
    value ? CGI.escape(value.to_s) : nil
  end
  
  def self.sandbox=(value)
    @sandbox = value
  end
  
  def self.sandbox?
    @sandbox
  end
  
  def self.host
    sandbox? ? 'sandbox.geocerts.com' : 'www.geocerts.com'
  end
  
end

require 'geo_certs/api'

Version data entries

12 entries across 12 versions & 1 rubygems

Version Path
geocerts-0.0.23 lib/geo_certs.rb
geocerts-0.0.22 lib/geo_certs.rb
geocerts-0.0.21 lib/geo_certs.rb
geocerts-0.0.20 lib/geo_certs.rb
geocerts-0.0.19 lib/geo_certs.rb
geocerts-0.0.18 lib/geo_certs.rb
geocerts-0.0.17 lib/geo_certs.rb
geocerts-0.0.16 lib/geo_certs.rb
geocerts-0.0.15 lib/geo_certs.rb
geocerts-0.0.14 lib/geo_certs.rb
geocerts-0.0.13 lib/geo_certs.rb
geocerts-0.0.12 lib/geo_certs.rb