Class: TempoIQ::Single

Inherits:
Object
  • Object
show all
Defined in:
lib/tempoiq/models/single.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(function, timestamp = nil, include_selection = false) ⇒ Single

Returns a new instance of Single.



6
7
8
9
10
11
# File 'lib/tempoiq/models/single.rb', line 6

def initialize(function, timestamp = nil, include_selection = false)
  @name = "single"
  @include_selection = include_selection
  @function = function
  @timestamp = timestamp
end

Instance Attribute Details

#functionObject (readonly)

Returns the value of attribute function.



3
4
5
# File 'lib/tempoiq/models/single.rb', line 3

def function
  @function
end

#include_selectionObject

Returns the value of attribute include_selection.



3
4
5
# File 'lib/tempoiq/models/single.rb', line 3

def include_selection
  @include_selection
end

#nameObject (readonly)

Returns the value of attribute name.



3
4
5
# File 'lib/tempoiq/models/single.rb', line 3

def name
  @name
end

#timestampObject (readonly)

Returns the value of attribute timestamp.



3
4
5
# File 'lib/tempoiq/models/single.rb', line 3

def timestamp
  @timestamp
end

Instance Method Details

#to_hashObject



13
14
15
16
17
18
19
20
# File 'lib/tempoiq/models/single.rb', line 13

def to_hash
  hash = {
    "function" => function.to_s,
    "include_selection" => include_selection
  }
  hash["timestamp"] = timestamp.iso8601(3) if timestamp
  hash
end