infunnel_cli 0.0.20 → 0.0.162

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: abe1e426fc115d254b3762e0ff2546f600b77fa4
4
- data.tar.gz: 6c50f482ff82e0178f9d2264847502c9d52fd5a0
3
+ metadata.gz: eda30ecb7514dffd323d458bccb53bb41af889f4
4
+ data.tar.gz: ed8eeecaaaa2ab071d1da988906806a1d9279037
5
5
  SHA512:
6
- metadata.gz: 4bc7761a21591fdbe60ddf0d3dec4cc26a2a315c7f20f508b23d8d05144682a88b65dafe49abc767de0ed70eb185bb1da7f9b57cbade8ea55b6c08d32db48393
7
- data.tar.gz: c82e7e6e91622d7b3d7ce3d3e861f83bd0556a35ed71da9e531efb53a89a6d8a27882d81e0939e13194e15b6e2d0a868ced929ae0e224db1c43b431bb9c53c3f
6
+ metadata.gz: 405e75e51306e65b9057f7366c0fe897d9eade2e029d9a7c6c618398f486140f9c8acb7b58958583add1a1185ed2af0245518691f45a59f72a97f1cabf0a41fb
7
+ data.tar.gz: 23d612b77e988ddfd04fafc7e0ac5ddf0012a530373d5241b24c903d712ac979fb46aee4cdb9a353ac5eff57acd71e63987a86297508f03cdd97261d875465e4
data/README.md CHANGED
@@ -19,12 +19,4 @@ Add warnings if no eloqua credentials are stored in keychain.
19
19
 
20
20
  docs for thor: http://whatisthor.com/
21
21
 
22
- more docs for thor: http://www.rubydoc.info/github/wycats/thor/Thor/Shell/Color
23
-
24
- ### Usage of the cli on mac
25
-
26
- pipe results into copy memory: infunnel_cli option_list find 4 --html | pbcopy
27
-
28
- ## Future improvements
29
-
30
- Make account name editable so you dont have to spell out the full company name
22
+ more docs for thor: http://www.rubydoc.info/github/wycats/thor/Thor/Shell/Color
@@ -9,14 +9,8 @@ module EloquaApiService
9
9
  end
10
10
 
11
11
  def activities(contact_id:)
12
-
13
- responses = []
14
- types = ['emailOpen', 'emailSend', 'emailClickThrough', 'emailSubscribe', 'emailUnsubscribe', 'formSubmit', 'webVisit', 'campaignMembership']
15
- types.each do |type|
16
- response = self.class.get("#{BASE_PATH}/data/activities/contact/#{contact_id}?type=#{type}&startDate=#{Time.new(2000,7,6).strftime('%s')}&endDate=#{Time.new(2100,7,9).strftime('%s')}&count=1000&depth=complete", @options)
17
- responses << parse(response) rescue []
18
- end
19
- responses
12
+ response = self.class.get("#{BASE_PATH}/data/activities/contact/#{contact_id}?type=formSubmit&startDate=#{Time.new(2014,7,6).strftime('%s')}&endDate=#{Time.new(2017,7,9).strftime('%s')}&count=1000&depth=complete", @options)
13
+ parse(response)
20
14
  end
21
15
 
22
16
  def search(term: '')
@@ -13,7 +13,7 @@ module EloquaApiService
13
13
 
14
14
  def get_options
15
15
  @options = { headers: {
16
- 'Authorization' => "Basic #{@credentials.password}",
16
+ "Authorization" => "Basic #{@credentials.password}",
17
17
  'Content-Type' => 'application/json'
18
18
  },
19
19
  body: {}
@@ -25,7 +25,7 @@ module EloquaApiService
25
25
 
26
26
  @options = {
27
27
  headers: {
28
- 'Authorization' => "Basic #{@eloqua_auth}",
28
+ "Authorization" => "Basic #{@eloqua_auth}",
29
29
  'Content-Type' => 'application/json'
30
30
  },
31
31
  body: {}
@@ -12,7 +12,7 @@ module EloquaApiService
12
12
  self.class.base_uri @credentials.service
13
13
 
14
14
  @options = { headers: {
15
- 'Authorization' => "Basic #{@credentials.password}",
15
+ "Authorization" => "Basic #{@credentials.password}",
16
16
  'Content-Type' => 'application/json'
17
17
  },
18
18
  body: {}
@@ -22,9 +22,5 @@ module EloquaApiService
22
22
  def parse(response)
23
23
  JSON.parse(response.body, symbolize_names: true)
24
24
  end
25
-
26
- def parse_body(body)
27
- JSON.parse(body, symbolize_names: true)
28
- end
29
25
  end
30
26
  end
@@ -6,6 +6,8 @@ module EloquaApiService
6
6
 
7
7
  def find_by_guid(guid:)
8
8
  response = self.class.get("#{BASE_PATH}/data/visitors?search=externalId=#{guid}&page=1&count=5", @options)
9
+ # puts response.request.inspect
10
+ # puts response.inspect
9
11
  parse(response)
10
12
  end
11
13
 
@@ -4,54 +4,25 @@ require 'infunnel_cli/cli/eloqua'
4
4
  require 'infunnel_cli/cli/form'
5
5
  require 'infunnel_cli/cli/contact'
6
6
  require 'infunnel_cli/cli/visitor'
7
- require 'infunnel_cli/cli/option_list'
8
- require 'infunnel_cli/cli/program'
9
- require 'infunnel_cli/cli/campaign'
10
- require 'infunnel_cli/cli/user'
11
- require 'infunnel_cli/cli/custom_object'
12
- require 'infunnel_cli/cli/contact_segment'
13
- require 'infunnel_cli/cli/contact_list'
14
7
  require 'keychain'
15
8
  #require 'ruby-keychain'
16
9
 
17
10
  module InfunnelCli
18
11
  class Tools < Thor
19
12
 
20
- desc "email", ""
13
+ desc "email COMMANDS", ""
21
14
  subcommand "email", InfunnelCli::CLI::Email
22
15
 
23
- desc "eloqua", ""
16
+ desc "login COMMANDS", ""
24
17
  subcommand "eloqua", InfunnelCli::CLI::Eloqua
25
18
 
26
- desc "form", ""
19
+ desc "form COMMANDS", ""
27
20
  subcommand "form", InfunnelCli::CLI::Form
28
21
 
29
- desc "contact", ""
22
+ desc "contact COMMANDS", ""
30
23
  subcommand "contact", InfunnelCli::CLI::Contact
31
24
 
32
- desc "visitor", ""
25
+ desc "visitor COMMANDS", ""
33
26
  subcommand "visitor", InfunnelCli::CLI::Visitor
34
-
35
- desc "option_list", ""
36
- subcommand "option_list", InfunnelCli::CLI::OptionList
37
-
38
- desc "program", ""
39
- subcommand "program", InfunnelCli::CLI::Program
40
-
41
- desc "campaign", ""
42
- subcommand "campaign", InfunnelCli::CLI::Campaign
43
-
44
- desc "user", ""
45
- subcommand "user", InfunnelCli::CLI::User
46
-
47
- desc "custom_object", ""
48
- subcommand "custom_object", InfunnelCli::CLI::CustomObject
49
-
50
- desc "contact_segment", ""
51
- subcommand "contact_segment", InfunnelCli::CLI::ContactSegment
52
-
53
- desc "contact_list", ""
54
- subcommand "contact_list", InfunnelCli::CLI::ContactList
55
-
56
27
  end
57
28
  end
@@ -7,13 +7,6 @@ require 'eloqua_api_service/email'
7
7
  require 'eloqua_api_service/form'
8
8
  require 'eloqua_api_service/contact'
9
9
  require 'eloqua_api_service/visitor'
10
- require 'eloqua_api_service/option_list'
11
- require 'eloqua_api_service/program'
12
- require 'eloqua_api_service/campaign'
13
- require 'eloqua_api_service/user'
14
- require 'eloqua_api_service/custom_object'
15
- require 'eloqua_api_service/contact_segment'
16
- require 'eloqua_api_service/contact_list'
17
10
 
18
11
  module InfunnelCli
19
12
  module CLI
@@ -21,17 +14,6 @@ module InfunnelCli
21
14
 
22
15
  private
23
16
 
24
- def format_value(key, value)
25
- if ['createdAt', 'updatedAt', 'activityDate'].any? { |word| key.to_s.include?(word) }
26
- return parse_date(value)
27
- end
28
- return value
29
- end
30
-
31
- def parse_date(unix_date)
32
- DateTime.strptime(unix_date, '%s').strftime('%Y-%m-%d %H:%M:%S')
33
- end
34
-
35
17
  def clear(text)
36
18
  "\e[0m#{text}\e[0m"
37
19
  end
@@ -25,19 +25,8 @@ module InfunnelCli
25
25
  activities = EloquaApiService::Contact.new(account: options[:account]).activities(contact_id: contact_id)
26
26
 
27
27
  activities.each do |a|
28
- a.each do |e|
29
- puts
30
- e.each do |k, v|
31
- if k == :details
32
- puts "#{white k}:"
33
- v.each do |_k, _v|
34
- puts "#{ clear _k } #{ clear _v}"
35
- end
36
- else
37
- puts "#{ white k }: #{ clear format_value(k,v)}"
38
- end
39
- end
40
- end
28
+ puts a
29
+ puts '*' * 90
41
30
  end
42
31
  puts activities.count
43
32
  end
@@ -56,8 +45,8 @@ module InfunnelCli
56
45
  :updatedAt,
57
46
  :createdAt,
58
47
  :id,
59
- :emailAddress#,
60
- #:fieldValues
48
+ :emailAddress,
49
+ :fieldValues
61
50
  ]
62
51
 
63
52
  string += "\n\nFields: \n"
@@ -68,7 +57,7 @@ module InfunnelCli
68
57
  end
69
58
  end
70
59
 
71
- def parse_date(unix_date)
60
+ def parse_date(unix_date)
72
61
  DateTime.strptime(unix_date, '%s').strftime('%Y-%m-%d %H:%M')
73
62
  end
74
63
  end
@@ -2,7 +2,7 @@ module InfunnelCli
2
2
  module CLI
3
3
  class Eloqua < Base
4
4
 
5
- desc "login", "Login to eloqua and save credentials in keychain"
5
+ desc "Login", "Login to eloqua and save credentials in keychain"
6
6
  option :default, aliases: :d, :type => :boolean
7
7
  def login
8
8
  say("Login to eloqua and save credentials in keychain")
@@ -10,156 +10,105 @@ module InfunnelCli
10
10
  option :account, aliases: :a
11
11
  option :verbose, aliases: :v
12
12
  def find( id )
13
- form_print(forms: [EloquaApiService::Form.new(account: options[:account]).find(id: id)], options: options)
14
- end
15
-
16
- desc "all", "All forms in current eloqua account"
17
- option :links, aliases: :l
18
- option :full, aliases: :f
19
- option :account, aliases: :a
20
- option :verbose, aliases: :v
21
- def all
22
- form_print(forms: EloquaApiService::Form.new(account: options[:account]).all[:elements], options: options)
23
- end
24
-
25
- desc "search :term", "Find form by search on it's name"
26
- option :account, aliases: :a
27
- option :verbose, aliases: :v
28
- def search(term)
29
- form_print(forms: EloquaApiService::Form.new(account: options[:account]).search(term: term)[:elements], options: options)
30
- end
13
+ form_print(forms: [EloquaApiService::Form.new(account: options[:account]).find(id: id)], options: options)
14
+ end
31
15
 
32
- desc "data :id", "Get form submissions by form id"
33
- option :live, aliases: :l
34
- option :raw, aliases: :r
35
- option :count, aliases: :c
36
- option :csv
37
- option :full, aliases: :f
38
- option :account, aliases: :a
39
- def data(form_id)
16
+ desc "all", "All forms in current eloqua account"
17
+ option :links, aliases: :l
18
+ option :full, aliases: :f
19
+ option :account, aliases: :a
20
+ option :verbose, aliases: :v
21
+ def all
22
+ form_print(forms: EloquaApiService::Form.new(account: options[:account]).all[:elements], options: options)
23
+ end
40
24
 
41
- start_at = options[:full] ? 0 : Time.now - (5*360*24*3600)
42
- fetch_options = { start_at: start_at, account: options[:account]}
25
+ desc "search :term", "Find form by search on it's name"
26
+ option :account, aliases: :a
27
+ option :verbose, aliases: :v
28
+ def search(term)
29
+ form_print(forms: EloquaApiService::Form.new(account: options[:account]).search(term: term)[:elements], options: options)
30
+ end
43
31
 
44
- form = EloquaApiService::Form.new(account: options[:account]).find(id: form_id)
45
- elements = form[:elements]
32
+ desc "data :id", "Get form submissions by form id"
33
+ option :live, aliases: :l
34
+ option :full, aliases: :f
35
+ option :account, aliases: :a
36
+ def data(form_id)
46
37
 
47
- unless options[:csv]
48
- puts black on_white "Form name: #{form[:name]}"
49
- puts black on_white "Id: #{form[:id]}"
50
- puts black on_white "Submits after: #{start_at}"
51
- end
38
+ start_at = options[:full] ? 0 : Time.now - (76*3600)
39
+ fetch_options = { start_at: start_at, account: options[:account] }
52
40
 
53
- submissions = data_fetch(form_id: form_id, options: fetch_options)
41
+ form = EloquaApiService::Form.new(account: options[:account]).find(id: form_id)
42
+ elements = form[:elements]
54
43
 
55
- if options[:count]
56
- puts submissions.size
57
- return
58
- end
44
+ puts black on_white "Form name: " + form[:name]
45
+ puts black on_white "Id: " + form[:id]
46
+ puts black on_white "Submits after: #{start_at}"
59
47
 
60
- if options[:raw]
61
- puts submissions.to_json
62
- return
63
- end
48
+ submissions = data_fetch(form_id: form_id, options: fetch_options)
64
49
 
65
- first = true
50
+ first = true
66
51
 
67
- if options[:live]
68
- while true
69
- new_data = data_fetch(form_id: form_id, options: fetch_options)
70
- data_print(submissions: new_data, elements: elements) if first
52
+ if options[:live]
53
+ while true
54
+ new_data = data_fetch(form_id: form_id, options: fetch_options)
55
+ data_print(submissions: new_data, elements: elements) if first
71
56
 
72
- only_new = new_data.reject { |s| submissions.map{ |old| old[:id] }.include?(s[:id]) }
73
- data_print(submissions: only_new, elements: elements) if only_new != submissions && !first
57
+ only_new = new_data.reject { |s| submissions.map{ |old| old[:id] }.include?(s[:id]) }
58
+ data_print(submissions: only_new, elements: elements) if only_new != submissions && !first
74
59
 
75
- submissions = new_data
76
- first = false
77
- sleep 7
78
- end
79
- else
80
- data_print(submissions: submissions, elements: elements, options: { csv: options[:csv] } )
81
- if options[:full]
82
- puts "Total submissions: #{submissions.count}"
60
+ submissions = new_data
61
+ first = false
62
+ sleep 7
63
+ end
64
+ else
65
+ data_print(submissions: submissions, elements: elements)
83
66
  end
84
67
  end
85
- end
86
-
87
- private
88
-
89
- def form_print(forms: [], options: {})
90
68
 
91
- forms.each_with_index do |form, index|
92
- string = "Id: #{form[:id]}, "
93
- string += "name: #{form[:name]}, "
94
- string += "fields: #{form[:elements].count}, "
95
- string += "created_at: #{parse_date(form[:createdAt])}, "
96
- string += "updated_at: #{parse_date(form[:updatedAt])} "
97
- if options[:verbose]
98
- string += "\n\nFields: \n"
99
- string += form[:elements].map{ |e| " " +
100
- e.reject{ |k| [:style, :validations].include?(k)
69
+ private
70
+
71
+ def form_print(forms: [], options: {})
72
+ forms.each_with_index do |form, index|
73
+ string = "Id: #{form[:id]}, "
74
+ string += "name: #{form[:name]}, "
75
+ string += "fields: #{form[:elements].count}, "
76
+ string += "created_at: #{parse_date(form[:createdAt])}, "
77
+ string += "updated_at: #{parse_date(form[:updatedAt])} "
78
+ if options[:verbose]
79
+ string += "\n\nFields: \n"
80
+ string += form[:elements].map{ |e| " " +
81
+ e.reject{ |k| [:style, :validations].include?(k)
101
82
  }.map{ |k, v| "#{k}: #{v}" }.join(', ')
102
83
  }.join("\n")
103
- end
104
- puts (index.odd? ? black(on_white(string)) : white(on_black(string)))
105
- puts ''
106
84
  end
85
+ puts (index.odd? ? black(on_white(string)) : white(on_black(string)))
86
+ puts ''
107
87
  end
88
+ end
108
89
 
109
- def data_fetch(form_id: nil, options: {})
110
- start_at = options[:start_at] || Time.now - (76*3600)
111
- EloquaApiService::Form.new(account: options[:account]).data(id: form_id, options: {start_at: start_at})[:elements]
112
- end
113
-
114
- def data_print(submissions: [], elements: {}, options: {})
115
-
116
- if options[:csv]
117
- csv_heading = []
118
- rows = []
119
- submissions.reverse.each_with_index do |submission, index|
120
-
121
- row = []
122
- if index == 0
123
- csv_heading = elements.map {|e| e[:htmlName] }
124
- csv_heading << "submittedAt"
125
- end
126
- submission[:fieldValues].each_with_index do |field, index|
127
- field_name = elements.find { |element| element[:id] == field[:id] }
128
- row << field[:value] rescue ''
129
- end
130
-
131
- rows << row
132
- row << Time.at(submission[:submittedAt].to_i)
133
-
134
- end
135
-
136
- csv_string = CSV.generate do |csv|
137
- csv << csv_heading
138
- rows.each do |row|
139
- csv << row
140
- end
141
- end
142
-
143
- puts csv_string
144
- return submissions
145
- end
90
+ def data_fetch(form_id: nil, options: {})
91
+ start_at = options[:start_at] || Time.now - (76*3600)
92
+ EloquaApiService::Form.new(account: options[:account]).data(id: form_id, options: {start_at: start_at})[:elements]
93
+ end
146
94
 
147
- submissions.reverse.each do |submission|
148
- row = []
149
- row << "Id: #{submission[:id]}"
150
- submission[:fieldValues].each do |field|
151
- field_name = elements.find { |element| element[:id] == field[:id] }
152
- row << "#{magenta(field_name[:htmlName])}: #{yellow(field[:value])}" rescue nil
153
- end
154
- row << "At: #{Time.at(submission[:submittedAt].to_i)} \n\n"
155
- puts row.join(', ')
95
+ def data_print(submissions: [], elements: {})
96
+ submissions.reverse.each do |submission|
97
+ row = []
98
+ row << "Id: #{submission[:id]}"
99
+ submission[:fieldValues].each do |field|
100
+ field_name = elements.find { |element| element[:id] == field[:id] }
101
+ row << "#{magenta(field_name[:htmlName])}: #{yellow(field[:value])}" rescue nil
156
102
  end
157
- return submissions
103
+ row << "At: #{Time.at(submission[:submittedAt].to_i)} \n\n"
104
+ puts row.join(', ')
158
105
  end
106
+ return submissions
107
+ end
159
108
 
160
- def parse_date(unix_date)
161
- DateTime.strptime(unix_date, '%s').strftime('%Y-%m-%d %H:%M')
162
- end
109
+ def parse_date(unix_date)
110
+ DateTime.strptime(unix_date, '%s').strftime('%Y-%m-%d %H:%M')
163
111
  end
164
112
  end
165
113
  end
114
+ end
@@ -10,24 +10,12 @@ module InfunnelCli
10
10
  option :full, aliases: :f
11
11
  option :account, aliases: :a
12
12
  def find_by_guid(guid)
13
-
14
- response = EloquaApiService::Visitor.new(account: options[:account]).find_by_guid(guid: format_guid(guid))
15
- response[:elements].each do |e|
16
- puts '-'*90
17
- puts e
18
- end
13
+ response = EloquaApiService::Visitor.new(account: options[:account]).find_by_guid(guid: guid)
19
14
  puts response
20
15
  puts EloquaApiService::Contact.new(account: options[:account]).find(id: response[:elements][0][:contactId]) rescue "No contact id on this visitor."
21
16
  end
22
17
 
23
- private
24
18
 
25
- def format_guid(guid)
26
- unless guid.include? "-"
27
- return guid.dup.insert(8, '-').insert(13,'-').insert(18,'-').insert(23,'-').downcase
28
- end
29
- guid
30
- end
31
19
  end
32
20
  end
33
21
  end
@@ -1,3 +1,3 @@
1
1
  module InfunnelCli
2
- VERSION = "0.0.20"
2
+ VERSION = "0.0.162"
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: 0.0.20
4
+ version: 0.0.162
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: 2016-08-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: thor
@@ -130,34 +130,20 @@ files:
130
130
  - Rakefile
131
131
  - bin/infunnel_cli
132
132
  - infunnel_cli.gemspec
133
- - lib/eloqua_api_service/campaign.rb
134
133
  - lib/eloqua_api_service/contact.rb
135
- - lib/eloqua_api_service/contact_list.rb
136
- - lib/eloqua_api_service/contact_segment.rb
137
134
  - lib/eloqua_api_service/credential.rb
138
- - lib/eloqua_api_service/custom_object.rb
139
135
  - lib/eloqua_api_service/email.rb
140
136
  - lib/eloqua_api_service/form.rb
141
137
  - lib/eloqua_api_service/login.rb
142
- - lib/eloqua_api_service/option_list.rb
143
- - lib/eloqua_api_service/program.rb
144
138
  - lib/eloqua_api_service/service.rb
145
- - lib/eloqua_api_service/user.rb
146
139
  - lib/eloqua_api_service/visitor.rb
147
140
  - lib/infunnel_cli.rb
148
141
  - lib/infunnel_cli/cli.rb
149
142
  - lib/infunnel_cli/cli/base.rb
150
- - lib/infunnel_cli/cli/campaign.rb
151
143
  - lib/infunnel_cli/cli/contact.rb
152
- - lib/infunnel_cli/cli/contact_list.rb
153
- - lib/infunnel_cli/cli/contact_segment.rb
154
- - lib/infunnel_cli/cli/custom_object.rb
155
144
  - lib/infunnel_cli/cli/eloqua.rb
156
145
  - lib/infunnel_cli/cli/email.rb
157
146
  - lib/infunnel_cli/cli/form.rb
158
- - lib/infunnel_cli/cli/option_list.rb
159
- - lib/infunnel_cli/cli/program.rb
160
- - lib/infunnel_cli/cli/user.rb
161
147
  - lib/infunnel_cli/cli/visitor.rb
162
148
  - lib/infunnel_cli/version.rb
163
149
  homepage: http://infunnel.se
@@ -1,15 +0,0 @@
1
- require 'eloqua_api_service/service'
2
-
3
- module EloquaApiService
4
- class Campaign < Service
5
- BASE_PATH = "/API/REST/2.0"
6
-
7
- def find(id:)
8
- parse(self.class.get("#{BASE_PATH}/assets/campaign/#{id}?depth=complete", @options))
9
- end
10
-
11
- def all
12
- parse(self.class.get("#{BASE_PATH}/assets/campaigns?depth=complete", @options))
13
- end
14
- end
15
- end
@@ -1,15 +0,0 @@
1
- require 'eloqua_api_service/service'
2
-
3
- module EloquaApiService
4
- class ContactList < Service
5
- BASE_PATH = "/API/REST/1.0"
6
-
7
- def find(id:)
8
- parse(self.class.get("#{BASE_PATH}/assets/contact/list/#{id}?depth=complete", @options))
9
- end
10
-
11
- def all
12
- parse(self.class.get("#{BASE_PATH}/assets/contact/lists?depth=complete", @options))
13
- end
14
- end
15
- end
@@ -1,15 +0,0 @@
1
- require 'eloqua_api_service/service'
2
-
3
- module EloquaApiService
4
- class ContactSegment < Service
5
- BASE_PATH = "/API/REST/1.0"
6
-
7
- def find(id:)
8
- parse(self.class.get("#{BASE_PATH}/assets/contact/segment/#{id}?depth=complete", @options))
9
- end
10
-
11
- def all
12
- parse(self.class.get("#{BASE_PATH}/assets/contact/segments?depth=complete", @options))
13
- end
14
- end
15
- end
@@ -1,19 +0,0 @@
1
- require 'eloqua_api_service/service'
2
-
3
- module EloquaApiService
4
- class CustomObject < Service
5
- BASE_PATH = "/API/REST/1.0"
6
-
7
- def find(id:)
8
- parse(self.class.get("#{BASE_PATH}/assets/customObject/#{id}?depth=complete", @options))
9
- end
10
-
11
- def all
12
- parse(self.class.get("#{BASE_PATH}/assets/customObjects?depth=complete", @options))
13
- end
14
-
15
- def data_by_id(id:)
16
- parse(self.class.get("#{BASE_PATH}/data/customObject/#{id}?depth=complete", @options))
17
- end
18
- end
19
- end
@@ -1,15 +0,0 @@
1
- require 'eloqua_api_service/service'
2
-
3
- module EloquaApiService
4
- class OptionList < Service
5
- BASE_PATH = "/API/REST/1.0"
6
-
7
- def find(id:)
8
- parse(self.class.get("#{BASE_PATH}/assets/optionList/#{id}?depth=complete", @options))
9
- end
10
-
11
- def all
12
- parse(self.class.get("#{BASE_PATH}/assets/optionLists?depth=complete", @options))
13
- end
14
- end
15
- end
@@ -1,19 +0,0 @@
1
- require 'eloqua_api_service/service'
2
-
3
- module EloquaApiService
4
- class Program < Service
5
- BASE_PATH = "/API/REST/1.0"
6
-
7
- def find(id:)
8
- parse(self.class.get("#{BASE_PATH}/assets/program/#{id}?depth=complete", @options))
9
- end
10
-
11
- def all
12
- parse(self.class.get("#{BASE_PATH}/assets/programs?depth=complete", @options))
13
- end
14
-
15
- def find_step(id)
16
- parse(self.class.get("#{BASE_PATH}/assets/program/step/#{id}?depth=Complete", @options))
17
- end
18
- end
19
- end
@@ -1,15 +0,0 @@
1
- require 'eloqua_api_service/service'
2
-
3
- module EloquaApiService
4
- class User < Service
5
- BASE_PATH = "/API/REST/1.0"
6
-
7
- def find(id:)
8
- parse(self.class.get("#{BASE_PATH}/system/user/#{id}?depth=complete", @options))
9
- end
10
-
11
- def all
12
- parse(self.class.get("#{BASE_PATH}/system/users?depth=complete", @options))
13
- end
14
- end
15
- end
@@ -1,29 +0,0 @@
1
- require 'infunnel_cli/cli/base'
2
-
3
- module InfunnelCli
4
- module CLI
5
- class Campaign < Base
6
-
7
- desc "find :id", "Show Campaign with id"
8
- option :account, aliases: :a
9
- option :format, aliases: :f
10
- option :html
11
- def find( id )
12
- EloquaApiService::Campaign.new(account: options[:account]).find(id: id).each do |k, v|
13
- puts "#{k}: #{v}"
14
- end
15
- end
16
-
17
- desc "all", "All Campaigns in current eloqua account"
18
- option :account, aliases: :a
19
- def all
20
- EloquaApiService::Campaign.new(account: options[:account]).all[:elements].each do |program|
21
- puts '-'*90
22
- program.each do |k, v|
23
- puts "#{k}: #{v}"
24
- end
25
- end
26
- end
27
- end
28
- end
29
- end
@@ -1,30 +0,0 @@
1
- require 'infunnel_cli/cli/base'
2
-
3
- module InfunnelCli
4
- module CLI
5
- class ContactList < Base
6
-
7
- desc "find :id", "Show contact list with id"
8
- option :account, aliases: :a
9
- option :format, aliases: :f
10
- option :html
11
- def find( id )
12
- EloquaApiService::ContactList.new(account: options[:account]).find(id: id).each do |k, v|
13
-
14
- puts "#{k}: #{v}"
15
- end
16
- end
17
-
18
- desc "all", "All contact lists in current eloqua account"
19
- option :account, aliases: :a
20
- def all
21
- EloquaApiService::ContactList.new(account: options[:account]).all[:elements].each do |list|
22
- puts '-'*90
23
- list.each do |k, v|
24
- puts "#{k}: #{v}"
25
- end
26
- end
27
- end
28
- end
29
- end
30
- end
@@ -1,30 +0,0 @@
1
- require 'infunnel_cli/cli/base'
2
-
3
- module InfunnelCli
4
- module CLI
5
- class ContactSegment < Base
6
-
7
- desc "find :id", "Show contact segment with id"
8
- option :account, aliases: :a
9
- option :format, aliases: :f
10
- option :html
11
- def find( id )
12
- EloquaApiService::ContactSegment.new(account: options[:account]).find(id: id).each do |k, v|
13
-
14
- puts "#{k}: #{v}"
15
- end
16
- end
17
-
18
- desc "all", "All contact segments in current eloqua account"
19
- option :account, aliases: :a
20
- def all
21
- EloquaApiService::ContactSegment.new(account: options[:account]).all[:elements].each do |segment|
22
- puts '-'*90
23
- segment.each do |k, v|
24
- puts "#{k}: #{v}"
25
- end
26
- end
27
- end
28
- end
29
- end
30
- end
@@ -1,47 +0,0 @@
1
- require 'infunnel_cli/cli/base'
2
-
3
- module InfunnelCli
4
- module CLI
5
- class CustomObject < Base
6
-
7
- desc "find :id", "Show CustomObject with id"
8
- option :account, aliases: :a
9
- option :format, aliases: :f
10
- option :html
11
- def find( id )
12
- EloquaApiService::CustomObject.new(account: options[:account]).find(id: id).each do |k, v|
13
-
14
- puts "#{k}: #{v}"
15
- end
16
- end
17
-
18
- desc "all", "All CustomObjects in current eloqua account"
19
- option :account, aliases: :a
20
- def all
21
- EloquaApiService::CustomObject.new(account: options[:account]).all[:elements].each do |custom_object|
22
- puts '-'*90
23
- custom_object.each do |k, v|
24
- puts "#{k}: #{v}"
25
- end
26
- end
27
- end
28
-
29
- desc "get data by id", "CustomObjects data by id"
30
- option :account, aliases: :a
31
- def data(id)
32
- EloquaApiService::CustomObject.new(account: options[:account]).data_by_id(id: id)[:elements].each do |custom_object|
33
- puts '-'*90
34
- custom_object.each do |k, v|
35
- if k == :fieldValues
36
- v.each do |_k, _v|
37
- puts "#{_k}: #{_v}"
38
- end
39
- else
40
- puts "#{k}: #{v}"
41
- end
42
- end
43
- end
44
- end
45
- end
46
- end
47
- end
@@ -1,41 +0,0 @@
1
- require 'infunnel_cli/cli/base'
2
-
3
- module InfunnelCli
4
- module CLI
5
- class OptionList < Base
6
-
7
- desc "find :id", "Sow option list with id"
8
- option :account, aliases: :a
9
- option :format, aliases: :f
10
- option :html
11
- def find( id )
12
- ol = EloquaApiService::OptionList.new(account: options[:account]).find(id: id)
13
-
14
- if options[:format]
15
- ol[:elements].each do |f|
16
- puts "#{f[:displayName]}|#{f[:value]}"
17
- end
18
- elsif options[:html]
19
- puts "<select name='#{ol[:name]}'>"
20
- ol[:elements].each do |f|
21
- puts "<option value='#{f[:value]}'>#{f[:displayName]}</option>"
22
- end
23
- puts "</select>"
24
- else
25
- puts ol
26
- end
27
- end
28
-
29
- desc "all", "All option lists in current eloqua account"
30
- option :account, aliases: :a
31
- def all
32
- EloquaApiService::OptionList.new(account: options[:account]).all[:elements].each do |ol|
33
- puts '-' * 90
34
- ol.each do |k, v|
35
- puts "#{k}: #{v}"
36
- end
37
- end
38
- end
39
- end
40
- end
41
- end
@@ -1,46 +0,0 @@
1
- require 'infunnel_cli/cli/base'
2
-
3
- module InfunnelCli
4
- module CLI
5
- class Program < Base
6
-
7
- desc "find :id", "Show program with id"
8
- option :account, aliases: :a
9
- option :format, aliases: :f
10
- option :html
11
- def find( id )
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}"
21
- end
22
- end
23
- end
24
-
25
- desc "all", "All programs in current eloqua account"
26
- option :account, aliases: :a
27
- def all
28
- EloquaApiService::Program.new(account: options[:account]).all[:elements].each do |program|
29
- puts '-'*90
30
- program.each do |k, v|
31
- puts "#{black on_white k}: #{v}"
32
- end
33
- end
34
- end
35
-
36
- desc "find_sted", "Find a program step by id"
37
- option :account, aliases: :a
38
- def find_step(id)
39
- puts '-'*90
40
- EloquaApiService::Program.new(account: options[:account]).find_step(id).each do |k, v|
41
- puts "#{k}: #{v}"
42
- end
43
- end
44
- end
45
- end
46
- end
@@ -1,30 +0,0 @@
1
- require 'infunnel_cli/cli/base'
2
-
3
- module InfunnelCli
4
- module CLI
5
- class User < Base
6
-
7
- desc "find :id", "Show user with id"
8
- option :account, aliases: :a
9
- option :format, aliases: :f
10
- option :html
11
- def find( id )
12
- EloquaApiService::User.new(account: options[:account]).find(id: id).each do |k, v|
13
-
14
- puts "#{k}: #{format_value(k,v)}"
15
- end
16
- end
17
-
18
- desc "all", "All users in current eloqua account"
19
- option :account, aliases: :a
20
- def all
21
- EloquaApiService::User.new(account: options[:account]).all[:elements].each do |user|
22
- puts '-'*90
23
- user.each do |k, v|
24
- puts "#{k}: #{format_value(k,v)}"
25
- end
26
- end
27
- end
28
- end
29
- end
30
- end