Module: AxHub

Defined in:
lib/axhub_sdk.rb,
lib/axhub_sdk/version.rb,
lib/axhub_sdk/operations.rb

Defined Under Namespace

Classes: AppsClient, Client, Error, ErrorInfo, OperationClient

Constant Summary collapse

DEFAULT_BASE_URL =
'https://api.axhub.ai'
ROUTES =
[
  { 'method' => "GET", 'path' => "/.well-known/jwks.json", 'tag' => "Auth", 'operationId' => "authGetWellKnownJwksJson" },
  { 'method' => "GET", 'path' => "/.well-known/oauth-authorization-server", 'tag' => "Auth", 'operationId' => "authGetWellKnownOauthAuthorizationServer" },
  { 'method' => "GET", 'path' => "/.well-known/openid-configuration", 'tag' => "Auth", 'operationId' => "authGetWellKnownOpenidConfiguration" },
  { 'method' => "DELETE", 'path' => "/api/v1/apps/{appID}", 'tag' => "Apps", 'operationId' => "appsDeleteApiV1AppsByAppID" },
  { 'method' => "GET", 'path' => "/api/v1/apps/{appID}", 'tag' => "Apps", 'operationId' => "appsGetApiV1AppsByAppID" },
  { 'method' => "PATCH", 'path' => "/api/v1/apps/{appID}", 'tag' => "Apps", 'operationId' => "appsPatchApiV1AppsByAppID" },
  { 'method' => "DELETE", 'path' => "/api/v1/apps/{appID}/access", 'tag' => "Apps", 'operationId' => "appsDeleteApiV1AppsByAppIDAccess" },
  { 'method' => "POST", 'path' => "/api/v1/apps/{appID}/access", 'tag' => "Apps", 'operationId' => "appsPostApiV1AppsByAppIDAccess" },
  { 'method' => "GET", 'path' => "/api/v1/apps/{appID}/access/me", 'tag' => "Apps", 'operationId' => "appsGetApiV1AppsByAppIDAccessMe" },
  { 'method' => "POST", 'path' => "/api/v1/apps/{appID}/archive", 'tag' => "Apps", 'operationId' => "appsPostApiV1AppsByAppIDArchive" },
  { 'method' => "GET", 'path' => "/api/v1/apps/{appID}/comments", 'tag' => "Apps", 'operationId' => "appsGetApiV1AppsByAppIDComments" },
  { 'method' => "POST", 'path' => "/api/v1/apps/{appID}/comments", 'tag' => "Apps", 'operationId' => "appsPostApiV1AppsByAppIDComments" },
  { 'method' => "GET", 'path' => "/api/v1/apps/{appID}/db/tables", 'tag' => "Schema", 'operationId' => "schemaGetApiV1AppsByAppIDDbTables" },
  { 'method' => "GET", 'path' => "/api/v1/apps/{appID}/db/tables/{table}/rows", 'tag' => "Schema", 'operationId' => "schemaGetApiV1AppsByAppIDDbTablesByTableRows" },
  { 'method' => "GET", 'path' => "/api/v1/apps/{appID}/deployments", 'tag' => "Deploy", 'operationId' => "deployGetApiV1AppsByAppIDDeployments" },
  { 'method' => "POST", 'path' => "/api/v1/apps/{appID}/deployments", 'tag' => "Deploy", 'operationId' => "deployPostApiV1AppsByAppIDDeployments" },
  { 'method' => "GET", 'path' => "/api/v1/apps/{appID}/deployments/{did}", 'tag' => "Deploy", 'operationId' => "deployGetApiV1AppsByAppIDDeploymentsByDid" },
  { 'method' => "POST", 'path' => "/api/v1/apps/{appID}/deployments/{did}/cancel", 'tag' => "Deploy", 'operationId' => "deployPostApiV1AppsByAppIDDeploymentsByDidCancel" },
  { 'method' => "POST", 'path' => "/api/v1/apps/{appID}/deployments/{did}/rollback", 'tag' => "Deploy", 'operationId' => "deployPostApiV1AppsByAppIDDeploymentsByDidRollback" },
  { 'method' => "GET", 'path' => "/api/v1/apps/{appID}/diagnosis", 'tag' => "Deploy", 'operationId' => "deployGetApiV1AppsByAppIDDiagnosis" },
  { 'method' => "GET", 'path' => "/api/v1/apps/{appID}/env-vars", 'tag' => "Apps", 'operationId' => "appsGetApiV1AppsByAppIDEnvVars" },
  { 'method' => "POST", 'path' => "/api/v1/apps/{appID}/env-vars", 'tag' => "Apps", 'operationId' => "appsPostApiV1AppsByAppIDEnvVars" },
  { 'method' => "PUT", 'path' => "/api/v1/apps/{appID}/env-vars/{key}/staging-value", 'tag' => "Apps", 'operationId' => "appsPutApiV1AppsByAppIDEnvVarsByKeyStagingValue" },
  { 'method' => "DELETE", 'path' => "/api/v1/apps/{appID}/git-connection", 'tag' => "Deploy", 'operationId' => "deployDeleteApiV1AppsByAppIDGitConnection" },
  { 'method' => "GET", 'path' => "/api/v1/apps/{appID}/git-connection", 'tag' => "Deploy", 'operationId' => "deployGetApiV1AppsByAppIDGitConnection" },
  { 'method' => "PATCH", 'path' => "/api/v1/apps/{appID}/git-connection", 'tag' => "Deploy", 'operationId' => "deployPatchApiV1AppsByAppIDGitConnection" },
  { 'method' => "POST", 'path' => "/api/v1/apps/{appID}/git-connection", 'tag' => "Deploy", 'operationId' => "deployPostApiV1AppsByAppIDGitConnection" },
  { 'method' => "POST", 'path' => "/api/v1/apps/{appID}/git/github/connect", 'tag' => "Deploy", 'operationId' => "deployPostApiV1AppsByAppIDGitGithubConnect" },
  { 'method' => "GET", 'path' => "/api/v1/apps/{appID}/git/github/install/start", 'tag' => "Deploy", 'operationId' => "deployGetApiV1AppsByAppIDGitGithubInstallStart" },
  { 'method' => "DELETE", 'path' => "/api/v1/apps/{appID}/likes", 'tag' => "Apps", 'operationId' => "appsDeleteApiV1AppsByAppIDLikes" },
  { 'method' => "POST", 'path' => "/api/v1/apps/{appID}/likes", 'tag' => "Apps", 'operationId' => "appsPostApiV1AppsByAppIDLikes" },
  { 'method' => "GET", 'path' => "/api/v1/apps/{appID}/likes/me", 'tag' => "Apps", 'operationId' => "appsGetApiV1AppsByAppIDLikesMe" },
  { 'method' => "GET", 'path' => "/api/v1/apps/{appID}/logs", 'tag' => "Deploy", 'operationId' => "deployGetApiV1AppsByAppIDLogs" },
  { 'method' => "POST", 'path' => "/api/v1/apps/{appID}/oauth-clients", 'tag' => "Auth", 'operationId' => "authPostApiV1AppsByAppIDOauthClients" },
  { 'method' => "POST", 'path' => "/api/v1/apps/{appID}/promotions/{requestID}/retry", 'tag' => "Deploy", 'operationId' => "deployPostApiV1AppsByAppIDPromotionsByRequestIDRetry" },
  { 'method' => "DELETE", 'path' => "/api/v1/apps/{appID}/raw-db", 'tag' => "Apps", 'operationId' => "appsDeleteApiV1AppsByAppIDRawDb" },
  { 'method' => "POST", 'path' => "/api/v1/apps/{appID}/raw-db", 'tag' => "Apps", 'operationId' => "appsPostApiV1AppsByAppIDRawDb" },
  { 'method' => "GET", 'path' => "/api/v1/apps/{appID}/releases", 'tag' => "Deploy", 'operationId' => "deployGetApiV1AppsByAppIDReleases" },
  { 'method' => "GET", 'path' => "/api/v1/apps/{appID}/releases/promote-preflight", 'tag' => "Deploy", 'operationId' => "deployGetApiV1AppsByAppIDReleasesPromotePreflight" },
  { 'method' => "DELETE", 'path' => "/api/v1/apps/{appID}/staging", 'tag' => "Deploy", 'operationId' => "deployDeleteApiV1AppsByAppIDStaging" },
  { 'method' => "PUT", 'path' => "/api/v1/apps/{appID}/staging", 'tag' => "Deploy", 'operationId' => "deployPutApiV1AppsByAppIDStaging" },
  { 'method' => "GET", 'path' => "/api/v1/apps/discover", 'tag' => "Apps", 'operationId' => "appsGetApiV1AppsDiscover" },
  { 'method' => "GET", 'path' => "/api/v1/apps/search", 'tag' => "Apps", 'operationId' => "appsGetApiV1AppsSearch" },
  { 'method' => "DELETE", 'path' => "/api/v1/comments/{commentID}", 'tag' => "Apps", 'operationId' => "appsDeleteApiV1CommentsByCommentID" },
  { 'method' => "POST", 'path' => "/api/v1/git/github/complete", 'tag' => "Deploy", 'operationId' => "deployPostApiV1GitGithubComplete" },
  { 'method' => "GET", 'path' => "/api/v1/github/accounts", 'tag' => "deploy", 'operationId' => "deployGetApiV1GithubAccounts" },
  { 'method' => "GET", 'path' => "/api/v1/github/installations/{installationID}/repositories", 'tag' => "deploy", 'operationId' => "deployGetApiV1GithubInstallationsByInstallationIDRepositories" },
  { 'method' => "GET", 'path' => "/api/v1/me", 'tag' => "Auth", 'operationId' => "authGetApiV1Me" },
  { 'method' => "GET", 'path' => "/api/v1/me/apps/owned", 'tag' => "Apps", 'operationId' => "appsGetApiV1MeAppsOwned" },
  { 'method' => "GET", 'path' => "/api/v1/me/apps/received", 'tag' => "Apps", 'operationId' => "appsGetApiV1MeAppsReceived" },
  { 'method' => "GET", 'path' => "/api/v1/me/apps/workspace", 'tag' => "Apps", 'operationId' => "appsGetApiV1MeAppsWorkspace" },
  { 'method' => "GET", 'path' => "/api/v1/me/personal-access-tokens", 'tag' => "Schema", 'operationId' => "schemaGetApiV1MePersonalAccessTokens" },
  { 'method' => "POST", 'path' => "/api/v1/me/personal-access-tokens", 'tag' => "Schema", 'operationId' => "schemaPostApiV1MePersonalAccessTokens" },
  { 'method' => "DELETE", 'path' => "/api/v1/me/personal-access-tokens/{patID}", 'tag' => "Schema", 'operationId' => "schemaDeleteApiV1MePersonalAccessTokensByPatID" },
  { 'method' => "GET", 'path' => "/api/v1/oauth-clients/{clientID}", 'tag' => "Auth", 'operationId' => "authGetApiV1OauthClientsByClientID" },
  { 'method' => "DELETE", 'path' => "/api/v1/oauth/clients/{clientID}/grants/me", 'tag' => "Auth", 'operationId' => "authDeleteApiV1OauthClientsByClientIDGrantsMe" },
  { 'method' => "GET", 'path' => "/api/v1/templates", 'tag' => "Apps", 'operationId' => "appsGetApiV1Templates" },
  { 'method' => "GET", 'path' => "/api/v1/tenants", 'tag' => "Tenants", 'operationId' => "tenantsGetApiV1Tenants" },
  { 'method' => "GET", 'path' => "/api/v1/tenants/{tenantID}", 'tag' => "Tenants", 'operationId' => "tenantsGetApiV1TenantsByTenantID" },
  { 'method' => "POST", 'path' => "/api/v1/tenants/{tenantID}/app-bootstraps", 'tag' => "Deploy", 'operationId' => "deployPostApiV1TenantsByTenantIDAppBootstraps" },
  { 'method' => "GET", 'path' => "/api/v1/tenants/{tenantID}/app-bootstraps/{bootstrapID}", 'tag' => "Deploy", 'operationId' => "deployGetApiV1TenantsByTenantIDAppBootstrapsByBootstrapID" },
  { 'method' => "GET", 'path' => "/api/v1/tenants/{tenantID}/apps", 'tag' => "Apps", 'operationId' => "appsGetApiV1TenantsByTenantIDApps" },
  { 'method' => "POST", 'path' => "/api/v1/tenants/{tenantID}/apps", 'tag' => "Apps", 'operationId' => "appsPostApiV1TenantsByTenantIDApps" },
  { 'method' => "GET", 'path' => "/api/v1/tenants/{tenantID}/apps/check-availability", 'tag' => "Apps", 'operationId' => "appsGetApiV1TenantsByTenantIDAppsCheckAvailability" },
  { 'method' => "GET", 'path' => "/api/v1/tenants/{tenantID}/connectors", 'tag' => "Gateway", 'operationId' => "gatewayGetApiV1TenantsByTenantIDConnectors" },
  { 'method' => "GET", 'path' => "/api/v1/tenants/{tenantID}/connectors/{connectorID}", 'tag' => "Gateway", 'operationId' => "gatewayGetApiV1TenantsByTenantIDConnectorsByConnectorID" },
  { 'method' => "POST", 'path' => "/api/v1/tenants/{tenantID}/connectors/{connectorID}/discover", 'tag' => "Gateway", 'operationId' => "gatewayPostApiV1TenantsByTenantIDConnectorsByConnectorIDDiscover" },
  { 'method' => "GET", 'path' => "/api/v1/tenants/{tenantID}/connectors/{connectorID}/resources", 'tag' => "Gateway", 'operationId' => "gatewayGetApiV1TenantsByTenantIDConnectorsByConnectorIDResources" },
  { 'method' => "GET", 'path' => "/api/v1/tenants/{tenantID}/deployments", 'tag' => "Deploy", 'operationId' => "deployGetApiV1TenantsByTenantIDDeployments" },
  { 'method' => "GET", 'path' => "/api/v1/tenants/{tenantID}/discover/apps", 'tag' => "Apps", 'operationId' => "appsGetApiV1TenantsByTenantIDDiscoverApps" },
  { 'method' => "POST", 'path' => "/api/v1/tenants/{tenantID}/gateway/document-invoke", 'tag' => "Gateway", 'operationId' => "gatewayPostApiV1TenantsByTenantIDGatewayDocumentInvoke" },
  { 'method' => "POST", 'path' => "/api/v1/tenants/{tenantID}/gateway/file-invoke", 'tag' => "Gateway", 'operationId' => "gatewayPostApiV1TenantsByTenantIDGatewayFileInvoke" },
  { 'method' => "POST", 'path' => "/api/v1/tenants/{tenantID}/gateway/invoke", 'tag' => "Gateway", 'operationId' => "gatewayPostApiV1TenantsByTenantIDGatewayInvoke" },
  { 'method' => "POST", 'path' => "/api/v1/tenants/{tenantID}/gateway/query", 'tag' => "Gateway", 'operationId' => "gatewayPostApiV1TenantsByTenantIDGatewayQuery" },
  { 'method' => "POST", 'path' => "/api/v1/tenants/{tenantID}/gateway/sessions", 'tag' => "Gateway", 'operationId' => "gatewayPostApiV1TenantsByTenantIDGatewaySessions" },
  { 'method' => "DELETE", 'path' => "/api/v1/tenants/{tenantID}/gateway/sessions/{sessionID}", 'tag' => "Gateway", 'operationId' => "gatewayDeleteApiV1TenantsByTenantIDGatewaySessionsBySessionID" },
  { 'method' => "GET", 'path' => "/api/v1/tenants/{tenantID}/me/connectors", 'tag' => "Gateway", 'operationId' => "gatewayGetApiV1TenantsByTenantIDMeConnectors" },
  { 'method' => "GET", 'path' => "/api/v1/tenants/{tenantID}/me/connectors/{connectorID}/resources", 'tag' => "Gateway", 'operationId' => "gatewayGetApiV1TenantsByTenantIDMeConnectorsByConnectorIDResources" },
  { 'method' => "GET", 'path' => "/api/v1/tenants/{tenantID}/me/grants", 'tag' => "Authorization", 'operationId' => "authorizationGetApiV1TenantsByTenantIDMeGrants" },
  { 'method' => "GET", 'path' => "/api/v1/tenants/{tenantID}/members/directory", 'tag' => "Tenants", 'operationId' => "tenantsGetApiV1TenantsByTenantIDMembersDirectory" },
  { 'method' => "GET", 'path' => "/api/v1/tenants/{tenantID}/org-directory", 'tag' => "Tenants", 'operationId' => "tenantsGetApiV1TenantsByTenantIDOrgDirectory" },
  { 'method' => "GET", 'path' => "/api/v1/users/me/apps", 'tag' => "Apps", 'operationId' => "appsGetApiV1UsersMeApps" },
  { 'method' => "POST", 'path' => "/auth/logout", 'tag' => "Auth", 'operationId' => "authPostAuthLogout" },
  { 'method' => "POST", 'path' => "/auth/refresh", 'tag' => "Auth", 'operationId' => "authPostAuthRefresh" },
  { 'method' => "GET", 'path' => "/config/public", 'tag' => "Config", 'operationId' => "configGetConfigPublic" },
  { 'method' => "GET", 'path' => "/oauth/google/callback", 'tag' => "Gateway", 'operationId' => "gatewayGetOauthGoogleCallback" },
  { 'method' => "GET", 'path' => "/oauth/userinfo", 'tag' => "Auth", 'operationId' => "authGetOauthUserinfo" },
].freeze
ERROR_CODES =
{
  "action_denied" => ErrorInfo.new("permission_denied", 403, false),
  "action_invalid" => ErrorInfo.new("validation", 400, false),
  "already_accessed" => ErrorInfo.new("conflict", 409, false),
  "already_active" => ErrorInfo.new("conflict", 409, false),
  "already_deleted" => ErrorInfo.new("conflict", 409, false),
  "already_exists" => ErrorInfo.new("conflict", 409, false),
  "already_inactive" => ErrorInfo.new("conflict", 409, false),
  "already_member" => ErrorInfo.new("conflict", 409, false),
  "already_promoted" => ErrorInfo.new("conflict", 409, false),
  "already_revoked" => ErrorInfo.new("conflict", 409, false),
  "already_settled" => ErrorInfo.new("conflict", 409, false),
  "already_suspended" => ErrorInfo.new("conflict", 409, false),
  "already_terminal" => ErrorInfo.new("conflict", 409, false),
  "app_archived" => ErrorInfo.new("precondition_failed", 412, false),
  "app_unavailable" => ErrorInfo.new("conflict", 409, false),
  "auth_expired" => ErrorInfo.new("unavailable", 503, false),
  "bad_request" => ErrorInfo.new("validation", 400, false),
  "build_env_no_override" => ErrorInfo.new("validation", 400, false),
  "cannot_reactivate" => ErrorInfo.new("conflict", 409, false),
  "charge_failed" => ErrorInfo.new("CategoryPaymentRequired", 402, false),
  "confirm_required" => ErrorInfo.new("precondition_failed", 412, false),
  "conflict" => ErrorInfo.new("conflict", 409, false),
  "connector_inactive" => ErrorInfo.new("permission_denied", 403, false),
  "cross_tenant" => ErrorInfo.new("validation", 400, false),
  "domain_blocked" => ErrorInfo.new("precondition_failed", 422, false),
  "domain_taken" => ErrorInfo.new("conflict", 409, false),
  "duplicate" => ErrorInfo.new("validation", 400, false),
  "empty" => ErrorInfo.new("validation", 400, false),
  "exceeds_max" => ErrorInfo.new("conflict", 409, false),
  "expiry_in_past" => ErrorInfo.new("validation", 400, false),
  "feature_not_in_plan" => ErrorInfo.new("permission_denied", 403, false),
  "final_visibility_too_wide" => ErrorInfo.new("validation", 400, false),
  "forbidden" => ErrorInfo.new("permission_denied", 403, false),
  "git_connection_required" => ErrorInfo.new("precondition_failed", 412, false),
  "github_device_flow_disabled" => ErrorInfo.new("unavailable", 503, false),
  "grant_already_terminal" => ErrorInfo.new("conflict", 409, false),
  "grant_conflict" => ErrorInfo.new("conflict", 409, false),
  "grant_expired" => ErrorInfo.new("permission_denied", 403, false),
  "grant_revoked" => ErrorInfo.new("permission_denied", 403, false),
  "internal_error" => ErrorInfo.new("internal", 500, false),
  "invalid_drive" => ErrorInfo.new("validation", 400, false),
  "invalid_entitlement" => ErrorInfo.new("validation", 400, false),
  "invalid_expiry" => ErrorInfo.new("validation", 400, false),
  "invalid_format" => ErrorInfo.new("validation", 400, false),
  "invalid_oauth_state" => ErrorInfo.new("validation", 400, false),
  "invalid_period" => ErrorInfo.new("validation", 400, false),
  "invalid_seat_count" => ErrorInfo.new("validation", 400, false),
  "invalid_state_transition" => ErrorInfo.new("conflict", 409, false),
  "invalid_target" => ErrorInfo.new("conflict", 409, false),
  "invalid_value" => ErrorInfo.new("validation", 400, false),
  "invitation_expired" => ErrorInfo.new("not_found", 410, false),
  "kind_engine_mismatch" => ErrorInfo.new("validation", 400, false),
  "last_admin" => ErrorInfo.new("conflict", 409, false),
  "link_invalid" => ErrorInfo.new("not_found", 404, false),
  "no_active_grant" => ErrorInfo.new("not_found", 404, false),
  "no_available_seat" => ErrorInfo.new("conflict", 409, false),
  "no_billing_key" => ErrorInfo.new("CategoryPaymentRequired", 402, false),
  "no_payment_method" => ErrorInfo.new("CategoryPaymentRequired", 402, false),
  "not_admin" => ErrorInfo.new("permission_denied", 403, false),
  "not_allowed" => ErrorInfo.new("validation", 400, false),
  "not_deleted" => ErrorInfo.new("conflict", 409, false),
  "not_deployed" => ErrorInfo.new("conflict", 409, false),
  "not_found" => ErrorInfo.new("not_found", 404, false),
  "not_member" => ErrorInfo.new("permission_denied", 403, false),
  "not_promotable" => ErrorInfo.new("precondition_failed", 412, false),
  "not_suspended" => ErrorInfo.new("conflict", 409, false),
  "oauth_denied" => ErrorInfo.new("validation", 400, false),
  "payment_failed" => ErrorInfo.new("CategoryPaymentRequired", 402, false),
  "payment_required" => ErrorInfo.new("CategoryPaymentRequired", 402, false),
  "pending_exists" => ErrorInfo.new("conflict", 409, false),
  "pending_review_exists" => ErrorInfo.new("precondition_failed", 412, false),
  "permanently_deleted" => ErrorInfo.new("not_found", 410, false),
  "plan_version_exists" => ErrorInfo.new("conflict", 409, false),
  "precondition_failed" => ErrorInfo.new("precondition_failed", 412, false),
  "preset_in_use" => ErrorInfo.new("conflict", 409, false),
  "preset_mismatch" => ErrorInfo.new("validation", 400, false),
  "preset_not_in_plan" => ErrorInfo.new("CategoryPaymentRequired", 402, false),
  "prod_deploy_required" => ErrorInfo.new("precondition_failed", 412, false),
  "promote_in_progress" => ErrorInfo.new("precondition_failed", 412, true),
  "quota_exceeded" => ErrorInfo.new("CategoryPaymentRequired", 402, false),
  "required" => ErrorInfo.new("validation", 400, false),
  "resource_quota_exceeded" => ErrorInfo.new("CategoryPaymentRequired", 402, false),
  "schema_name_taken" => ErrorInfo.new("conflict", 409, false),
  "seat_in_use" => ErrorInfo.new("conflict", 409, false),
  "seat_unassigned" => ErrorInfo.new("CategoryPaymentRequired", 402, false),
  "seats_not_supported" => ErrorInfo.new("conflict", 409, false),
  "session_ended" => ErrorInfo.new("unauthenticated", 401, true),
  "session_expired" => ErrorInfo.new("unauthenticated", 401, true),
  "slug_taken" => ErrorInfo.new("conflict", 409, false),
  "staging_already_enabled" => ErrorInfo.new("conflict", 409, false),
  "staging_mismatch" => ErrorInfo.new("precondition_failed", 412, false),
  "staging_not_enabled" => ErrorInfo.new("precondition_failed", 412, false),
  "staging_required" => ErrorInfo.new("precondition_failed", 412, false),
  "static_release_in_use" => ErrorInfo.new("conflict", 409, false),
  "static_release_not_ready" => ErrorInfo.new("precondition_failed", 412, false),
  "subdomain_not_configured" => ErrorInfo.new("precondition_failed", 412, false),
  "temporarily_unavailable" => ErrorInfo.new("unavailable", 429, true),
  "token_expired" => ErrorInfo.new("unauthenticated", 401, true),
  "token_invalid" => ErrorInfo.new("unauthenticated", 401, true),
  "token_missing" => ErrorInfo.new("unauthenticated", 401, true),
  "too_long" => ErrorInfo.new("validation", 400, false),
  "unknown_plan" => ErrorInfo.new("not_found", 404, false),
  "unpaid_balance" => ErrorInfo.new("CategoryPaymentRequired", 402, false),
  "unsupported_for_static_app" => ErrorInfo.new("conflict", 409, false),
  "version_not_approved" => ErrorInfo.new("permission_denied", 403, false),
  "visibility_widen_not_allowed" => ErrorInfo.new("conflict", 409, false),
}.freeze
ROUTE_BY_OP =
ROUTES.map { |r| [r['operationId'], r] }.to_h
CONTEXT_ROUTES =
%w[apps identity tenants authz audit gateway data deployments].map { |name| [name, ROUTES.select { |route| context_name(route) == name }] }.to_h
VERSION =
'0.11.0'
OPERATION_METHODS =
ROUTES.map do |route|
  { 'operationId' => route['operationId'], 'context' => context_name(route), 'snake' => operation_method_name(route['operationId']) }
end

Class Method Summary collapse

Class Method Details

.camel(key) ⇒ Object



218
219
220
# File 'lib/axhub_sdk.rb', line 218

def self.camel(key)
  parts = key.to_s.split('_'); parts.first + parts.drop(1).map { |p| p[0].upcase + p[1..-1].to_s }.join
end

.camelize(value) ⇒ Object



221
222
223
224
225
226
227
# File 'lib/axhub_sdk.rb', line 221

def self.camelize(value)
  case value
  when Hash then value.map { |k, v| [camel(k), camelize(v)] }.to_h
  when Array then value.map { |v| camelize(v) }
  else value
  end
end

.context_name(route) ⇒ Object

Raises:

  • (ArgumentError)


298
299
300
301
302
303
304
305
306
307
308
309
# File 'lib/axhub_sdk.rb', line 298

def self.context_name(route)
  tag = route['tag']
  return 'apps' if tag == 'Apps'
  return 'identity' if ['Auth', 'identity'].include?(tag)
  return 'tenants' if tag == 'Tenants'
  return 'authz' if tag == 'Authorization'
  return 'audit' if tag == 'Audit'
  return 'gateway' if ['Gateway', 'Config'].include?(tag)
  return 'data' if tag == 'Schema'
  return 'deployments' if ['Deploy', 'deploy'].include?(tag)
  raise ArgumentError, "unmapped route tag: #{tag}"
end

.install_operation_methodsObject



33
34
35
36
37
38
39
40
# File 'lib/axhub_sdk/operations.rb', line 33

def self.install_operation_methods
  OPERATION_METHODS.each do |item|
    target = item['context'] == 'apps' ? AppsClient : OperationClient
    target.define_method(item['snake']) do |path_params: {}, query: {}, body: nil|
      @client.request(item['operationId'], path_params: path_params, query: query, body: body)
    end
  end
end

.operation_method_name(operation_id) ⇒ Object



4
5
6
# File 'lib/axhub_sdk/operations.rb', line 4

def self.operation_method_name(operation_id)
  operation_id.gsub(/(.)([A-Z][a-z]+)/, '\\1_\\2').gsub(/([a-z0-9])([A-Z])/, '\\1_\\2').downcase
end