Class: Jsapi::Meta::OAuthFlow

Inherits:
Model::Base 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 Model::Attributes

Model::Attributes::DEFAULT_ARRAY, Model::Attributes::DEFAULT_HASH

Instance Method Summary collapse

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

included

Methods inherited from Model::Base

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

Methods included from Model::Attributes

#attribute, #attribute_names

Constructor Details

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

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

#device_authorization_urlObject

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

Note that the device authorization URL was introduced with OpenAPI 3.2. It is omitted when generating an OpenAPI document with a lower version.



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

attribute :device_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 omitted when generating an OpenAPI document with a lower version.



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

attribute :refresh_url, String

#scopesObject

:attr: scopes The hash containing the scopes.



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

attribute :scopes, { String => Scope }

#to_openapi(version) ⇒ Object

Returns a hash representing the OpenAPI OAuth flow object.



48
49
50
51
52
53
54
55
56
57
58
# File 'lib/jsapi/meta/oauth_flow.rb', line 48

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

  with_openapi_extensions(
    authorizationUrl: authorization_url,
    deviceAuthorizationUrl: (device_authorization_url if version >= OpenAPI::V3_2),
    tokenUrl: token_url,
    refreshUrl: (refresh_url if version >= OpenAPI::V3_0),
    scopes: scopes.transform_values(&:description)
  )
end

#token_urlObject

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



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

attribute :token_url, String