Class: PagerJudy::Sync::Syncer

Inherits:
Object
  • Object
show all
Defined in:
lib/pager_judy/sync/syncer.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(client:, config:) ⇒ Syncer

Returns a new instance of Syncer.



6
7
8
9
# File 'lib/pager_judy/sync/syncer.rb', line 6

def initialize(client:, config:)
  @client = client
  @config = config
end

Instance Attribute Details

#clientObject (readonly)

Returns the value of attribute client.



11
12
13
# File 'lib/pager_judy/sync/syncer.rb', line 11

def client
  @client
end

#configObject (readonly)

Returns the value of attribute config.



12
13
14
# File 'lib/pager_judy/sync/syncer.rb', line 12

def config
  @config
end

Instance Method Details

#syncObject



14
15
16
17
18
# File 'lib/pager_judy/sync/syncer.rb', line 14

def sync
  config.services.each do |name, detail|
    client.services.create_or_update_by_name(name, detail.to_h)
  end
end