Module: PlatformAPI
- Defined in:
- lib/platform-api.rb,
lib/platform-api/client.rb,
lib/platform-api/version.rb
Overview
Ruby HTTP client for the Heroku API.
Defined Under Namespace
Classes: Account, AccountDelinquency, AccountFeature, Addon, AddonAction, AddonAttachment, AddonConfig, AddonPlanAction, AddonRegionCapability, AddonService, AddonWebhook, AddonWebhookDelivery, AddonWebhookEvent, AllowedAddonService, App, AppFeature, AppSetup, AppTransfer, AppWebhook, AppWebhookDelivery, AppWebhookEvent, Archive, AuditTrailEvent, Build, BuildpackInstallation, Client, Collaborator, ConfigVar, Credit, Domain, Dyno, DynoSize, EnterpriseAccount, EnterpriseAccountDailyUsage, EnterpriseAccountMember, EnterpriseAccountMonthlyUsage, FilterApps, Formation, IdentityProvider, InboundRuleset, Invoice, InvoiceAddress, Key, LogDrain, LogSession, OauthAuthorization, OauthClient, OauthGrant, OauthToken, OutboundRuleset, PasswordReset, Peering, PeeringInfo, PermissionEntity, Pipeline, PipelineBuild, PipelineConfigVar, PipelineCoupling, PipelineDeployment, PipelinePromotion, PipelinePromotionTarget, PipelineRelease, PipelineStack, PipelineTransfer, Plan, RateLimit, Region, Release, ReviewApp, ReviewAppConfig, Slug, SmsNumber, SniEndpoint, Source, Space, SpaceAppAccess, SpaceNat, SpaceTopology, SpaceTransfer, Stack, Team, TeamAddon, TeamApp, TeamAppCollaborator, TeamAppPermission, TeamDailyUsage, TeamDelinquency, TeamFeature, TeamInvitation, TeamInvoice, TeamMember, TeamMonthlyUsage, TeamPreferences, TeamSpace, TestCase, TestNode, TestRun, UserPreferences, VpnConnection
Constant Summary collapse
- VERSION =
'3.7.0'
Class Method Summary collapse
-
.connect(api_key, options = nil) ⇒ Client
Get a Client configured to use HTTP Basic or header-based authentication.
-
.connect_oauth(oauth_token, options = nil) ⇒ Client
Get a Client configured to use OAuth authentication.
-
.connect_token(token, options = nil) ⇒ Client
Get a Client configured to use Token authentication.
-
.rate_throttle ⇒ Object
Get access to the rate throttling class object for configuration.
- .rate_throttle=(rate_throttle) ⇒ Object
Class Method Details
.connect(api_key, options = nil) ⇒ Client
Get a Client configured to use HTTP Basic or header-based authentication.
23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
# File 'lib/platform-api/client.rb', line 23 def self.connect(api_key, =nil) = () uri = URI.parse([:url]) if [:user] uri.user = URI.encode_www_form_component [:user] end if api_key uri.user ||= 'user' uri.password = api_key end client = Heroics.client_from_schema(SCHEMA, uri.to_s, ) Client.new(client) end |
.connect_oauth(oauth_token, options = nil) ⇒ Client
Get a Client configured to use OAuth authentication.
48 49 50 51 52 53 |
# File 'lib/platform-api/client.rb', line 48 def self.connect_oauth(oauth_token, =nil) = () url = [:url] client = Heroics.oauth_client_from_schema(oauth_token, SCHEMA, url, ) Client.new(client) end |
.connect_token(token, options = nil) ⇒ Client
Get a Client configured to use Token authentication.
63 64 65 66 67 68 |
# File 'lib/platform-api/client.rb', line 63 def self.connect_token(token, =nil) = () url = [:url] client = Heroics.token_client_from_schema(token, SCHEMA, url, ) Client.new(client) end |
.rate_throttle ⇒ Object
Get access to the rate throttling class object for configuration.
15 16 17 |
# File 'lib/platform-api.rb', line 15 def self.rate_throttle @rate_throttle end |
.rate_throttle=(rate_throttle) ⇒ Object
7 8 9 10 11 12 |
# File 'lib/platform-api.rb', line 7 def self.rate_throttle=(rate_throttle) @rate_throttle = rate_throttle Heroics.default_configuration do |config| config.rate_throttle = @rate_throttle end end |