Class: RequestSandboxAuthorizationCode

Inherits:
Object
  • Object
show all
Defined in:
lib/orcid/spec_support.rb

Overview

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

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(options = {})
  @orcid_client_id = options.fetch(:orcid_client_id) { Orcid.provider.id }
  @orcid_client_secret = options.fetch(:orcid_client_secret) { Orcid.provider.secret }
  @login_url = options.fetch(:login_url) { Orcid.provider. }
  @authorize_url = options.fetch(:authorize_url) { Orcid.provider.authorize_url }
  @oauth_redirect_uri = options.fetch(:oauth_redirect_uri) { 'https://developers.google.com/oauthplayground' }
  @access_scope = options.fetch(:scope) { Orcid.provider.authentication_scope }
  @orcid_profile_id = options.fetch(:orcid_profile_id) { ENV['ORCID_CLAIMED_PROFILE_ID'] }
  @password = options.fetch(:password) { ENV['ORCID_CLAIMED_PROFILE_PASSWORD'] }
end

Instance Attribute Details

#access_scopeObject (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_codeObject (readonly)

Returns the value of attribute authorization_code.



12
13
14
# File 'lib/orcid/spec_support.rb', line 12

def authorization_code
  @authorization_code
end

#authorize_urlObject (readonly)

Returns the value of attribute authorize_url.



11
12
13
# File 'lib/orcid/spec_support.rb', line 11

def authorize_url
  @authorize_url
end

#cookies=(value) ⇒ Object

Sets the attribute cookies

Parameters:

  • value

    the value to set the attribute cookies to.



33
34
35
# File 'lib/orcid/spec_support.rb', line 33

def cookies=(value)
  @cookies = value
end

#login_urlObject (readonly)

Returns the value of attribute login_url.



11
12
13
# File 'lib/orcid/spec_support.rb', line 11

def 
  @login_url
end

#oauth_redirect_uriObject (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_idObject (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_secretObject (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_idObject (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

#passwordObject (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(options = {})
  new(options).call
end

Instance Method Details

#callObject



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}' }"
  
  request_authorization
  request_authorization_code
end