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, AccountFeature, Addon, AddonAction, AddonAttachment, AddonConfig, AddonPlanAction, AddonRegionCapability, AddonService, App, AppFeature, AppFormationSet, AppSetup, AppTransfer, Build, BuildResult, BuildpackInstallation, Client, Collaborator, ConfigVar, Credit, Domain, Dyno, DynoSize, Event, FailedEvent, FilterApps, Formation, IdentityProvider, InboundRuleset, Invitation, Invoice, InvoiceAddress, Key, LogDrain, LogSession, OauthAuthorization, OauthClient, OauthGrant, OauthToken, Organization, OrganizationAddon, OrganizationApp, OrganizationAppCollaborator, OrganizationAppPermission, OrganizationFeature, OrganizationInvitation, OrganizationInvoice, OrganizationMember, OrganizationPreferences, OutboundRuleset, PasswordReset, Pipeline, PipelineCoupling, PipelinePromotion, PipelinePromotionTarget, Plan, RateLimit, Region, Release, SSLEndpoint, Slug, SmsNumber, SniEndpoint, Source, Space, SpaceAppAccess, SpaceNat, Stack, UserPreferences, WhitelistedAddonService
Constant Summary collapse
- VERSION =
'1.0.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.
Class Method Details
.connect(api_key, options = nil) ⇒ Client
Get a Client configured to use HTTP Basic or header-based authentication.
22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 |
# File 'lib/platform-api/client.rb', line 22 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.
47 48 49 50 51 52 |
# File 'lib/platform-api/client.rb', line 47 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.
62 63 64 65 66 67 |
# File 'lib/platform-api/client.rb', line 62 def self.connect_token(token, =nil) = () url = [:url] client = Heroics.token_client_from_schema(token, SCHEMA, url, ) Client.new(client) end |