Class: GeneratorLabs::Client
- Inherits:
-
Object
- Object
- GeneratorLabs::Client
- Defined in:
- lib/generatorlabs/client.rb
Overview
Main API client for Generator Labs.
The Generator Labs API is a RESTful web service API that lets customers manage their RBL monitoring hosts, certificate monitoring, contacts, and retrieve listing information.
Instance Attribute Summary collapse
-
#account_sid ⇒ String
readonly
The account SID (2 uppercase + 32 hex characters).
-
#auth_token ⇒ String
readonly
The authentication token (64 hex characters).
-
#config ⇒ Config
readonly
The configuration object.
Instance Method Summary collapse
-
#cert ⇒ Cert
Get the Certificate monitoring API namespace.
-
#contact ⇒ Contact
Get the Contact management API namespace.
-
#initialize(account_sid, auth_token, config = nil) ⇒ Client
constructor
Initialize a new Generator Labs client.
-
#rbl ⇒ RBL
Get the RBL monitoring API namespace.
Constructor Details
#initialize(account_sid, auth_token, config = nil) ⇒ Client
Initialize a new Generator Labs client.
The account SID must be in the format of 2 uppercase letters followed by 32 hexadecimal characters (e.g., “AC” + 32 hex chars).
The auth token must be 64 hexadecimal characters.
66 67 68 69 70 71 72 73 74 75 76 77 |
# File 'lib/generatorlabs/client.rb', line 66 def initialize(account_sid, auth_token, config = nil) # Validate account SID format raise Error, "Invalid account SID format: #{account_sid}" unless account_sid.match?(/^[A-Z]{2}[0-9a-fA-F]{32}$/) # Validate auth token format raise Error, 'Invalid auth token format' unless auth_token.match?(/^[0-9a-fA-F]{64}$/) @account_sid = account_sid @auth_token = auth_token @config = config || Config.default @handler = RequestHandler.new(account_sid, auth_token, @config) end |
Instance Attribute Details
#account_sid ⇒ String (readonly)
Returns The account SID (2 uppercase + 32 hex characters).
40 41 42 |
# File 'lib/generatorlabs/client.rb', line 40 def account_sid @account_sid end |
#auth_token ⇒ String (readonly)
Returns The authentication token (64 hex characters).
43 44 45 |
# File 'lib/generatorlabs/client.rb', line 43 def auth_token @auth_token end |
#config ⇒ Config (readonly)
Returns The configuration object.
46 47 48 |
# File 'lib/generatorlabs/client.rb', line 46 def config @config end |
Instance Method Details
#cert ⇒ Cert
Get the Certificate monitoring API namespace.
The Cert namespace provides access to:
-
Monitors: Manage certificate monitors
-
Profiles: Manage certificate monitoring profiles
-
Errors: Retrieve current certificate errors
124 125 126 |
# File 'lib/generatorlabs/client.rb', line 124 def cert @cert ||= Cert.new(@handler) end |
#contact ⇒ Contact
Get the Contact management API namespace.
The Contact namespace provides access to:
-
Contacts: Manage individual contacts
-
Groups: Manage contact groups
108 109 110 |
# File 'lib/generatorlabs/client.rb', line 108 def contact @contact ||= Contact.new(@handler) end |
#rbl ⇒ RBL
Get the RBL monitoring API namespace.
The RBL namespace provides access to:
-
Hosts: Manage monitored hosts (IP addresses and domains)
-
Profiles: Manage monitoring profiles (which RBLs to check)
-
Sources: Manage RBL sources
-
Check: Perform ad-hoc RBL checks
-
Listings: Retrieve current RBL listings
93 94 95 |
# File 'lib/generatorlabs/client.rb', line 93 def rbl @rbl ||= RBL.new(@handler) end |