Class: A2A::PushNotification::AuthenticationInfo

Inherits:
Object
  • Object
show all
Defined in:
lib/a2a/push_notification/authentication_info.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(scheme:, credentials: nil) ⇒ AuthenticationInfo

Returns a new instance of AuthenticationInfo.



8
9
10
11
# File 'lib/a2a/push_notification/authentication_info.rb', line 8

def initialize(scheme:, credentials: nil)
  @scheme = scheme
  @credentials = credentials
end

Instance Attribute Details

#credentialsObject (readonly)

Returns the value of attribute credentials.



6
7
8
# File 'lib/a2a/push_notification/authentication_info.rb', line 6

def credentials
  @credentials
end

#schemeObject (readonly)

Returns the value of attribute scheme.



6
7
8
# File 'lib/a2a/push_notification/authentication_info.rb', line 6

def scheme
  @scheme
end

Class Method Details

.from_h(hash) ⇒ Object



13
14
15
# File 'lib/a2a/push_notification/authentication_info.rb', line 13

def self.from_h(hash)
  new(scheme: hash.fetch("scheme"), credentials: hash["credentials"])
end

Instance Method Details

#authorization_headerObject



24
25
26
# File 'lib/a2a/push_notification/authentication_info.rb', line 24

def authorization_header
  credentials ? "#{scheme} #{credentials}" : scheme
end

#to_hObject



17
18
19
20
21
22
# File 'lib/a2a/push_notification/authentication_info.rb', line 17

def to_h
  {
    "scheme" => scheme,
    "credentials" => credentials
  }.compact
end