Class: A2A::PushNotification::Config

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

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(url:, **kwargs) ⇒ Config

Returns a new instance of Config.



8
9
10
11
12
13
14
15
# File 'lib/a2a/push_notification/config.rb', line 8

def initialize(url:, **kwargs)
  @url = url
  @id = kwargs[:id]
  @token = kwargs[:token]
  @tenant = kwargs[:tenant]
  @task_id = kwargs[:task_id]
  @authentication = kwargs[:authentication]
end

Instance Attribute Details

#authenticationObject (readonly)

Returns the value of attribute authentication.



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

def authentication
  @authentication
end

#idObject (readonly)

Returns the value of attribute id.



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

def id
  @id
end

#task_idObject (readonly)

Returns the value of attribute task_id.



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

def task_id
  @task_id
end

#tenantObject (readonly)

Returns the value of attribute tenant.



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

def tenant
  @tenant
end

#tokenObject (readonly)

Returns the value of attribute token.



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

def token
  @token
end

#urlObject (readonly)

Returns the value of attribute url.



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

def url
  @url
end

Class Method Details

.from_h(hash) ⇒ Object



17
18
19
20
21
22
23
24
25
26
# File 'lib/a2a/push_notification/config.rb', line 17

def self.from_h(hash)
  new(
    url: hash.fetch("url"),
    id: hash["id"],
    token: hash["token"],
    tenant: hash["tenant"],
    task_id: hash["taskId"],
    authentication: hash["authentication"] && AuthenticationInfo.from_h(hash["authentication"])
  )
end

Instance Method Details

#to_hObject



28
29
30
31
32
33
34
35
36
37
# File 'lib/a2a/push_notification/config.rb', line 28

def to_h
  {
    "url" => url,
    "id" => id,
    "token" => token,
    "tenant" => tenant,
    "taskId" => task_id,
    "authentication" => authentication
  }.compact
end