Class: RequestSandboxAuthorizationCode

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(options = {}) ⇒ RequestSandboxAuthorizationCode

Returns a new instance of RequestSandboxAuthorizationCode.



11
12
13
14
15
16
17
18
# File 'lib/orcid/spec_support.rb', line 11

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 }
end

Instance Attribute Details

#access_scopeObject (readonly)

Returns the value of attribute access_scope.



8
9
10
# File 'lib/orcid/spec_support.rb', line 8

def access_scope
  @access_scope
end

#authorization_codeObject (readonly)

Returns the value of attribute authorization_code.



9
10
11
# File 'lib/orcid/spec_support.rb', line 9

def authorization_code
  @authorization_code
end

#authorize_urlObject (readonly)

Returns the value of attribute authorize_url.



8
9
10
# File 'lib/orcid/spec_support.rb', line 8

def authorize_url
  @authorize_url
end

#cookies=(value) ⇒ Object

Sets the attribute cookies

Parameters:

  • value

    the value to set the attribute cookies to.



29
30
31
# File 'lib/orcid/spec_support.rb', line 29

def cookies=(value)
  @cookies = value
end

#login_urlObject (readonly)

Returns the value of attribute login_url.



8
9
10
# File 'lib/orcid/spec_support.rb', line 8

def 
  @login_url
end

#oauth_redirect_uriObject (readonly)

Returns the value of attribute oauth_redirect_uri.



9
10
11
# File 'lib/orcid/spec_support.rb', line 9

def oauth_redirect_uri
  @oauth_redirect_uri
end

#orcid_client_idObject (readonly)

Returns the value of attribute orcid_client_id.



9
10
11
# File 'lib/orcid/spec_support.rb', line 9

def orcid_client_id
  @orcid_client_id
end

#orcid_client_secretObject (readonly)

Returns the value of attribute orcid_client_secret.



9
10
11
# File 'lib/orcid/spec_support.rb', line 9

def orcid_client_secret
  @orcid_client_secret
end

Class Method Details

.call(options = {}, config = {}) ⇒ Object



4
5
6
# File 'lib/orcid/spec_support.rb', line 4

def self.call(options = {}, config = {})
  new(config).call(options)
end

Instance Method Details

#call(options = {}) ⇒ Object



20
21
22
23
24
25
26
27
# File 'lib/orcid/spec_support.rb', line 20

def call(options = {})
  orcid_profile_id = options.fetch(:orcid_profile_id) { ENV['ORCID_CLAIMED_PROFILE_ID'] }
  password = options.fetch(:password) { ENV['ORCID_CLAIMED_PROFILE_PASSWORD'] }

  (orcid_profile_id, password)
  request_authorization
  request_authorization_code
end