Class: ApplicationInsights::Channel::Contracts::PageViewData

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

Overview

Data contract class for type PageViewData.

Instance Method Summary collapse

Methods inherited from JsonSerializable

#to_h, #to_json

Constructor Details

#initialize(options = {}) ⇒ PageViewData

Initializes a new instance of the PageViewData class.



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

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

Instance Method Details

#durationObject

Gets the duration property.



62
63
64
65
66
# File 'lib/application_insights/channel/contracts/page_view_data.rb', line 62

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

#duration=(value) ⇒ Object

Sets the duration property.



69
70
71
72
73
74
75
# File 'lib/application_insights/channel/contracts/page_view_data.rb', line 69

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

#measurementsObject

Gets the measurements property.



94
95
96
97
98
# File 'lib/application_insights/channel/contracts/page_view_data.rb', line 94

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

#measurements=(value) ⇒ Object

Sets the measurements property.



101
102
103
104
105
106
107
# File 'lib/application_insights/channel/contracts/page_view_data.rb', line 101

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.



52
53
54
# File 'lib/application_insights/channel/contracts/page_view_data.rb', line 52

def name
  @values['name']
end

#name=(value) ⇒ Object

Sets the name property.



57
58
59
# File 'lib/application_insights/channel/contracts/page_view_data.rb', line 57

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

#propertiesObject

Gets the properties property.



78
79
80
81
82
# File 'lib/application_insights/channel/contracts/page_view_data.rb', line 78

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

#properties=(value) ⇒ Object

Sets the properties property.



85
86
87
88
89
90
91
# File 'lib/application_insights/channel/contracts/page_view_data.rb', line 85

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

#urlObject

Gets the url property.



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

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

#url=(value) ⇒ Object

Sets the url property.



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

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

#verObject

Gets the ver property.



26
27
28
# File 'lib/application_insights/channel/contracts/page_view_data.rb', line 26

def ver
  @values['ver']
end

#ver=(value) ⇒ Object

Sets the ver property.



31
32
33
# File 'lib/application_insights/channel/contracts/page_view_data.rb', line 31

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