vtiger 0.5.8 → 0.6.0

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.
data/bin/add_contact.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env jruby -S
2
+ usage=<<EOF_USAGE
2
3
  # == Synopsis
3
4
  # Add a contact to vtiger
4
5
  # == Usage
@@ -11,18 +12,18 @@
11
12
  # == Copyright
12
13
  # Copyright (c) 2007 Ficonab Pte. Ltd.
13
14
  # See license for license details
15
+ EOF_USAGE
14
16
  require 'yaml'
15
17
  require 'rubygems'
16
18
  gem 'vtiger'
17
19
  require 'vtiger'
18
20
  require 'optparse'
19
- require 'rdoc/usage'
20
21
  require 'java' if RUBY_PLATFORM =~ /java/
21
22
 
22
23
 
23
24
 
24
25
  arg_hash=Vtiger::Options.parse_options(ARGV)
25
- RDoc::usage if arg_hash[:help]==true
26
+ Vtiger::Options.show_usage_exit(usage) if arg_hash[:help]==true
26
27
  require 'pp'
27
28
  options = arg_hash
28
29
  # set up variables using hash
data/bin/add_lead.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/ruby
2
+ usage=<<EOF_USAGE
2
3
  # == Synopsis
3
4
  # Add a contact to vtiger
4
5
  # == Usage
@@ -11,18 +12,18 @@
11
12
  # == Copyright
12
13
  # Copyright (c) 2007 Ficonab Pte. Ltd.
13
14
  # See license for license details
15
+ EOF_USAGE
14
16
  require 'yaml'
15
17
  require 'rubygems'
16
18
  gem 'vtiger'
17
19
  require 'vtiger'
18
20
  require 'optparse'
19
- require 'rdoc/usage'
20
21
  require 'java' if RUBY_PLATFORM =~ /java/
21
22
 
22
23
  #testing of chagnes
23
24
 
24
25
  arg_hash=Vtiger::Options.parse_options(ARGV)
25
- RDoc::usage if arg_hash[:help]==true
26
+ Vtiger::Options.show_usage_exit(usage) if arg_hash[:help]==true
26
27
  require 'pp'
27
28
  options = arg_hash
28
29
  # set up variables using hash
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/ruby
2
+ usage=<<EOF_USAGE
2
3
  # == Synopsis
3
4
  # Add a contact to vtiger
4
5
  # == Usage
@@ -11,18 +12,18 @@
11
12
  # == Copyright
12
13
  # Copyright (c) 2007 Ficonab Pte. Ltd.
13
14
  # See license for license details
15
+ EOF_USAGE
14
16
  require 'yaml'
15
17
  require 'rubygems'
16
18
  gem 'vtiger'
17
19
  require 'vtiger'
18
20
  require 'optparse'
19
- require 'rdoc/usage'
20
21
  require 'java' if RUBY_PLATFORM =~ /java/
21
22
 
22
23
  #testing of chagnes
23
24
 
24
25
  arg_hash=Vtiger::Options.parse_options(ARGV)
25
- RDoc::usage if arg_hash[:help]==true
26
+ Vtiger::Options.show_usage_exit(usage) if arg_hash[:help]==true
26
27
  require 'pp'
27
28
  options = arg_hash
28
29
  # set up variables using hash
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env jruby -S
2
+ usage=<<EOF_USAGE
2
3
  # == Synopsis
3
4
  # Describe objects on vtiger server. Use the list_types command to get access to all the types
4
5
  # == Usage
@@ -14,18 +15,18 @@
14
15
  # == Copyright
15
16
  # Copyright (c) 2007 Ficonab Pte. Ltd.
16
17
  # See license for license details
18
+ EOF_USAGE
17
19
  require 'yaml'
18
20
  require 'rubygems'
19
21
  gem 'vtiger'
20
22
  require 'vtiger'
21
23
  require 'optparse'
22
- require 'rdoc/usage'
23
24
  require 'java' if RUBY_PLATFORM =~ /java/
24
25
 
25
26
 
26
27
 
27
28
  arg_hash=Vtiger::Options.parse_options(ARGV)
28
- RDoc::usage if arg_hash[:help]==true
29
+ Vtiger::Options.show_usage_exit(usage) if arg_hash[:help]==true
29
30
  require 'pp'
30
31
  options = arg_hash
31
32
  # set up variables using hash
data/bin/list_types.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env jruby -S
2
+ usage=<<EOF_USAGE
2
3
  # == Synopsis
3
4
  # List the types on the vtiger server
4
5
  # == Usage
@@ -11,18 +12,18 @@
11
12
  # == Copyright
12
13
  # Copyright (c) 2007 Ficonab Pte. Ltd.
13
14
  # See license for license details
15
+ EOF_USAGE
14
16
  require 'yaml'
15
17
  require 'rubygems'
16
18
  gem 'vtiger'
17
19
  require 'vtiger'
18
20
  require 'optparse'
19
- require 'rdoc/usage'
20
21
  require 'java' if RUBY_PLATFORM =~ /java/
21
22
 
22
23
 
23
24
 
24
25
  arg_hash=Vtiger::Options.parse_options(ARGV)
25
- RDoc::usage if arg_hash[:help]==true
26
+ Vtiger::Options.show_usage_exit(usage) if arg_hash[:help]==true
26
27
  require 'pp'
27
28
  options = arg_hash
28
29
  # set up variables using hash
data/bin/query.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env jruby -S
2
+ usage=<<EOF_USAGE
2
3
  # == Synopsis
3
4
  # Query the vtiger server
4
5
  # == Usage
@@ -11,18 +12,18 @@
11
12
  # == Copyright
12
13
  # Copyright (c) 2007 Ficonab Pte. Ltd.
13
14
  # See license for license details
15
+ EOF_USAGE
14
16
  require 'yaml'
15
17
  require 'rubygems'
16
18
  gem 'vtiger'
17
19
  require 'vtiger'
18
20
  require 'optparse'
19
- require 'rdoc/usage'
20
21
  require 'java' if RUBY_PLATFORM =~ /java/
21
22
 
22
23
 
23
24
 
24
25
  arg_hash=Vtiger::Options.parse_options(ARGV)
25
- RDoc::usage if arg_hash[:help]==true
26
+ Vtiger::Options.show_usage_exit(usage) if arg_hash[:help]==true
26
27
  require 'pp'
27
28
  options = arg_hash
28
29
  # set up variables using hash
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env jruby -S
2
+ usage=<<EOF_USAGE
2
3
  # == Synopsis
3
4
  # Update stock for give product
4
5
  # == Usage
@@ -11,19 +12,19 @@
11
12
  # == Copyright
12
13
  # Copyright (c) 2007 Ficonab Pte. Ltd.
13
14
  # See license for license details
15
+ EOF_USAGE
14
16
  require 'yaml'
15
17
  require 'rubygems'
16
18
  gem 'vtiger'
17
19
  require 'vtiger'
18
20
  require 'optparse'
19
- require 'rdoc/usage'
20
21
  require 'java' if RUBY_PLATFORM =~ /java/
21
22
 
22
23
 
23
24
 
24
25
  arg_hash=Vtiger::Options.parse_options(ARGV)
25
- RDoc::usage if arg_hash[:help]==true
26
- require 'pp'
26
+ Vtiger::Options.show_usage_exit(usage) if arg_hash[:help]==true
27
+ require 'pp'
27
28
  options = arg_hash
28
29
  # set up variables using hash
29
30
 
data/bin/yahoo_csv.rb CHANGED
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env jruby -S
2
+ usage=<<EOF_USAGE
2
3
  # == Synopsis
3
4
  # Update accounts or accounts based on yahoo statistics
4
5
  # == Usage
@@ -10,15 +11,15 @@
10
11
  # == Copyright
11
12
  # Copyright (c) 2009 Ficonab Pte. Ltd.
12
13
  # See license for license details
14
+ EOF_USAGE
13
15
  require 'yaml'
14
16
  require 'rubygems'
15
17
  gem 'vtiger'
16
18
  require 'vtiger'
17
19
  require 'optparse'
18
- require 'rdoc/usage'
19
20
  require 'java' if RUBY_PLATFORM =~ /java/
20
21
  arg_hash=Vtiger::Options.parse_options(ARGV)
21
- RDoc::usage if arg_hash[:help]==true
22
+ Vtiger::Options.show_usage_exit(usage) if arg_hash[:help]==true
22
23
  require 'pp'
23
24
  options = arg_hash
24
25
  # set up variables using hash
@@ -41,6 +41,20 @@ module Vtiger
41
41
  # 'tsipid'=>"1234"
42
42
  add_object(object_map,hashv,'HelpDesk')
43
43
  end
44
+ def add_email(options,status,title,hashv)
45
+ puts "in add email ticket NOT COMPLETE"
46
+ object_map= { 'assigned_user_id'=>"#{self.userid}",'ticketstatus'=>"#{status}", 'ticket_title'=>"#{title}"}
47
+ object_map=object_map.merge hashv
48
+ # 'tsipid'=>"1234"
49
+ add_object(object_map,hashv,'Emails')
50
+ end
51
+ def add_document(options,status,title,hashv)
52
+ puts "in add document NOT COMPLETE"
53
+ object_map= { 'assigned_user_id'=>"#{self.userid}",'ticketstatus'=>"#{status}", 'ticket_title'=>"#{title}"}
54
+ object_map=object_map.merge hashv
55
+ # 'tsipid'=>"1234"
56
+ add_object(object_map,hashv,'Documents')
57
+ end
44
58
  def action(options)
45
59
  puts "in action"
46
60
  end
@@ -159,10 +173,7 @@ module Vtiger
159
173
  res = http_ask_get(self.endpoint_url+"operation=query&sessionName=#{self.session_name}&query="+action_string)
160
174
  puts "TT RES: #{res["result"]} class: #{res["result"].class}"
161
175
  values=res["result"] if res["success"]==true #comes back as array
162
- #puts values.inspect
163
- # return the account id
164
- # ticketlist=[]
165
- # values.each {|v| ticketlist << v['ticket_no'] }
176
+
166
177
  return res["success"],values
167
178
 
168
179
  end
@@ -175,15 +186,12 @@ module Vtiger
175
186
  queryparams=",#{extraparam}" if extraparam!=nil
176
187
  t=Time.parse(date)
177
188
  y=t.strftime('%Y-%m-%d')
178
- action_string=ERB::Util.url_encode("select id,#{key}#{queryparams} from #{element} where createdtime like '#{y}%' and #{key} LIKE '2%';")
189
+ action_string=ERB::Util.url_encode("select id,#{key}#{queryparams} from #{element} where createdtime like '#{y}%' and #{key} LIKE '2%' and emailoptout=0;")
179
190
  puts "action string:" +action_string
180
191
  res = http_ask_get(self.endpoint_url+"operation=query&sessionName=#{self.session_name}&query="+action_string)
181
192
  puts "TT RES: #{res["result"]} class: #{res["result"].class}"
182
193
  values=res["result"] if res["success"]==true #comes back as array
183
- #puts values.inspect
184
- # return the account id
185
- # ticketlist=[]
186
- # values.each {|v| ticketlist << v['ticket_no'] }
194
+
187
195
  return res["success"],values
188
196
 
189
197
  end
@@ -197,24 +205,20 @@ module Vtiger
197
205
  queryparams=",#{extraparam}" if extraparam!=nil
198
206
  t=Time.parse(date)
199
207
  y=t.strftime('%Y-%m-%d')
200
- #puts "select id,#{key}#{queryparams} from #{element} where createdtime like '#{y}%' and #{key} LIKE '%';"
201
- # action_string=ERB::Util.url_encode("select id,#{key}#{queryparams} from #{element} where createdtime like '#{y}%' and #{key} NOT LIKE '%2011';")
202
- action_string=ERB::Util.url_encode("select id,#{key}#{queryparams} from #{element} where createdtime like '#{y}%' and #{key} < '0';")
208
+
209
+ action_string=ERB::Util.url_encode("select id,#{key}#{queryparams} from #{element} where createdtime like '#{y}%' and #{key} < '0' and emailoptout=0;")
203
210
  puts "action string:" +action_string
204
211
  res = http_ask_get(self.endpoint_url+"operation=query&sessionName=#{self.session_name}&query="+action_string)
205
212
  puts "TT RES: #{res["result"]} class: #{res["result"].class}"
206
213
  values=res["result"] if res["success"]==true #comes back as array
207
- #puts values.inspect
208
- # return the account id
209
- # ticketlist=[]
210
- # values.each {|v| ticketlist << v['ticket_no'] }
214
+
211
215
  return res["success"],values
212
216
 
213
217
  end
214
218
  def get_campaigns
215
219
  puts "in get campaigns"
216
220
  action_string=ERB::Util.url_encode("select id,campaignname from Campaigns;")
217
- # puts "action string:" +action_string
221
+
218
222
  res = http_ask_get(self.endpoint_url+"operation=query&sessionName=#{self.session_name}&query="+action_string)
219
223
  # puts "TT RES: #{res["result"]} class: #{res["result"].class}"
220
224
  values=res["result"] if res["success"]==true #comes back as array
@@ -55,8 +55,8 @@ module Vtiger
55
55
  puts "username #{val}" }
56
56
  opts.on("-f","--filename VAL", String) {|val| temp_hash[:filename ] = val
57
57
  puts "filename #{val}" }
58
- opts.on("-d","--debug", "turn on debug") { |val| temp_hash[:debug ] = true }
59
-
58
+ opts.on_tail("-h","--help", "get help message") { |val| temp_hash[:help ] = true
59
+ puts opts }
60
60
 
61
61
  opts.parse(params)
62
62
  # puts " in HTTP #{hostname} port #{port} url: #{url}"
@@ -64,37 +64,14 @@ module Vtiger
64
64
  return temp_hash
65
65
 
66
66
  end # parse options
67
+ def self.show_usage_exit(usage)
68
+ # usage=usage.gsub(/^\s*#/,'')
69
+ puts usage
70
+ exit
71
+ end
67
72
  end #class
68
73
  # help build xml commands from messages
69
74
 
70
75
  end #module
71
76
 
72
- def RDoc.usage_no_exit(*args)
73
- # main_program_file = caller[1].sub(/:\d+$/, '')
74
- main_program_file = caller[1].split(':')[0]
75
- #puts "main program is #{main_program_file}"
76
- # puts " caller is #{caller.inspect}"
77
- comment = File.open(main_program_file) do |file|
78
- find_comment(file)
79
- end
80
-
81
- comment = comment.gsub(/^\s*#/, '')
82
-
83
- markup = SM::SimpleMarkup.new
84
- flow_convertor = SM::ToFlow.new
85
-
86
- flow = markup.convert(comment, flow_convertor)
87
-
88
- format = "plain"
89
-
90
- unless args.empty?
91
- flow = extract_sections(flow, args)
92
- end
93
-
94
- options = RI::Options.instance
95
- if args = ENV["RI"]
96
- options.parse(args.split)
97
- end
98
- formatter = options.formatter.new(options, "")
99
- formatter.display_flow(flow)
100
- end
77
+
@@ -0,0 +1,37 @@
1
+ require File.dirname(__FILE__) + '/test_helper.rb'
2
+
3
+ class TestVtiger < Test::Unit::TestCase
4
+
5
+ def setup
6
+ @options={}
7
+ @options[:url]='vtiger.philweb.com.ph'
8
+ @options[:key]='QnvHuPp0yfMvOAkZ'
9
+ @options[:username]="webservices"
10
+
11
+ end
12
+
13
+ def test_login
14
+ cmd = Vtiger::Commands.new()
15
+ challenge=cmd.challenge(@options)
16
+ login=cmd.login(@options)
17
+ assert challenge,"challenge is false"
18
+ assert login,"login is false"
19
+ end
20
+
21
+
22
+ def test_add_trouble_ticket
23
+ cmd = Vtiger::Commands.new()
24
+ challenge=cmd.challenge(@options)
25
+ puts "challenge is: #{challenge}"
26
+ login=cmd.login(@options)
27
+ puts "login is #{login}"
28
+ hv={'cf_878' => 'webservices'}
29
+ # hv[:firstname]='test'
30
+ tt,ticketnum=cmd.add_trouble_ticket(@options,"Open","testing title",hv)
31
+
32
+ puts "trouble ticket is #{tt} ticket number is #{ticketnum}"
33
+ assert challenge,"challenge is false "
34
+ assert login,"login should succeed"
35
+ assert tt,"trouble ticket should succeed"
36
+ end
37
+ end
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vtiger
3
3
  version: !ruby/object:Gem::Version
4
- hash: 27
5
- prerelease: false
4
+ hash: 7
5
+ prerelease:
6
6
  segments:
7
7
  - 0
8
- - 5
9
- - 8
10
- version: 0.5.8
8
+ - 6
9
+ - 0
10
+ version: 0.6.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Scott Sproule
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-02-09 00:00:00 +08:00
18
+ date: 2011-03-03 00:00:00 +08:00
19
19
  default_executable:
20
20
  dependencies: []
21
21
 
@@ -40,6 +40,7 @@ files:
40
40
  - lib/vtiger/support.rb
41
41
  - lib/vtiger.rb
42
42
  - test/test_helper.rb
43
+ - test/test_philweb.rb
43
44
  - test/test_secret.rb
44
45
  - test/test_vtiger.rb
45
46
  - bin/add_contact.rb
@@ -89,7 +90,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
89
90
  requirements: []
90
91
 
91
92
  rubyforge_project: vtiger
92
- rubygems_version: 1.3.7
93
+ rubygems_version: 1.6.0
93
94
  signing_key:
94
95
  specification_version: 3
95
96
  summary: Vtiger web service support via ruby