Module: Boldsign
- Defined in:
- lib/boldsign.rb,
lib/boldsign/error.rb,
lib/boldsign/client.rb,
lib/boldsign/version.rb,
lib/boldsign/resource.rb,
lib/boldsign/access_token.rb,
lib/boldsign/case_convert.rb,
lib/boldsign/resources/plan.rb,
lib/boldsign/resources/team.rb,
lib/boldsign/resources/user.rb,
lib/boldsign/resources/brand.rb,
lib/boldsign/resources/contact.rb,
lib/boldsign/resources/document.rb,
lib/boldsign/resources/template.rb,
lib/boldsign/resources/custom_field.rb,
lib/boldsign/resources/contact_group.rb,
lib/boldsign/resources/sender_identity.rb,
lib/boldsign/resources/identity_verification.rb
Overview
Top-level namespace for the BoldSign Ruby client.
Configure once at boot and access a shared Client via Boldsign.client, or instantiate Client directly when you need multiple credentials/regions.
Defined Under Namespace
Modules: CaseConvert, Resources Classes: AccessToken, AuthenticationError, BadRequestError, Client, ConfigurationError, Error, ForbiddenError, NotFoundError, RateLimitError, Resource, ServerError, UnprocessableEntityError
Constant Summary collapse
- REGIONS =
Region → base URL map for BoldSign’s regional API hosts.
{ us: "https://api.boldsign.com", eu: "https://api-eu.boldsign.com", ca: "https://api-ca.boldsign.com", au: "https://api-au.boldsign.com" }.freeze
- TOKEN_REGIONS =
Region → account host map for the OAuth token endpoint. Non-US hosts follow BoldSign’s regional naming; override with ‘token_url:` if a region differs.
{ us: "https://account.boldsign.com", eu: "https://account-eu.boldsign.com", ca: "https://account-ca.boldsign.com", au: "https://account-au.boldsign.com" }.freeze
- DEFAULT_TOKEN_BASE_URL =
Default account host (US) for the OAuth token endpoint.
"https://account.boldsign.com".freeze
- ERROR_MAP =
Maps HTTP status codes to Error subclasses.
{ 400 => BadRequestError, 401 => AuthenticationError, 403 => ForbiddenError, 404 => NotFoundError, 422 => UnprocessableEntityError, 429 => RateLimitError }.freeze
- VERSION =
"0.5.0"
Class Attribute Summary collapse
-
.access_token ⇒ String?
Pre-obtained OAuth bearer token (used as-is, not refreshed).
-
.api_key ⇒ String?
API key used by the shared Boldsign.client.
-
.base_url ⇒ String?
Optional explicit base URL override (takes precedence over Boldsign.region).
-
.client_id ⇒ String?
OAuth app client ID used by the shared Boldsign.client.
-
.client_secret ⇒ String?
OAuth app client secret used by the shared Boldsign.client.
-
.region ⇒ Symbol?
Region key (‘:us`, `:eu`, `:ca`, `:au`).
-
.scope ⇒ String?
OAuth scope to request (defaults to AccessToken::DEFAULT_SCOPE).
-
.token_url ⇒ String?
Override for the full OAuth token endpoint URL.
Class Method Summary collapse
-
.client ⇒ Client
Memoized shared client built from module-level config.
-
.configure {|config| ... } ⇒ void
Yields self for block-style configuration.
-
.reset! ⇒ void
Clears the memoized shared client so the next call to Boldsign.client rebuilds it.
Class Attribute Details
.access_token ⇒ String?
Returns Pre-obtained OAuth bearer token (used as-is, not refreshed).
68 69 70 |
# File 'lib/boldsign.rb', line 68 def access_token @access_token end |
.api_key ⇒ String?
Returns API key used by the shared client.
59 60 61 |
# File 'lib/boldsign.rb', line 59 def api_key @api_key end |
.base_url ⇒ String?
Returns Optional explicit base URL override (takes precedence over region).
80 81 82 |
# File 'lib/boldsign.rb', line 80 def base_url @base_url end |
.client_id ⇒ String?
Returns OAuth app client ID used by the shared client.
62 63 64 |
# File 'lib/boldsign.rb', line 62 def client_id @client_id end |
.client_secret ⇒ String?
Returns OAuth app client secret used by the shared client.
65 66 67 |
# File 'lib/boldsign.rb', line 65 def client_secret @client_secret end |
.region ⇒ Symbol?
Returns Region key (‘:us`, `:eu`, `:ca`, `:au`).
77 78 79 |
# File 'lib/boldsign.rb', line 77 def region @region end |
.scope ⇒ String?
Returns OAuth scope to request (defaults to Boldsign::AccessToken::DEFAULT_SCOPE).
71 72 73 |
# File 'lib/boldsign.rb', line 71 def scope @scope end |
.token_url ⇒ String?
Returns Override for the full OAuth token endpoint URL.
74 75 76 |
# File 'lib/boldsign.rb', line 74 def token_url @token_url end |
Class Method Details
.client ⇒ Client
Returns memoized shared client built from module-level config.
90 91 92 93 94 95 96 |
# File 'lib/boldsign.rb', line 90 def client @client ||= Client.new( api_key: api_key, client_id: client_id, client_secret: client_secret, access_token: access_token, scope: scope, token_url: token_url, region: region, base_url: base_url ) end |
.configure {|config| ... } ⇒ void
This method returns an undefined value.
Yields self for block-style configuration.
85 86 87 |
# File 'lib/boldsign.rb', line 85 def configure yield self end |
.reset! ⇒ void
This method returns an undefined value.
Clears the memoized shared client so the next call to client rebuilds it.
100 101 102 |
# File 'lib/boldsign.rb', line 100 def reset! @client = nil end |