Class: Jsapi::Meta::OAuthFlow

Inherits:
Base::Model show all
Includes:
Jsapi::Meta::OpenAPI::Extensions
Defined in:
lib/jsapi/meta/oauth_flow.rb

Overview

Represents an OAuth flow object.

Defined Under Namespace

Classes: Scope

Constant Summary

Constants included from Base::Attributes

Base::Attributes::DEFAULT_ARRAY, Base::Attributes::DEFAULT_HASH

Instance Method Summary collapse

Methods included from Jsapi::Meta::OpenAPI::Extensions

#add_openapi_extension, #openapi_extensions, #openapi_extensions=

Methods inherited from Base::Model

#initialize, #inspect, #merge!, #reference?, #resolve

Methods included from Base::Attributes

#attribute, #attribute_names

Constructor Details

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

Instance Method Details

#authorization_urlObject

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



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

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.



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

attribute :refresh_url, String

#scopesObject

:attr: scopes The hash containing the scopes.



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

attribute :scopes, { String => Scope }

#to_openapi(version) ⇒ Object

Returns a hash representing the OpenAPI OAuth flow object.



40
41
42
43
44
45
46
47
48
49
# File 'lib/jsapi/meta/oauth_flow.rb', line 40

def to_openapi(version, *)
  version = OpenAPI::Version.from(version)

  with_openapi_extensions(
    authorizationUrl: authorization_url,
    tokenUrl: token_url,
    refreshUrl: (refresh_url if version.major > 2),
    scopes: scopes.transform_values(&:description)
  )
end

#token_urlObject

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



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

attribute :token_url, String