Class: ApplicationInsights::Channel::Contracts::EventData

Inherits:
JsonSerializable show all
Defined in:
lib/application_insights/channel/contracts/event_data.rb

Overview

Data contract class for type EventData.

Instance Method Summary collapse

Methods inherited from JsonSerializable

#to_h, #to_json

Constructor Details

#initialize(options = {}) ⇒ EventData

Initializes a new instance of the EventData class.



9
10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/application_insights/channel/contracts/event_data.rb', line 9

def initialize(options={})
  defaults = {
    'ver' => 2,
    'name' => nil,
    'properties' => {},
    'measurements' => {}
  }
  values = {
    'ver' => 2,
    'name' => nil
  }
  super defaults, values, options
end

Instance Method Details

#measurementsObject

Gets the measurements property.



60
61
62
63
64
# File 'lib/application_insights/channel/contracts/event_data.rb', line 60

def measurements
  @values.fetch('measurements') { 
    @values['measurements'] = {}
  }
end

#measurements=(value) ⇒ Object

Sets the measurements property.



67
68
69
70
71
72
73
# File 'lib/application_insights/channel/contracts/event_data.rb', line 67

def measurements=(value)
  if value == @defaults['measurements']
    @values.delete 'measurements' if @values.key? 'measurements'
  else
    @values['measurements'] = value
  end
end

#nameObject

Gets the name property.



34
35
36
# File 'lib/application_insights/channel/contracts/event_data.rb', line 34

def name
  @values['name']
end

#name=(value) ⇒ Object

Sets the name property.



39
40
41
# File 'lib/application_insights/channel/contracts/event_data.rb', line 39

def name=(value)
  @values['name'] = value
end

#propertiesObject

Gets the properties property.



44
45
46
47
48
# File 'lib/application_insights/channel/contracts/event_data.rb', line 44

def properties
  @values.fetch('properties') { 
    @values['properties'] = {}
  }
end

#properties=(value) ⇒ Object

Sets the properties property.



51
52
53
54
55
56
57
# File 'lib/application_insights/channel/contracts/event_data.rb', line 51

def properties=(value)
  if value == @defaults['properties']
    @values.delete 'properties' if @values.key? 'properties'
  else
    @values['properties'] = value
  end
end

#verObject

Gets the ver property.



24
25
26
# File 'lib/application_insights/channel/contracts/event_data.rb', line 24

def ver
  @values['ver']
end

#ver=(value) ⇒ Object

Sets the ver property.



29
30
31
# File 'lib/application_insights/channel/contracts/event_data.rb', line 29

def ver=(value)
  @values['ver'] = value
end