Class: VisaAcceptanceMergedSpec::AcceptCredentials

Inherits:
Object
  • Object
show all
Defined in:
lib/visa_acceptance_merged_spec/http/auth/accept.rb

Overview

Data class for AcceptCredentials. Data class for AcceptCredentials.

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(accept:) ⇒ AcceptCredentials

Returns a new instance of AcceptCredentials.

Raises:

  • (ArgumentError)


30
31
32
33
34
# File 'lib/visa_acceptance_merged_spec/http/auth/accept.rb', line 30

def initialize(accept:)
  raise ArgumentError, 'accept cannot be nil' if accept.nil?

  @accept = accept
end

Instance Attribute Details

#acceptObject (readonly)

Returns the value of attribute accept.



28
29
30
# File 'lib/visa_acceptance_merged_spec/http/auth/accept.rb', line 28

def accept
  @accept
end

Class Method Details

.from_envObject



36
37
38
39
40
41
42
43
44
# File 'lib/visa_acceptance_merged_spec/http/auth/accept.rb', line 36

def self.from_env
  accept = ENV['ACCEPT_ACCEPT']
  all_nil = [
    accept
  ].all?(&:nil?)
  return nil if all_nil

  new(accept: accept)
end

Instance Method Details

#clone_with(accept: nil) ⇒ Object



46
47
48
49
50
# File 'lib/visa_acceptance_merged_spec/http/auth/accept.rb', line 46

def clone_with(accept: nil)
  accept ||= self.accept

  AcceptCredentials.new(accept: accept)
end