Class: InfunnelCli::CLI::Visitor
- Defined in:
- lib/infunnel_cli/cli/visitor.rb
Instance Method Summary collapse
Instance Method Details
#find_by_guid(guid) ⇒ Object
12 13 14 15 16 17 18 19 20 21 |
# File 'lib/infunnel_cli/cli/visitor.rb', line 12 def find_by_guid(guid) response = EloquaApiService::Visitor.new(account: [:account]).find_by_guid(guid: format_guid(guid)) response[:elements].each do |e| puts '-'*90 puts e end puts response puts EloquaApiService::Contact.new(account: [:account]).find(id: response[:elements][0][:contactId]) rescue "No contact id on this visitor." end |
#last_active ⇒ Object
26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 |
# File 'lib/infunnel_cli/cli/visitor.rb', line 26 def last_active response = EloquaApiService::Visitor.new(account: [:account]).last_active() # response[:elements].each do |e| # puts '-'*90 # puts e # end puts response.inspect parsed = JSON.parse(response.body) parsed['elements'].each do |v| v.each do |k, v| puts "#{k}: #{v}" end puts DateTime.strptime(v['V_LastVisitDateAndTime'],'%s') puts '*' * 90 #require 'date' #puts v['V_LastVisitDateAndTime'] end puts parsed['total'] puts parsed['total'] # puts EloquaApiService::Contact.new(account: options[:account]).find(id: response[:elements][0][:contactId]) rescue "No contact id on this visitor." end |