Class: EloquaApiService::Visitor

Inherits:
Service
  • Object
show all
Defined in:
lib/eloqua_api_service/visitor.rb

Constant Summary collapse

BASE_PATH =
"/API/REST/2.0"

Instance Method Summary collapse

Methods inherited from Service

#initialize, #parse, #parse_body

Constructor Details

This class inherits a constructor from EloquaApiService::Service

Instance Method Details

#allObject



12
13
14
# File 'lib/eloqua_api_service/visitor.rb', line 12

def all
  parse(self.class.get("#{BASE_PATH}/data/forms?depth=complete", @options))
end

#data(id:, options: {}) ⇒ Object



32
33
34
35
# File 'lib/eloqua_api_service/visitor.rb', line 32

def data(id:, options: {})
  start_at = options[:start_at] || 0
  parse(self.class.get("#{BASE_PATH}/data/form/#{id}?startAt=#{start_at.to_i}", @options))
end

#find_by_guid(guid:) ⇒ Object



7
8
9
10
# File 'lib/eloqua_api_service/visitor.rb', line 7

def find_by_guid(guid:)
  response = self.class.get("#{BASE_PATH}/data/visitors?search=externalId=#{guid}&page=1&count=5", @options)
  parse(response)
end

#last_activeObject



20
21
22
23
24
25
26
27
28
29
# File 'lib/eloqua_api_service/visitor.rb', line 20

def last_active
  
  #parse(self.class.get("#{BASE_PATH}/data/visitors?search=*l*&orderBy=V_LastVisitDateAndTime&depth=complete", @options))
 #HH:MM:SS
  url = "#{BASE_PATH}/data/visitors?search=V_LastVisitDateAndTime>2016-01-02 && V_LastVisitDateAndTime<2017-01-03&depth=complete"
#      url = "#{BASE_PATH}/data/visitors?lastUpdatedAt=#{Time.now.to_i - (  300  ) }&depth=complete"
  puts url
  #&orderBy=V_LastVisitDateAndTime
  self.class.get(url, @options)
end

#search(term: '') ⇒ Object



16
17
18
# File 'lib/eloqua_api_service/visitor.rb', line 16

def search(term: '')
  parse(self.class.get("#{BASE_PATH}/data/forms?search=*#{term}*&depth=complete", @options))
end