Class: Jsapi::Meta::OpenAPI::OAuthFlow

Inherits:
Base
  • Object
show all
Defined in:
lib/jsapi/meta/openapi/oauth_flow.rb

Overview

Represents an OAuth flow object.

Defined Under Namespace

Classes: Scope

Instance Method Summary collapse

Methods inherited from Base

#initialize, #inspect, #reference?, #resolve

Methods included from Attributes::ClassMethods

#attribute, #attribute_names

Constructor Details

This class inherits a constructor from Jsapi::Meta::Base

Instance Method Details

#authorization_urlObject

:attr: authorization_url The authorization URL to be used for the flow.



18
# File 'lib/jsapi/meta/openapi/oauth_flow.rb', line 18

attribute :authorization_url, String

#refresh_urlObject

:attr: refresh_url The refresh URL to be used for the flow.

Note that the refresh URL was introduced with OpenAPI 3.0. It is skipped when generating an OpenAPI 2.0 document.



26
# File 'lib/jsapi/meta/openapi/oauth_flow.rb', line 26

attribute :refresh_url, String

#scopesObject

:attr: scopes The hash containing the scopes.



31
# File 'lib/jsapi/meta/openapi/oauth_flow.rb', line 31

attribute :scopes, { String => Scope }, default: {}

#to_openapi(version) ⇒ Object

Returns a hash representing the OAuth flow object.



39
40
41
42
43
44
45
46
# File 'lib/jsapi/meta/openapi/oauth_flow.rb', line 39

def to_openapi(version)
  {
    authorizationUrl: authorization_url,
    tokenUrl: token_url,
    refreshUrl: (refresh_url if version.major > 2),
    scopes: scopes.transform_values(&:description)
  }.compact
end

#token_urlObject

:attr: token_url The token URL to be used for the flow.



36
# File 'lib/jsapi/meta/openapi/oauth_flow.rb', line 36

attribute :token_url, String