memotoo 2.0.1 → 2.0.2

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.
@@ -108,6 +108,16 @@ dateEnd:: "2011-01-01", Format: YYYY-MM-DD
108
108
  Task and Event::
109
109
  dateBegin:: "2011-06-18T10:00:00", Format: YYYY-MM-DDTHH:II:SS - ISO8601 time format GMT
110
110
  dateEnd:: "2011-06-18T10:00:00", Format: YYYY-MM-DDTHH:II:SS - ISO8601 time format GMT
111
+
112
+ ==Logging
113
+
114
+ Enable/Disable Savon and HTTPI - Logging
115
+
116
+ @connect=Memotoo.new(username, password, https=true, log=false, requestlog=true)
117
+
118
+ log = Savon logging on/off
119
+
120
+ requestlog = HTTPI loggin on/off
111
121
 
112
122
  ==Testing
113
123
 
@@ -135,6 +145,10 @@ and memotoo api-documentation
135
145
 
136
146
  https://www.memotoo.com/index.php?rub=api#SOAP-server.php
137
147
 
148
+ == Changelog V. 2.0.2
149
+
150
+ Easy configuring logging options
151
+
138
152
  == Changelog V. 2.0.1
139
153
 
140
154
  some code refactoring and support for ruby >=1.9.2
data/VERSION CHANGED
@@ -1 +1 @@
1
- 2.0.1
1
+ 2.0.2
@@ -23,35 +23,54 @@ class Memotoo
23
23
  :task => [:title]}
24
24
 
25
25
  #[https] default:true for the SOAP service. Use false to use http-connection
26
+ #[log] default:false - set to true to see savons logging
27
+ #[requeslog] default:false - set to
26
28
  # example:(use https)
27
29
  # @connect=Memotoo::Connect.new("myusername","mypassword")
28
30
  # example:(use http)
29
31
  # @connect=Memotoo::Connect.new("myusername","mypassword", false)
30
- def initialize(username, password, https=true)
32
+ # example:(set loggin on and http-request-logging off)
33
+ # @connect=Memotoo::Connect.new("myusername","mypassword", true, true, false)
34
+ def initialize(username, password, https=true, log=false, requestlog=true)
31
35
 
32
- # we will need it for every request - will be merged in
36
+ # need it for every request - will be merged in
33
37
  self.opts= { :param => { :login => username, :password => password}}
34
38
 
39
+ # set savon logging and erros
40
+ Savon.configure do |config|
41
+ config.raise_errors = true # raise SOAP faults and HTTP errors
42
+ config.log = log # enable/disable logging
43
+ config.log_level = :debug # changing the log level
44
+ end
45
+
46
+ HTTPI.log=requestlog
47
+
35
48
  # build dynamically all methods - some magic :-)
36
49
  make_methods
37
50
 
38
51
  # creates client with memotoo settings
39
52
  client(https)
40
53
  end
41
- end
42
-
43
- # stop savon logging
44
-
45
- module Savon # :nodoc: all
46
- module Global
47
- def log?
48
- false
49
- end
50
- def raise_errors?
51
- @raise_errors = true
54
+
55
+ # Creates the <tt>Savon::Client</tt>.
56
+ def client(https=true)
57
+ #--
58
+ # in any case problems switch back to receiving the wsdl file from memotoo
59
+ # https: wsdl.document = "https://www.memotoo.com/SOAP-server.php?wsdl"
60
+ # http: wsdl.document = "http://www.memotoo.com/SOAP-server.php?wsdl"
61
+ #++
62
+ @client ||= Savon::Client.new do
63
+ wsdl.namespace="urn:memotooSoap"
64
+ if https
65
+ wsdl.endpoint="https://www.memotoo.com/SOAP-server.php"
66
+ http.auth.ssl.verify_mode = :none
67
+ else
68
+ wsdl.endpoint="http://www.memotoo.com/SOAP-server.php"
69
+ end
70
+ http.auth.basic self.opts[:param][:login], self.opts[:param][:password]
71
+ end
52
72
  end
53
-
54
- end
73
+
55
74
  end
56
75
 
57
76
  #Finished in 41.165241 seconds.
@@ -1,26 +1,6 @@
1
1
  class Memotoo
2
-
3
- private
4
-
5
- # Creates the <tt>Savon::Client</tt>.
6
- def client(https=true)
7
- #--
8
- # in any case problems switch back to receiving the wsdl file from memotoo
9
- # https: wsdl.document = "https://www.memotoo.com/SOAP-server.php?wsdl"
10
- # http: wsdl.document = "http://www.memotoo.com/SOAP-server.php?wsdl"
11
- #++
12
-
13
- @client ||= Savon::Client.new do
14
- wsdl.namespace="urn:memotooSoap"
15
- if https
16
- wsdl.endpoint="https://www.memotoo.com/SOAP-server.php"
17
- http.auth.ssl.verify_mode = :none
18
- else
19
- wsdl.endpoint="http://www.memotoo.com/SOAP-server.php"
20
- end
21
- http.auth.basic self.opts[:param][:login], self.opts[:param][:password]
22
- end
23
- end
2
+
3
+ private
24
4
 
25
5
  def selfclass
26
6
  (class << self; self; end)
@@ -5,7 +5,7 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{memotoo}
8
- s.version = "2.0.1"
8
+ s.version = "2.0.2"
9
9
 
10
10
  s.required_rubygems_version = Gem::Requirement.new(">= 0") if s.respond_to? :required_rubygems_version=
11
11
  s.authors = ["Karsten Redmer"]
@@ -5,7 +5,7 @@ class TestMemotoo < Test::Unit::TestCase
5
5
  context "Memotoo-Soap Api basic tests" do
6
6
 
7
7
  setup do
8
- @connect=Memotoo.new(MEMOTOO_USERNAME,MEMOTOO_PASSWORD,false)
8
+ @connect=Memotoo.new(MEMOTOO_USERNAME,MEMOTOO_PASSWORD, true, false, false)
9
9
  end
10
10
 
11
11
  should "have a connect-instance" do
@@ -13,7 +13,7 @@ class TestMemotoo < Test::Unit::TestCase
13
13
  end
14
14
 
15
15
  should "write a message if username/password is not correct" do
16
- @connect=Memotoo.new(MEMOTOO_USERNAME,"wrongpasswd")
16
+ @connect=Memotoo.new(MEMOTOO_USERNAME,"wrongpasswd", true, false, false)
17
17
  assert_raises ArgumentError do
18
18
  response = @connect.searchContact(TESTSEARCHDEFAULTS)
19
19
  end
@@ -26,7 +26,7 @@ class TestMemotoo < Test::Unit::TestCase
26
26
 
27
27
 
28
28
  should "also use http request instead of https" do
29
- @connect=Memotoo.new(MEMOTOO_USERNAME,MEMOTOO_PASSWORD, false)
29
+ @connect=Memotoo.new(MEMOTOO_USERNAME,MEMOTOO_PASSWORD, false, false, false)
30
30
  response = @connect.searchContact(TESTSEARCHDEFAULTS)
31
31
  assert_not_nil response
32
32
  end
@@ -35,27 +35,6 @@ class TestMemotoo < Test::Unit::TestCase
35
35
 
36
36
  end
37
37
 
38
-
39
- # uncomment this if you want to see everything in log what happens...it's a lot
40
- #module Savon
41
- # module Global
42
- # def log?
43
- # true
44
- # end
45
- #
46
- # end
47
- #end
48
-
49
- # comment this to see http requests logged
50
- module HTTPI
51
- class << self
52
- def log?
53
- @log = false
54
- end
55
- end
56
- end
57
-
58
-
59
38
  ################## rcov-result ######################
60
39
 
61
40
  #Generated on Wed Jun 08 22:39:46 +0200 2011 with rcov 0.9.8
@@ -43,7 +43,7 @@ soapobjects.each do |soapobject|
43
43
  context "what we could do with #{soapobject}'s" do
44
44
 
45
45
  setup do
46
- @connect=Memotoo.new(MEMOTOO_USERNAME,MEMOTOO_PASSWORD, false)
46
+ @connect=Memotoo.new(MEMOTOO_USERNAME,MEMOTOO_PASSWORD, true, false, false)
47
47
  end
48
48
 
49
49
  context "Adding and finding #{soapobject}" do
metadata CHANGED
@@ -1,13 +1,13 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: memotoo
3
3
  version: !ruby/object:Gem::Version
4
- hash: 13
4
+ hash: 11
5
5
  prerelease:
6
6
  segments:
7
7
  - 2
8
8
  - 0
9
- - 1
10
- version: 2.0.1
9
+ - 2
10
+ version: 2.0.2
11
11
  platform: ruby
12
12
  authors:
13
13
  - Karsten Redmer