Class: SwaggerPetstoreOpenApi30::PetstoreAuthCredentials
- Inherits:
-
Object
- Object
- SwaggerPetstoreOpenApi30::PetstoreAuthCredentials
- Defined in:
- lib/swagger_petstore_open_api30/http/auth/petstore_auth.rb
Overview
Data class for PetstoreAuthCredentials.
Instance Attribute Summary collapse
-
#oauth_client_id ⇒ Object
readonly
Returns the value of attribute oauth_client_id.
-
#oauth_redirect_uri ⇒ Object
readonly
Returns the value of attribute oauth_redirect_uri.
-
#oauth_scopes ⇒ Object
readonly
Returns the value of attribute oauth_scopes.
-
#oauth_token ⇒ Object
readonly
Returns the value of attribute oauth_token.
Class Method Summary collapse
Instance Method Summary collapse
- #clone_with(oauth_client_id: nil, oauth_redirect_uri: nil, oauth_token: nil, oauth_scopes: nil) ⇒ Object
-
#initialize(oauth_client_id:, oauth_redirect_uri:, oauth_token: nil, oauth_scopes: nil) ⇒ PetstoreAuthCredentials
constructor
A new instance of PetstoreAuthCredentials.
Constructor Details
#initialize(oauth_client_id:, oauth_redirect_uri:, oauth_token: nil, oauth_scopes: nil) ⇒ PetstoreAuthCredentials
Returns a new instance of PetstoreAuthCredentials.
74 75 76 77 78 79 80 81 82 83 |
# File 'lib/swagger_petstore_open_api30/http/auth/petstore_auth.rb', line 74 def initialize(oauth_client_id:, oauth_redirect_uri:, oauth_token: nil, oauth_scopes: nil) raise ArgumentError, 'oauth_client_id cannot be nil' if oauth_client_id.nil? raise ArgumentError, 'oauth_redirect_uri cannot be nil' if oauth_redirect_uri.nil? @oauth_client_id = oauth_client_id @oauth_redirect_uri = oauth_redirect_uri @oauth_token = oauth_token @oauth_scopes = oauth_scopes end |
Instance Attribute Details
#oauth_client_id ⇒ Object (readonly)
Returns the value of attribute oauth_client_id.
71 72 73 |
# File 'lib/swagger_petstore_open_api30/http/auth/petstore_auth.rb', line 71 def oauth_client_id @oauth_client_id end |
#oauth_redirect_uri ⇒ Object (readonly)
Returns the value of attribute oauth_redirect_uri.
71 72 73 |
# File 'lib/swagger_petstore_open_api30/http/auth/petstore_auth.rb', line 71 def oauth_redirect_uri @oauth_redirect_uri end |
#oauth_scopes ⇒ Object (readonly)
Returns the value of attribute oauth_scopes.
71 72 73 |
# File 'lib/swagger_petstore_open_api30/http/auth/petstore_auth.rb', line 71 def oauth_scopes @oauth_scopes end |
#oauth_token ⇒ Object (readonly)
Returns the value of attribute oauth_token.
71 72 73 |
# File 'lib/swagger_petstore_open_api30/http/auth/petstore_auth.rb', line 71 def oauth_token @oauth_token end |
Class Method Details
.from_env ⇒ Object
85 86 87 88 89 90 91 92 93 94 95 96 97 |
# File 'lib/swagger_petstore_open_api30/http/auth/petstore_auth.rb', line 85 def self.from_env oauth_client_id = ENV['PETSTORE_AUTH_OAUTH_CLIENT_ID'] oauth_redirect_uri = ENV['PETSTORE_AUTH_OAUTH_REDIRECT_URI'] oauth_scopes = ENV['PETSTORE_AUTH_OAUTH_SCOPES'] all_nil = [ oauth_client_id, oauth_redirect_uri ].all?(&:nil?) return nil if all_nil new(oauth_client_id: oauth_client_id, oauth_redirect_uri: oauth_redirect_uri, oauth_scopes: oauth_scopes) end |
Instance Method Details
#clone_with(oauth_client_id: nil, oauth_redirect_uri: nil, oauth_token: nil, oauth_scopes: nil) ⇒ Object
99 100 101 102 103 104 105 106 107 108 109 110 |
# File 'lib/swagger_petstore_open_api30/http/auth/petstore_auth.rb', line 99 def clone_with(oauth_client_id: nil, oauth_redirect_uri: nil, oauth_token: nil, oauth_scopes: nil) oauth_client_id ||= self.oauth_client_id oauth_redirect_uri ||= self.oauth_redirect_uri oauth_token ||= self.oauth_token oauth_scopes ||= self.oauth_scopes PetstoreAuthCredentials.new(oauth_client_id: oauth_client_id, oauth_redirect_uri: oauth_redirect_uri, oauth_token: oauth_token, oauth_scopes: oauth_scopes) end |