Class: CldProvisioning::SDKHooks::UserAgentHook
- Inherits:
-
AbstractSDKHook
- Object
- AbstractSDKHook
- CldProvisioning::SDKHooks::UserAgentHook
- Extended by:
- T::Sig
- Defined in:
- lib/cld_provisioning/sdk_hooks/user_agent_hook.rb
Overview
Replaces the default Speakeasy user-agent with a Cloudinary-branded one.
Format: Cloudinary/AccountProvisioning Ruby/<sdkVersion> Gen/<genVersion> Schema/<schemaVersion> (<system info>)
Instance Method Summary collapse
Methods included from AbstractAfterErrorHook
Methods included from AbstractAfterSuccessHook
Methods included from AbstractBeforeRequestHook
Instance Method Details
#sdk_init(config:) ⇒ Object
15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
# File 'lib/cld_provisioning/sdk_hooks/user_agent_hook.rb', line 15 def sdk_init(config:) original = config.user_agent return config unless original.start_with?("speakeasy-sdk/") parts = original.split(" ", 5) return config if parts.length < 5 sdk_version = parts[1] gen_version = parts[2] schema_version = parts[3] ruby_version = RUBY_VERSION platform = RUBY_PLATFORM config.user_agent = "Cloudinary/AccountProvisioning Ruby/#{sdk_version} Gen/#{gen_version} Schema/#{schema_version} (Ruby #{ruby_version}; #{platform})" config end |