Class: RequestSandboxAuthorizationCode
- Inherits:
-
Object
- Object
- RequestSandboxAuthorizationCode
- Defined in:
- lib/orcid/spec_support.rb
Overview
This follows the instructions from: support.orcid.org/knowledgebase/articles/179969-methods-to-generate-an-access-token-for-testing#curl
Instance Attribute Summary collapse
-
#access_scope ⇒ Object
readonly
Returns the value of attribute access_scope.
-
#authorization_code ⇒ Object
readonly
Returns the value of attribute authorization_code.
-
#authorize_url ⇒ Object
readonly
Returns the value of attribute authorize_url.
-
#cookies ⇒ Object
writeonly
Sets the attribute cookies.
-
#login_url ⇒ Object
readonly
Returns the value of attribute login_url.
-
#oauth_redirect_uri ⇒ Object
readonly
Returns the value of attribute oauth_redirect_uri.
-
#orcid_client_id ⇒ Object
readonly
Returns the value of attribute orcid_client_id.
-
#orcid_client_secret ⇒ Object
readonly
Returns the value of attribute orcid_client_secret.
-
#orcid_profile_id ⇒ Object
readonly
Returns the value of attribute orcid_profile_id.
-
#password ⇒ Object
readonly
Returns the value of attribute password.
Class Method Summary collapse
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(options = {}) ⇒ RequestSandboxAuthorizationCode
constructor
A new instance of RequestSandboxAuthorizationCode.
Constructor Details
#initialize(options = {}) ⇒ RequestSandboxAuthorizationCode
Returns a new instance of RequestSandboxAuthorizationCode.
15 16 17 18 19 20 21 22 23 24 |
# File 'lib/orcid/spec_support.rb', line 15 def initialize( = {}) @orcid_client_id = .fetch(:orcid_client_id) { Orcid.provider.id } @orcid_client_secret = .fetch(:orcid_client_secret) { Orcid.provider.secret } @login_url = .fetch(:login_url) { Orcid.provider.signin_via_json_url } @authorize_url = .fetch(:authorize_url) { Orcid.provider. } @oauth_redirect_uri = .fetch(:oauth_redirect_uri) { 'https://developers.google.com/oauthplayground' } @access_scope = .fetch(:scope) { Orcid.provider.authentication_scope } @orcid_profile_id = .fetch(:orcid_profile_id) { ENV['ORCID_CLAIMED_PROFILE_ID'] } @password = .fetch(:password) { ENV['ORCID_CLAIMED_PROFILE_PASSWORD'] } end |
Instance Attribute Details
#access_scope ⇒ Object (readonly)
Returns the value of attribute access_scope.
11 12 13 |
# File 'lib/orcid/spec_support.rb', line 11 def access_scope @access_scope end |
#authorization_code ⇒ Object (readonly)
Returns the value of attribute authorization_code.
12 13 14 |
# File 'lib/orcid/spec_support.rb', line 12 def @authorization_code end |
#authorize_url ⇒ Object (readonly)
Returns the value of attribute authorize_url.
11 12 13 |
# File 'lib/orcid/spec_support.rb', line 11 def @authorize_url end |
#cookies=(value) ⇒ Object
Sets the attribute cookies
33 34 35 |
# File 'lib/orcid/spec_support.rb', line 33 def (value) @cookies = value end |
#login_url ⇒ Object (readonly)
Returns the value of attribute login_url.
11 12 13 |
# File 'lib/orcid/spec_support.rb', line 11 def login_url @login_url end |
#oauth_redirect_uri ⇒ Object (readonly)
Returns the value of attribute oauth_redirect_uri.
12 13 14 |
# File 'lib/orcid/spec_support.rb', line 12 def oauth_redirect_uri @oauth_redirect_uri end |
#orcid_client_id ⇒ Object (readonly)
Returns the value of attribute orcid_client_id.
12 13 14 |
# File 'lib/orcid/spec_support.rb', line 12 def orcid_client_id @orcid_client_id end |
#orcid_client_secret ⇒ Object (readonly)
Returns the value of attribute orcid_client_secret.
12 13 14 |
# File 'lib/orcid/spec_support.rb', line 12 def orcid_client_secret @orcid_client_secret end |
#orcid_profile_id ⇒ Object (readonly)
Returns the value of attribute orcid_profile_id.
13 14 15 |
# File 'lib/orcid/spec_support.rb', line 13 def orcid_profile_id @orcid_profile_id end |
#password ⇒ Object (readonly)
Returns the value of attribute password.
13 14 15 |
# File 'lib/orcid/spec_support.rb', line 13 def password @password end |
Class Method Details
.call(options = {}) ⇒ Object
7 8 9 |
# File 'lib/orcid/spec_support.rb', line 7 def self.call( = {}) new().call end |
Instance Method Details
#call ⇒ Object
26 27 28 29 30 31 |
# File 'lib/orcid/spec_support.rb', line 26 def call puts "Attempting to login to orcid { PROFILE_ID: '#{orcid_profile_id}', PASSWORD: '#{password}' }" login_to_orcid end |