Class: InfunnelCli::CLI::Contact

Inherits:
Base
  • Object
show all
Defined in:
lib/infunnel_cli/cli/contact.rb

Instance Method Summary collapse

Instance Method Details

#activities(contact_id) ⇒ Object



24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
# File 'lib/infunnel_cli/cli/contact.rb', line 24

def activities(contact_id)
  activities = EloquaApiService::Contact.new(account: options[:account]).activities(contact_id: contact_id)

  activities.each do |a|
    a.each do |e|
      puts
      e.each do |k, v|
        if k == :details
          puts "#{white k}:"
          v.each do |_k, _v|
            puts "#{ clear _k } #{ clear _v}"
          end
        else
          puts "#{ white k }: #{ clear format_value(k,v)}"
        end
      end
    end
  end
  puts activities.count
end

#fieldsObject



48
49
50
51
52
53
54
55
56
57
# File 'lib/infunnel_cli/cli/contact.rb', line 48

def fields
  fields = EloquaApiService::Contact.new(account: options[:account]).fields
  fields[:elements].each do |field|
    field.each do |k, v|
      puts "#{k}: #{v}"
    end
    puts '*' * 90
  end
  puts "Total: #{fields[:total]}"
end

#find(id) ⇒ Object



10
11
12
# File 'lib/infunnel_cli/cli/contact.rb', line 10

def find( id )
   contact_print(contacts: [EloquaApiService::Contact.new(account: options[:account]).find(id: id)], options: options)
end

#search(term) ⇒ Object



17
18
19
# File 'lib/infunnel_cli/cli/contact.rb', line 17

def search(term)
  contact_print(contacts: EloquaApiService::Contact.new(account: options[:account]).search(term: term)[:elements], options: options)
end