module Dialog::API::Track

Public Instance Methods

attach(options) click to toggle source

@param options [Hash, String] Properties to merge with the track payload @return [Hash]

# File lib/dialog-api/api/track.rb, line 9
def attach(options)
  if options.is_a?(String)
    @context = { message: { name: options }}
  else
    @context = options
  end
end
track(payload) click to toggle source

Tracks a message @param payload [Hash] @return [Hash]

# File lib/dialog-api/api/track.rb, line 20
def track(payload)
  body = payload.deep_merge(@context || {})
  @context = nil

  post("b/#{bot_id}/track", body: body)

  body
end