infunnel_cli 1.0.0 → 1.1.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 173b256e237a97297b40432378f6edd16b08ffe7
4
- data.tar.gz: 942d25c8ff28e5f89898a56f8927be088bbbba9f
3
+ metadata.gz: a6f6a8ccac25b647ad0fe255825989bacfa99fb5
4
+ data.tar.gz: 64cd0bffe2de7877b3c7c241ff406f702c83a6c0
5
5
  SHA512:
6
- metadata.gz: 490471b40fb6d70688efde3dabf66f2c5b8d6938bb9c9e19c76f05dfeae7c77fbaea4432c24444564610861b86d1d5f72f9c24e968b07ebb814338803d84ce96
7
- data.tar.gz: 7037d10a1b4e345bea6572e17180ed3703162e3aa4867c9803a7266a3d2a2c403957dbbdd8160d3a06c1d1a05303d11a24c194b54c7ba85c5c0a3b99a4222808
6
+ metadata.gz: 56a998d7a184d958b1effffd1e34b5303b9072e60612fdefef64b23bf1b40d826201767420137da74d70f03abe51315738493007e568c57dab13f78736e0e677
7
+ data.tar.gz: a02df91d7df8e7ce894770658ba383cd7606233c487a5a2b3ffaf723313e8abc132308447c4e3c0b7e350e2e07fff243d1a87936086a6e279089bd94a7ab306e
@@ -19,6 +19,10 @@ module EloquaApiService
19
19
  responses
20
20
  end
21
21
 
22
+ def fields
23
+ parse(self.class.get("#{BASE_PATH}/assets/contact/fields?depth=complete", @options))
24
+ end
25
+
22
26
  def search(term: '')
23
27
  parse(self.class.get("#{BASE_PATH}/data/contacts?search=*#{term}*&depth=complete", @options))
24
28
  end
@@ -12,6 +12,11 @@ module EloquaApiService
12
12
  parse(self.class.get("#{BASE_PATH}/assets/customObjects?depth=complete", @options))
13
13
  end
14
14
 
15
+ def create(name:)
16
+ @options[:body] = { name: name, description: 'created from cli' }.to_json
17
+ parse(self.class.post("#{BASE_PATH}/assets/customObject", @options))
18
+ end
19
+
15
20
  def data_by_id(id:)
16
21
  parse(self.class.get("#{BASE_PATH}/data/customObject/#{id}?depth=complete", @options))
17
22
  end
@@ -0,0 +1,16 @@
1
+ require 'eloqua_api_service/service'
2
+ require 'date'
3
+ module EloquaApiService
4
+ class Contact < Service
5
+ BASE_PATH = "/API/REST/1.0"
6
+
7
+ def find(id:)
8
+ parse(self.class.get("#{BASE_PATH}/data/contact/#{id}?depth=complete", @options))
9
+ end
10
+
11
+ def all
12
+ parse(self.class.get("#{BASE_PATH}/data/contact/#{id}?depth=complete", @options))
13
+ end
14
+
15
+ end
16
+ end
@@ -16,6 +16,18 @@ module EloquaApiService
16
16
  def search(term: '')
17
17
  parse(self.class.get("#{BASE_PATH}/data/forms?search=*#{term}*&depth=complete", @options))
18
18
  end
19
+
20
+ def last_active
21
+
22
+ #parse(self.class.get("#{BASE_PATH}/data/visitors?search=*l*&orderBy=V_LastVisitDateAndTime&depth=complete", @options))
23
+ #HH:MM:SS
24
+ url = "#{BASE_PATH}/data/visitors?search=V_LastVisitDateAndTime>2016-01-02 && V_LastVisitDateAndTime<2017-01-03&depth=complete"
25
+ # url = "#{BASE_PATH}/data/visitors?lastUpdatedAt=#{Time.now.to_i - ( 300 ) }&depth=complete"
26
+ puts url
27
+ #&orderBy=V_LastVisitDateAndTime
28
+ self.class.get(url, @options)
29
+ end
30
+
19
31
 
20
32
  def data(id:, options: {})
21
33
  start_at = options[:start_at] || 0
@@ -42,6 +42,20 @@ module InfunnelCli
42
42
  puts activities.count
43
43
  end
44
44
 
45
+
46
+ desc "fields", "all contact fields"
47
+ option :account, aliases: :a
48
+ def fields
49
+ fields = EloquaApiService::Contact.new(account: options[:account]).fields
50
+ fields[:elements].each do |field|
51
+ field.each do |k, v|
52
+ puts "#{k}: #{v}"
53
+ end
54
+ puts '*' * 90
55
+ end
56
+ puts "Total: #{fields[:total]}"
57
+ end
58
+
45
59
  private
46
60
 
47
61
  def contact_print(contacts: [], options: {})
@@ -26,7 +26,16 @@ module InfunnelCli
26
26
  end
27
27
  end
28
28
 
29
- desc "get data by id", "CustomObjects data by id"
29
+
30
+
31
+
32
+ desc "create :name", "Create a cdo"
33
+ option :account, aliases: :a
34
+ def create(name)
35
+ puts EloquaApiService::CustomObject.new(account: options[:account]).create(name: name)
36
+ end
37
+
38
+ desc "get data by :id", "CustomObjects data by id"
30
39
  option :account, aliases: :a
31
40
  def data(id)
32
41
  EloquaApiService::CustomObject.new(account: options[:account]).data_by_id(id: id)[:elements].each do |custom_object|
@@ -10,15 +10,14 @@ module InfunnelCli
10
10
  option :html
11
11
  def find( id )
12
12
  EloquaApiService::Program.new(account: options[:account]).find(id: id).each do |k, v|
13
-
14
- if k == :steps
15
- puts 'Steps: '
16
- v.each do |_k, _v|
17
- find_step(_k[:id])
18
- end
19
- else
20
- puts "#{k}: #{v}"
13
+ if k == :steps
14
+ puts 'Steps: '
15
+ v.each do |_k, _v|
16
+ find_step(_k[:id])
21
17
  end
18
+ else
19
+ puts "#{k}: #{v}"
20
+ end
22
21
  end
23
22
  end
24
23
 
@@ -10,7 +10,6 @@ module InfunnelCli
10
10
  option :html
11
11
  def find( id )
12
12
  EloquaApiService::User.new(account: options[:account]).find(id: id).each do |k, v|
13
-
14
13
  puts "#{k}: #{format_value(k,v)}"
15
14
  end
16
15
  end
@@ -5,7 +5,7 @@ module InfunnelCli
5
5
  module CLI
6
6
  class Visitor < Base
7
7
 
8
- desc "find_by_guid :id", "Get form submissions by form id"
8
+ desc "find_by_guid :id", ""
9
9
  option :live, aliases: :l
10
10
  option :full, aliases: :f
11
11
  option :account, aliases: :a
@@ -17,7 +17,40 @@ module InfunnelCli
17
17
  puts e
18
18
  end
19
19
  puts response
20
- puts EloquaApiService::Contact.new(account: options[:account]).find(id: response[:elements][0][:contactId]) rescue "No contact id on this visitor."
20
+ puts EloquaApiService::Contact.new(account: options[:account]).find(id: response[:elements][0][:contactId]) rescue "No contact id on this visitor."
21
+ end
22
+
23
+ desc "last active ", ""
24
+
25
+ option :account, aliases: :a
26
+ def last_active
27
+
28
+ response = EloquaApiService::Visitor.new(account: options[:account]).last_active()
29
+ # response[:elements].each do |e|
30
+ # puts '-'*90
31
+ # puts e
32
+ # end
33
+ puts response.inspect
34
+
35
+ parsed = JSON.parse(response.body)
36
+
37
+
38
+ parsed['elements'].each do |v|
39
+
40
+ v.each do |k, v|
41
+ puts "#{k}: #{v}"
42
+ end
43
+ puts DateTime.strptime(v['V_LastVisitDateAndTime'],'%s')
44
+ puts '*' * 90
45
+
46
+ #require 'date'
47
+
48
+ #puts v['V_LastVisitDateAndTime']
49
+ end
50
+ puts parsed['total']
51
+ puts parsed['total']
52
+
53
+ # puts EloquaApiService::Contact.new(account: options[:account]).find(id: response[:elements][0][:contactId]) rescue "No contact id on this visitor."
21
54
  end
22
55
 
23
56
  private
@@ -1,3 +1,3 @@
1
1
  module InfunnelCli
2
- VERSION = "1.0.0"
2
+ VERSION = "1.1.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: infunnel_cli
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0
4
+ version: 1.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - lundevallan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-07 00:00:00.000000000 Z
11
+ date: 2017-01-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -138,6 +138,7 @@ files:
138
138
  - lib/eloqua_api_service/custom_object.rb
139
139
  - lib/eloqua_api_service/email.rb
140
140
  - lib/eloqua_api_service/form.rb
141
+ - lib/eloqua_api_service/lead_score.rb
141
142
  - lib/eloqua_api_service/login.rb
142
143
  - lib/eloqua_api_service/option_list.rb
143
144
  - lib/eloqua_api_service/program.rb
@@ -180,7 +181,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
180
181
  version: '0'
181
182
  requirements: []
182
183
  rubyforge_project:
183
- rubygems_version: 2.6.4
184
+ rubygems_version: 2.6.8
184
185
  signing_key:
185
186
  specification_version: 4
186
187
  summary: A cli for working with marketing automation.