Class: Appsignal::Marker

Inherits:
Object
  • Object
show all
Defined in:
lib/appsignal/marker.rb

Constant Summary collapse

ACTION =
'markers'

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(marker_data, config) ⇒ Marker

Returns a new instance of Marker.



6
7
8
9
# File 'lib/appsignal/marker.rb', line 6

def initialize(marker_data, config)
  @marker_data = marker_data
  @config = config
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



3
4
5
# File 'lib/appsignal/marker.rb', line 3

def config
  @config
end

#marker_dataObject (readonly)

Returns the value of attribute marker_data.



3
4
5
# File 'lib/appsignal/marker.rb', line 3

def marker_data
  @marker_data
end

Instance Method Details

#transmitObject



11
12
13
14
15
16
17
18
19
20
21
22
# File 'lib/appsignal/marker.rb', line 11

def transmit
  transmitter = Transmitter.new(ACTION, config)
  puts "Notifying Appsignal of deploy with: revision: #{marker_data[:revision]}, user: #{marker_data[:user]}"
  result = transmitter.transmit(marker_data)
  if result == '200'
    puts 'Appsignal has been notified of this deploy!'
  else
    raise "#{result} at #{transmitter.uri}"
  end
rescue Exception => e
  puts "Something went wrong while trying to notify Appsignal: #{e}"
end