infunnel_cli 0.0.14 → 0.0.15
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/README.md +16 -8
- data/infunnel_cli.gemspec +2 -2
- data/lib/eloqua_api_service/form.rb +4 -0
- data/lib/eloqua_api_service/service.rb +4 -1
- data/lib/infunnel_cli/cli/base.rb +3 -1
- data/lib/infunnel_cli/cli/email.rb +2 -7
- data/lib/infunnel_cli/cli/form.rb +33 -13
- data/lib/infunnel_cli/version.rb +1 -1
- metadata +8 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: c807397df3b86871aec2b9bf526d246ef2b8cc20
|
4
|
+
data.tar.gz: bd82d249bf971f5b8d17cd30cef9e1a92970ddd0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec6afcb0923ee7d6d2e71f13fc35be6b98cc785728a27efc06850bb8bf01efaf134c8f1054d0092c82ec5e15dda668cdaa4e6a45d1617ae2f73d3d3b9c79737a
|
7
|
+
data.tar.gz: fc22665f21f5ba84afefedf220209397ee1eee59a7f0826b350946d35e0bb35845b745a3521bf85a835b3e676bd498923841d2cb75945c5e908cf695aebe2700
|
data/README.md
CHANGED
@@ -1,17 +1,25 @@
|
|
1
|
-
|
1
|
+
#infunnel_cli
|
2
|
+
|
3
|
+
###How do deploy to rubygems.org
|
2
4
|
|
3
5
|
And dont forget to commit to git in case you get "are not files" error when running gem build due to this row:
|
4
6
|
|
5
7
|
spec.files = `git ls-files -z`.split("\x0")
|
6
8
|
|
7
|
-
|
8
|
-
https://github.com/fcheung/keychain
|
9
|
-
gem 'ruby-keychain', '~> 0.3.2'
|
10
|
-
gem 'ruby-keychain', :require => 'keychain'
|
9
|
+
gem build infunnel_cli.gemspec
|
11
10
|
|
11
|
+
gem push infunnel_cli-x.x.x.gem
|
12
12
|
|
13
|
-
###How do deploy to rubygems.org
|
14
13
|
|
15
|
-
|
14
|
+
###TODO
|
16
15
|
|
17
|
-
|
16
|
+
Add warnings if no eloqua credentials are stored in keychain.
|
17
|
+
|
18
|
+
|
19
|
+
|
20
|
+
|
21
|
+
### Misc
|
22
|
+
|
23
|
+
docs for thor: http://whatisthor.com/
|
24
|
+
|
25
|
+
more docs for thor: http://www.rubydoc.info/github/wycats/thor/Thor/Shell/Color
|
data/infunnel_cli.gemspec
CHANGED
@@ -9,7 +9,7 @@ Gem::Specification.new do |spec|
|
|
9
9
|
spec.authors = ["lundevallan"]
|
10
10
|
spec.email = ["linus.lundevall@infunnel.se"]
|
11
11
|
spec.summary = "A cli for working with marketing automation."
|
12
|
-
spec.description = "A cli for working with marketing automation."
|
12
|
+
spec.description = "A cli for working with marketing automation. Connects to the eloqua-api."
|
13
13
|
spec.homepage = "http://infunnel.se"
|
14
14
|
spec.license = "MIT"
|
15
15
|
|
@@ -25,5 +25,5 @@ Gem::Specification.new do |spec|
|
|
25
25
|
spec.add_dependency 'ruby-keychain', '~> 0.3.2'
|
26
26
|
|
27
27
|
spec.add_development_dependency "bundler", "~> 1.5"
|
28
|
-
spec.add_development_dependency "rake", '>= 11.2.2'
|
28
|
+
spec.add_development_dependency "rake", '~> 11.2', '>= 11.2.2'
|
29
29
|
end
|
@@ -13,6 +13,10 @@ module EloquaApiService
|
|
13
13
|
parsed_response = JSON.parse(response.body, symbolize_names: true)
|
14
14
|
end
|
15
15
|
|
16
|
+
def search(term: '', options: {})
|
17
|
+
parse( self.class.get("/API/REST/1.0/assets/forms?search=*#{term}*&depth=complete", @options) )
|
18
|
+
end
|
19
|
+
|
16
20
|
def data(id:, options: {})
|
17
21
|
start_at = options[:start_at] || 0
|
18
22
|
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'eloqua_api_service/credential'
|
2
2
|
require 'httparty'
|
3
3
|
|
4
|
-
|
5
4
|
module EloquaApiService
|
6
5
|
class Service
|
7
6
|
|
@@ -19,5 +18,9 @@ module EloquaApiService
|
|
19
18
|
body: {}
|
20
19
|
}
|
21
20
|
end
|
21
|
+
|
22
|
+
def parse(response)
|
23
|
+
JSON.parse(response.body, symbolize_names: true)
|
24
|
+
end
|
22
25
|
end
|
23
26
|
end
|
@@ -1,3 +1,6 @@
|
|
1
|
+
require 'nokogiri'
|
2
|
+
require 'cgi'
|
3
|
+
require 'uri'
|
1
4
|
require 'eloqua_api_service/login'
|
2
5
|
require 'eloqua_api_service/credential'
|
3
6
|
require 'eloqua_api_service/email'
|
@@ -80,7 +83,6 @@ module InfunnelCli
|
|
80
83
|
def on_white(text)
|
81
84
|
"\e[47m#{text}\e[0m"
|
82
85
|
end
|
83
|
-
|
84
86
|
end
|
85
87
|
end
|
86
88
|
end
|
@@ -1,10 +1,5 @@
|
|
1
1
|
require 'infunnel_cli/cli/base'
|
2
|
-
require 'nokogiri'
|
3
|
-
require 'cgi'
|
4
|
-
require 'uri'
|
5
2
|
|
6
|
-
# docs for thor: http://whatisthor.com/
|
7
|
-
# more docs for thor: http://www.rubydoc.info/github/wycats/thor/Thor/Shell/Color
|
8
3
|
module InfunnelCli
|
9
4
|
module CLI
|
10
5
|
class Email < Base
|
@@ -62,12 +57,12 @@ module InfunnelCli
|
|
62
57
|
|
63
58
|
desc "find id", "Find email by id"
|
64
59
|
def preview(email_id, contact_id)
|
65
|
-
puts body = EloquaApiService::Email.new.preview(contact_id: contact_id, id: email_id)
|
60
|
+
puts body = EloquaApiService::Email.new(account: options[:account]).preview(contact_id: contact_id, id: email_id)
|
66
61
|
end
|
67
62
|
|
68
63
|
desc "find id", "Find email by id"
|
69
64
|
def campaign(campaign_id)
|
70
|
-
elements = EloquaApiService::Email.new.campaign(campaign_id: campaign_id)
|
65
|
+
elements = EloquaApiService::Email.new(account: options[:account]).campaign(campaign_id: campaign_id)
|
71
66
|
puts elements.select { |e| e[:type] == 'CampaignEmail' }.map{ |e| find(e[:id]) }
|
72
67
|
end
|
73
68
|
|
@@ -1,41 +1,57 @@
|
|
1
1
|
require 'infunnel_cli/cli/base'
|
2
|
-
require 'nokogiri'
|
3
|
-
require 'cgi'
|
4
|
-
require 'uri'
|
5
|
-
|
6
2
|
|
7
3
|
module InfunnelCli
|
8
4
|
module CLI
|
9
5
|
class Form < Base
|
10
6
|
|
11
|
-
desc "find id", "
|
7
|
+
desc "find :id", "Sow form with id"
|
12
8
|
option :links, aliases: :l
|
13
9
|
option :full, aliases: :f
|
14
10
|
option :account, aliases: :a
|
15
11
|
def find( id )
|
16
|
-
puts EloquaApiService::Form.new.find(id: 50)
|
12
|
+
puts EloquaApiService::Form.new(account: options[:account]).find(id: 50)
|
17
13
|
end
|
18
14
|
|
19
|
-
|
20
|
-
desc "find id", "Find email by id"
|
15
|
+
desc "all", "All forms in current eloqua account"
|
21
16
|
option :links, aliases: :l
|
22
17
|
option :full, aliases: :f
|
23
18
|
option :account, aliases: :a
|
24
19
|
def all
|
25
|
-
puts EloquaApiService::Form.new.all[:elements]
|
20
|
+
puts EloquaApiService::Form.new(account: options[:account]).all[:elements]
|
26
21
|
end
|
27
22
|
|
23
|
+
desc "search :term", "Find form by search on it's name"
|
24
|
+
option :account, aliases: :a
|
25
|
+
option :verbose, aliases: :v
|
26
|
+
def search(term)
|
27
|
+
EloquaApiService::Form.new(account: options[:account]).search(term: term)[:elements].each_with_index do |form, index|
|
28
|
+
string = "Id: #{form[:id]}, "
|
29
|
+
string += "name: #{form[:name]}, "
|
30
|
+
string += "fields: #{form[:elements].count}, "
|
31
|
+
string += "created_at: #{parse_date(form[:createdAt])}, "
|
32
|
+
string += "updated_at: #{parse_date(form[:updatedAt])} "
|
33
|
+
if options[:verbose]
|
34
|
+
string += "\n\nFields: \n"
|
35
|
+
string += form[:elements].map{ |e| " " +
|
36
|
+
e.reject{ |k| [:style, :validations].include?(k)
|
37
|
+
}.map{ |k, v| "#{k}: #{v}" }.join(', ')
|
38
|
+
}.join("\n")
|
39
|
+
end
|
40
|
+
puts (index.odd? ? black(on_white(string)) : white(on_black(string)))
|
41
|
+
puts ''
|
42
|
+
end
|
43
|
+
end
|
28
44
|
|
29
|
-
desc "
|
45
|
+
desc "data :id", "Get form submissions by form id"
|
30
46
|
option :live, aliases: :l
|
31
47
|
option :full, aliases: :f
|
32
48
|
option :account, aliases: :a
|
33
49
|
def data(form_id)
|
34
50
|
|
35
51
|
start_at = options[:full] ? 0 : Time.now - (76*3600)
|
36
|
-
fetch_options = { start_at: start_at }
|
52
|
+
fetch_options = { start_at: start_at, account: options[:account] }
|
37
53
|
|
38
|
-
form = EloquaApiService::Form.new.find(id: form_id)
|
54
|
+
form = EloquaApiService::Form.new(account: options[:account]).find(id: form_id)
|
39
55
|
elements = form[:elements]
|
40
56
|
|
41
57
|
puts black on_white "Form name: " + form[:name]
|
@@ -67,7 +83,7 @@ module InfunnelCli
|
|
67
83
|
|
68
84
|
def data_fetch(form_id: nil, options: {})
|
69
85
|
start_at = options[:start_at] || Time.now - (76*3600)
|
70
|
-
EloquaApiService::Form.new.data(id: form_id, options: {start_at: start_at})[:elements]
|
86
|
+
EloquaApiService::Form.new(account: options[:account]).data(id: form_id, options: {start_at: start_at})[:elements]
|
71
87
|
end
|
72
88
|
|
73
89
|
def data_print(submissions: [], elements: {})
|
@@ -83,6 +99,10 @@ module InfunnelCli
|
|
83
99
|
end
|
84
100
|
return submissions
|
85
101
|
end
|
102
|
+
|
103
|
+
def parse_date(unix_date)
|
104
|
+
DateTime.strptime(unix_date, '%s').strftime('%Y-%m-%d %H:%M')
|
105
|
+
end
|
86
106
|
end
|
87
107
|
end
|
88
108
|
end
|
data/lib/infunnel_cli/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: infunnel_cli
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.15
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- lundevallan
|
@@ -98,6 +98,9 @@ dependencies:
|
|
98
98
|
name: rake
|
99
99
|
requirement: !ruby/object:Gem::Requirement
|
100
100
|
requirements:
|
101
|
+
- - "~>"
|
102
|
+
- !ruby/object:Gem::Version
|
103
|
+
version: '11.2'
|
101
104
|
- - ">="
|
102
105
|
- !ruby/object:Gem::Version
|
103
106
|
version: 11.2.2
|
@@ -105,10 +108,13 @@ dependencies:
|
|
105
108
|
prerelease: false
|
106
109
|
version_requirements: !ruby/object:Gem::Requirement
|
107
110
|
requirements:
|
111
|
+
- - "~>"
|
112
|
+
- !ruby/object:Gem::Version
|
113
|
+
version: '11.2'
|
108
114
|
- - ">="
|
109
115
|
- !ruby/object:Gem::Version
|
110
116
|
version: 11.2.2
|
111
|
-
description: A cli for working with marketing automation.
|
117
|
+
description: A cli for working with marketing automation. Connects to the eloqua-api.
|
112
118
|
email:
|
113
119
|
- linus.lundevall@infunnel.se
|
114
120
|
executables:
|