Class: TrakioClient::Annotate

Inherits:
EndPoint
  • Object
show all
Defined in:
lib/trakio_client/annotate.rb

Instance Attribute Summary

Attributes inherited from EndPoint

#trakio

Instance Method Summary collapse

Methods inherited from EndPoint

#initialize

Constructor Details

This class inherits a constructor from TrakioClient::EndPoint

Instance Method Details

#check_parameters(event, properties) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/trakio_client/annotate.rb', line 19

def check_parameters event, properties
  unless event
    raise Exceptions::MissingParameter.new("The `event` parameter must be provided.")
  end
  unless properties.is_a?(Hash)
    raise Exceptions::InvalidParameter.new("The `properties` parameter must be a hash.")
  end
end

#run(p = {}) ⇒ Object



4
5
6
7
8
9
10
11
12
13
14
15
16
17
# File 'lib/trakio_client/annotate.rb', line 4

def run p = {}
  event = p[:event]
  properties = p[:properties] || {}
  channel = p[:channel] || self.channel
  check_parameters event, properties

  params = {
    event: event
  }
  params[:channel] = channel if channel
  params[:properties] = properties if properties

  send_request('annotate', params)
end