Class: ApplicationInsights::Channel::Contracts::Envelope

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

Overview

Data contract class for type Envelope.

Instance Method Summary collapse

Methods inherited from JsonSerializable

#to_h, #to_json

Constructor Details

#initialize(options = {}) ⇒ Envelope

Initializes a new instance of the Envelope class.



9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
# File 'lib/application_insights/channel/contracts/envelope.rb', line 9

def initialize(options={})
  defaults = {
    'ver' => 1,
    'name' => nil,
    'time' => nil,
    'sampleRate' => 100.0,
    'seq' => nil,
    'iKey' => nil,
    'flags' => nil,
    'deviceId' => nil,
    'os' => nil,
    'osVer' => nil,
    'appId' => nil,
    'appVer' => nil,
    'userId' => nil,
    'tags' => {},
    'data' => nil
  }
  values = {
    'ver' => 1,
    'name' => nil,
    'time' => nil,
    'sampleRate' => 100.0
  }
  super defaults, values, options
end

Instance Method Details

#app_idObject

Gets the app_id property.



185
186
187
188
189
# File 'lib/application_insights/channel/contracts/envelope.rb', line 185

def app_id
  @values.fetch('appId') { 
    @values['appId'] = nil
  }
end

#app_id=(value) ⇒ Object

Sets the app_id property.



192
193
194
195
196
197
198
# File 'lib/application_insights/channel/contracts/envelope.rb', line 192

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

#app_verObject

Gets the app_ver property.



201
202
203
204
205
# File 'lib/application_insights/channel/contracts/envelope.rb', line 201

def app_ver
  @values.fetch('appVer') { 
    @values['appVer'] = nil
  }
end

#app_ver=(value) ⇒ Object

Sets the app_ver property.



208
209
210
211
212
213
214
# File 'lib/application_insights/channel/contracts/envelope.rb', line 208

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

#dataObject

Gets the data property.



249
250
251
252
253
# File 'lib/application_insights/channel/contracts/envelope.rb', line 249

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

#data=(value) ⇒ Object

Sets the data property.



256
257
258
259
260
261
262
# File 'lib/application_insights/channel/contracts/envelope.rb', line 256

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

#device_idObject

Gets the device_id property.



137
138
139
140
141
# File 'lib/application_insights/channel/contracts/envelope.rb', line 137

def device_id
  @values.fetch('deviceId') { 
    @values['deviceId'] = nil
  }
end

#device_id=(value) ⇒ Object

Sets the device_id property.



144
145
146
147
148
149
150
# File 'lib/application_insights/channel/contracts/envelope.rb', line 144

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

#flagsObject

Gets the flags property.



121
122
123
124
125
# File 'lib/application_insights/channel/contracts/envelope.rb', line 121

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

#flags=(value) ⇒ Object

Sets the flags property.



128
129
130
131
132
133
134
# File 'lib/application_insights/channel/contracts/envelope.rb', line 128

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

#i_keyObject

Gets the i_key property.



105
106
107
108
109
# File 'lib/application_insights/channel/contracts/envelope.rb', line 105

def i_key
  @values.fetch('iKey') { 
    @values['iKey'] = nil
  }
end

#i_key=(value) ⇒ Object

Sets the i_key property.



112
113
114
115
116
117
118
# File 'lib/application_insights/channel/contracts/envelope.rb', line 112

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

#nameObject

Gets the name property.



53
54
55
# File 'lib/application_insights/channel/contracts/envelope.rb', line 53

def name
  @values['name']
end

#name=(value) ⇒ Object

Sets the name property.



58
59
60
# File 'lib/application_insights/channel/contracts/envelope.rb', line 58

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

#osObject

Gets the os property.



153
154
155
156
157
# File 'lib/application_insights/channel/contracts/envelope.rb', line 153

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

#os=(value) ⇒ Object

Sets the os property.



160
161
162
163
164
165
166
# File 'lib/application_insights/channel/contracts/envelope.rb', line 160

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

#os_verObject

Gets the os_ver property.



169
170
171
172
173
# File 'lib/application_insights/channel/contracts/envelope.rb', line 169

def os_ver
  @values.fetch('osVer') { 
    @values['osVer'] = nil
  }
end

#os_ver=(value) ⇒ Object

Sets the os_ver property.



176
177
178
179
180
181
182
# File 'lib/application_insights/channel/contracts/envelope.rb', line 176

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

#sample_rateObject

Gets the sample_rate property.



73
74
75
76
77
# File 'lib/application_insights/channel/contracts/envelope.rb', line 73

def sample_rate
  @values.fetch('sampleRate') { 
    @values['sampleRate'] = 100.0
  }
end

#sample_rate=(value) ⇒ Object

Sets the sample_rate property.



80
81
82
83
84
85
86
# File 'lib/application_insights/channel/contracts/envelope.rb', line 80

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

#seqObject

Gets the seq property.



89
90
91
92
93
# File 'lib/application_insights/channel/contracts/envelope.rb', line 89

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

#seq=(value) ⇒ Object

Sets the seq property.



96
97
98
99
100
101
102
# File 'lib/application_insights/channel/contracts/envelope.rb', line 96

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

#tagsObject

Gets the tags property.



233
234
235
236
237
# File 'lib/application_insights/channel/contracts/envelope.rb', line 233

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

#tags=(value) ⇒ Object

Sets the tags property.



240
241
242
243
244
245
246
# File 'lib/application_insights/channel/contracts/envelope.rb', line 240

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

#timeObject

Gets the time property.



63
64
65
# File 'lib/application_insights/channel/contracts/envelope.rb', line 63

def time
  @values['time']
end

#time=(value) ⇒ Object

Sets the time property.



68
69
70
# File 'lib/application_insights/channel/contracts/envelope.rb', line 68

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

#user_idObject

Gets the user_id property.



217
218
219
220
221
# File 'lib/application_insights/channel/contracts/envelope.rb', line 217

def user_id
  @values.fetch('userId') { 
    @values['userId'] = nil
  }
end

#user_id=(value) ⇒ Object

Sets the user_id property.



224
225
226
227
228
229
230
# File 'lib/application_insights/channel/contracts/envelope.rb', line 224

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

#verObject

Gets the ver property.



37
38
39
40
41
# File 'lib/application_insights/channel/contracts/envelope.rb', line 37

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

#ver=(value) ⇒ Object

Sets the ver property.



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

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