memotoo 1.0.6 → 2.0.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -5,12 +5,21 @@
5
5
 
6
6
  Gem::Specification.new do |s|
7
7
  s.name = %q{memotoo}
8
- s.version = "1.0.6"
8
+ s.version = "2.0.0"
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"]
12
- s.date = %q{2011-06-08}
13
- s.description = %q{Unofficial gem for connecting to memotoo.com with their soap-api and handle your contact needs. Memotoo lets your synchronize all your contacts, events and tasks with yahoo, gmail, facebook, xing, outlook, your mobile-phone and more. You can also get your e-mails in one place.}
12
+ s.date = %q{2011-06-12}
13
+ s.description = %q{Unofficial gem for connecting to memotoo.com with their soap-api and handle your contact needs. Memotoo lets your synchronize all your contacts, events and tasks with yahoo, gmail, facebook, xing, outlook, your mobile-phone and more. You can also get your e-mails in one place.Features of memotoo:
14
+ New mobile? Transfer all your data to your new device!
15
+ Synchronise your data with your mobile phone (with SyncML)
16
+ Access all your e-mail in a single page from Google, Yahoo, Hotmail / MSN, ...!
17
+ View your data on your mobile phone (WAP / XHTML)
18
+ Access your contacts using a LDAP directory
19
+ Access your files via a Web Folder
20
+ Access your files via FTP
21
+ Add Memotoo widgets to iGoogle, Netvibes, Windows Vista, Apple Dashboard, ...
22
+ Memotoo plugins for your browser}
14
23
  s.email = %q{k.redmer@yahoo.de}
15
24
  s.extra_rdoc_files = [
16
25
  "LICENSE.txt",
@@ -19,7 +28,6 @@ Gem::Specification.new do |s|
19
28
  s.files = [
20
29
  ".document",
21
30
  ".gemtest",
22
- ".rvmrc-old",
23
31
  "Gemfile",
24
32
  "Gemfile.lock",
25
33
  "LICENSE.txt",
@@ -27,20 +35,13 @@ Gem::Specification.new do |s|
27
35
  "Rakefile",
28
36
  "VERSION",
29
37
  "lib/memotoo.rb",
30
- "lib/memotoo/bookmark/bookmark.rb",
31
- "lib/memotoo/connect.rb",
32
- "lib/memotoo/contact/contact.rb",
33
- "lib/memotoo/contact/contact_group.rb",
34
38
  "lib/memotoo/core-ext/hash.rb",
35
39
  "lib/memotoo/core-ext/kernel.rb",
36
- "lib/memotoo/wsdl/http.xml",
37
- "lib/memotoo/wsdl/https.xml",
40
+ "lib/memotoo/main.rb",
38
41
  "memotoo.gemspec",
39
42
  "test/helper.rb",
40
- "test/test_bookmark.rb",
41
- "test/test_contact.rb",
42
- "test/test_contact_group.rb",
43
- "test/test_memotoo.rb"
43
+ "test/test_memotoo.rb",
44
+ "test/test_soapobjects.rb"
44
45
  ]
45
46
  s.homepage = %q{http://github.com/kredmer/memotoo}
46
47
  s.licenses = ["MIT"]
@@ -49,10 +50,8 @@ Gem::Specification.new do |s|
49
50
  s.summary = %q{Unofficial gem for connecting to memotoo.com with their given soap-api}
50
51
  s.test_files = [
51
52
  "test/helper.rb",
52
- "test/test_bookmark.rb",
53
- "test/test_contact.rb",
54
- "test/test_contact_group.rb",
55
- "test/test_memotoo.rb"
53
+ "test/test_memotoo.rb",
54
+ "test/test_soapobjects.rb"
56
55
  ]
57
56
 
58
57
  if s.respond_to? :specification_version then
@@ -1,23 +1,21 @@
1
1
  require 'helper'
2
2
 
3
-
4
3
  class TestMemotoo < Test::Unit::TestCase
5
4
 
6
5
  context "Memotoo-Soap Api basic tests" do
7
6
 
8
7
  setup do
9
- @connect=Memotoo::Connect.new(MEMOTOO_USERNAME,MEMOTOO_PASSWORD)
8
+ @connect=Memotoo.new(MEMOTOO_USERNAME,MEMOTOO_PASSWORD)
10
9
  end
11
10
 
12
11
  should "have a connect-instance" do
13
- assert_equal Memotoo::Connect, @connect.class
12
+ assert_equal Memotoo, @connect.class
14
13
  end
15
14
 
16
15
  should "write a message if username/password is not correct" do
17
- @connect=Memotoo::Connect.new(MEMOTOO_USERNAME,"wrongpasswd")
18
- response = @connect.searchContact(TESTSEARCHDEFAULTS)
19
- assert_raise RuntimeError do
20
- raise 'Boom!!!'
16
+ @connect=Memotoo.new(MEMOTOO_USERNAME,"wrongpasswd")
17
+ assert_raises ArgumentError do
18
+ response = @connect.searchContact(TESTSEARCHDEFAULTS)
21
19
  end
22
20
  end
23
21
 
@@ -28,7 +26,7 @@ class TestMemotoo < Test::Unit::TestCase
28
26
 
29
27
 
30
28
  should "also use http request instead of https" do
31
- @connect=Memotoo::Connect.new(MEMOTOO_USERNAME,MEMOTOO_PASSWORD, false)
29
+ @connect=Memotoo.new(MEMOTOO_USERNAME,MEMOTOO_PASSWORD, false)
32
30
  response = @connect.searchContact(TESTSEARCHDEFAULTS)
33
31
  assert_not_nil response
34
32
  end
@@ -0,0 +1,123 @@
1
+ require 'helper'
2
+
3
+ class TestMemotoo < Test::Unit::TestCase
4
+
5
+ # api-problem in: BookmarkFolder, Holiday -> reportet to Thomas Pequet on 12.July 2011
6
+
7
+ # uncomment this to test all soapobjects
8
+ soapobjects = %w{Contact}
9
+ #soapobjects = %w{Contact ContactGroup Bookmark Note CalendarCategory Event Task}
10
+
11
+
12
+
13
+
14
+ fixure = { :contact => { :new => {:lastname => "Testcontact123456"},
15
+ :mod => {:lastname => "Testcontact123456xyz"}},
16
+ :contact_group => { :new=>{:name => "TestcontactGroup123456"},
17
+ :mod => {:name => "TestcontactGroup123456xyz"}},
18
+ :bookmark => { :new=>{:url => "Testbookmark.com"},
19
+ :mod => {:url => "Testbookmark123.com"}},
20
+ :bookmark_folder => {:new=>{:name => "Testbookmarkfolder123456"},
21
+ :mod => {:name => "Testbookmarkfolder123456xyz"}},
22
+ :note => { :new => {:description => "TestNote12345"},
23
+ :mod => {:description => "TestNote12345xyz"}},
24
+ :calendar_category => {:new=>{:name => "TestCalendarCategory123456"},
25
+ :mod => {:name => "TestCalendarCategory123456xyz"}},
26
+ :event => { :new => {:title=> "Testevent1234", :dateBegin=>"2011-06-12T10:00:00", :dateEnd=>"2011-06-12T15:00:00"},
27
+ :mod => {:title=> "Testevent1234xyz", :dateBegin=>"2011-06-12T10:00:00", :dateEnd=>"2011-06-12T15:00:00"}},
28
+ :holiday => {:new => {:description=> "Testholiday1234", :dateBegin=>"2011-07-12", :dateEnd=>"2011-07-20"},
29
+ :mod => {:description=> "Testholiday1234xyz", :dateBegin=>"2011-07-12", :dateEnd=>"2011-07-20"}},
30
+ :task => { :new => {:title=> "Testtask1234"},
31
+ :mod => {:title=> "Testtask1234xyz"}} }
32
+
33
+ needs = Memotoo::NEEDS
34
+
35
+ soapobjects.each do |soapobject|
36
+ symbol=soapobject.underscore.to_sym
37
+ objectfixure = fixure[symbol][:new][needs[symbol][0]]
38
+ addmethod=("add"+soapobject).to_sym
39
+ searchmethod=("search"+soapobject).to_sym
40
+ getmethod=("get"+soapobject).to_sym
41
+ getsyncmethod=("get"+soapobject+"Sync").to_sym
42
+ modifymethod=("modify"+soapobject).to_sym
43
+ deletemethod=("delete"+soapobject).to_sym
44
+
45
+
46
+ context "what we could do with #{soapobject}'s" do
47
+
48
+ setup do
49
+ @connect=Memotoo.new(MEMOTOO_USERNAME,MEMOTOO_PASSWORD, false)
50
+ end
51
+
52
+ context "Adding and finding #{soapobject}" do
53
+
54
+ should "add a new #{soapobject}" do
55
+ response= @connect.send(addmethod,fixure[symbol][:new])
56
+ assert_not_nil response
57
+ end
58
+
59
+ should "add a new #{soapobject} (and look for needed params)" do
60
+ assert_raises ArgumentError do
61
+ response = @connect.send(addmethod,{})
62
+ end
63
+ end
64
+
65
+ should "find the #{soapobject}" do
66
+ response = @connect.send(searchmethod,{:search => objectfixure})
67
+ assert_not_nil response
68
+ end
69
+
70
+ should "not find a non existent #{soapobject}" do
71
+ response = @connect.send(searchmethod,{:search => objectfixure+"xyz"})
72
+ assert_nil response
73
+ end
74
+
75
+ should "look for a search parameter in search for #{soapobject}" do
76
+ assert_raises ArgumentError do
77
+ response = @connect.send(searchmethod,{})
78
+ end
79
+ end
80
+
81
+ should "get the test#{soapobject}" do
82
+ response = @connect.send(searchmethod,{:search => objectfixure})
83
+ contact = @connect.send(getmethod,response[:id])
84
+ assert_not_nil contact
85
+ end
86
+
87
+ should "get the #{soapobject} changed since 2011-01-01" do
88
+ response = @connect.send(getsyncmethod,"2011-01-01 00:00:00")
89
+ assert_not_nil response
90
+ end
91
+ end
92
+
93
+
94
+ context "B Modifying #{soapobject}'s" do
95
+
96
+ should "modify the test#{soapobject}" do
97
+ response = @connect.send(searchmethod,{:search => objectfixure})
98
+ params = {:id=>response[:id]}.merge(fixure[symbol][:mod])
99
+ contact = @connect.send(modifymethod,params)
100
+ assert contact
101
+ end
102
+
103
+ should "modify the test#{soapobject} (and look for needed params)" do
104
+ response = @connect.send(searchmethod,{:search => fixure[symbol][:mod][needs[symbol][0]]})
105
+ assert_raises ArgumentError do
106
+ contact = @connect.send(modifymethod, {})
107
+ end
108
+ end
109
+ end
110
+
111
+
112
+ context "Deleting #{soapobject}" do
113
+
114
+ should "delete the test#{soapobject}" do
115
+ response = @connect.send(searchmethod,{:search => fixure[symbol][:mod][needs[symbol][0]]})
116
+ contact = @connect.send(deletemethod,response[:id])
117
+ assert contact
118
+ end
119
+ end
120
+
121
+ end #context
122
+ end # each
123
+ end #class
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: 27
4
+ hash: 15
5
5
  prerelease:
6
6
  segments:
7
- - 1
7
+ - 2
8
8
  - 0
9
- - 6
10
- version: 1.0.6
9
+ - 0
10
+ version: 2.0.0
11
11
  platform: ruby
12
12
  authors:
13
13
  - Karsten Redmer
@@ -15,7 +15,7 @@ autorequire:
15
15
  bindir: bin
16
16
  cert_chain: []
17
17
 
18
- date: 2011-06-08 00:00:00 +02:00
18
+ date: 2011-06-12 00:00:00 +02:00
19
19
  default_executable:
20
20
  dependencies:
21
21
  - !ruby/object:Gem::Dependency
@@ -154,7 +154,17 @@ dependencies:
154
154
  name: savon
155
155
  version_requirements: *id009
156
156
  prerelease: false
157
- description: Unofficial gem for connecting to memotoo.com with their soap-api and handle your contact needs. Memotoo lets your synchronize all your contacts, events and tasks with yahoo, gmail, facebook, xing, outlook, your mobile-phone and more. You can also get your e-mails in one place.
157
+ description: |-
158
+ Unofficial gem for connecting to memotoo.com with their soap-api and handle your contact needs. Memotoo lets your synchronize all your contacts, events and tasks with yahoo, gmail, facebook, xing, outlook, your mobile-phone and more. You can also get your e-mails in one place.Features of memotoo:
159
+ New mobile? Transfer all your data to your new device!
160
+ Synchronise your data with your mobile phone (with SyncML)
161
+ Access all your e-mail in a single page from Google, Yahoo, Hotmail / MSN, ...!
162
+ View your data on your mobile phone (WAP / XHTML)
163
+ Access your contacts using a LDAP directory
164
+ Access your files via a Web Folder
165
+ Access your files via FTP
166
+ Add Memotoo widgets to iGoogle, Netvibes, Windows Vista, Apple Dashboard, ...
167
+ Memotoo plugins for your browser
158
168
  email: k.redmer@yahoo.de
159
169
  executables: []
160
170
 
@@ -166,7 +176,6 @@ extra_rdoc_files:
166
176
  files:
167
177
  - .document
168
178
  - .gemtest
169
- - .rvmrc-old
170
179
  - Gemfile
171
180
  - Gemfile.lock
172
181
  - LICENSE.txt
@@ -174,20 +183,13 @@ files:
174
183
  - Rakefile
175
184
  - VERSION
176
185
  - lib/memotoo.rb
177
- - lib/memotoo/bookmark/bookmark.rb
178
- - lib/memotoo/connect.rb
179
- - lib/memotoo/contact/contact.rb
180
- - lib/memotoo/contact/contact_group.rb
181
186
  - lib/memotoo/core-ext/hash.rb
182
187
  - lib/memotoo/core-ext/kernel.rb
183
- - lib/memotoo/wsdl/http.xml
184
- - lib/memotoo/wsdl/https.xml
188
+ - lib/memotoo/main.rb
185
189
  - memotoo.gemspec
186
190
  - test/helper.rb
187
- - test/test_bookmark.rb
188
- - test/test_contact.rb
189
- - test/test_contact_group.rb
190
191
  - test/test_memotoo.rb
192
+ - test/test_soapobjects.rb
191
193
  has_rdoc: true
192
194
  homepage: http://github.com/kredmer/memotoo
193
195
  licenses:
@@ -224,7 +226,5 @@ specification_version: 3
224
226
  summary: Unofficial gem for connecting to memotoo.com with their given soap-api
225
227
  test_files:
226
228
  - test/helper.rb
227
- - test/test_bookmark.rb
228
- - test/test_contact.rb
229
- - test/test_contact_group.rb
230
229
  - test/test_memotoo.rb
230
+ - test/test_soapobjects.rb
data/.rvmrc-old DELETED
@@ -1 +0,0 @@
1
- rvm use 1.8.7@memotoo
@@ -1,72 +0,0 @@
1
-
2
- module Memotoo
3
-
4
- class Connect
5
-
6
- # required: url
7
- #
8
- # optional:
9
- # description
10
- # tags
11
- # rank
12
- # id_bookmarkfolder
13
- # {:name=>groupname}
14
- # #e.g. @connect.addBookmark({:name=>"Testgroup"})
15
- def addBookmark(details)
16
- if has_needed_fields(details, :url)
17
- format_result(addApiCall({:bookmark => details}), :id)
18
- end
19
- end
20
-
21
- #[searchparameter:]
22
- # {:search=>"something", :limit_start=>0, :limit_nb=>100}
23
- #* required:
24
- # search
25
- #* optional:
26
- # limit_start
27
- # limit_nb
28
- #e.g. @connect.searchBookmark({:search=>"ka", :limit_nb=>50})
29
- #
30
- # returns nil or a hash of one contactgroup or an array of contactgroups
31
- #
32
- def searchBookmark(searchparameter={})
33
- if has_needed_search_parameter(searchparameter)
34
- format_result(searchApiCall(searchparameter), :return, :bookmark)
35
- end
36
- end
37
-
38
- # id = integer
39
- # e.g. @connect.getBookmark(12345)
40
- #
41
- # returns the contactgroup or nil
42
- #
43
- def getBookmark(id)
44
- format_result(getApiCall(id), :return, :bookmark)
45
- end
46
-
47
- # get modified contactgroups since date
48
- # datetime = "2010-02-23 10:00:00" or just "2010-02-23"
49
- # e.g. @connect.getBookmarkSync("2010-02-23 10:00:00")
50
- def getBookmarkSync(datetime)
51
- format_result(getSyncApiCall(datetime), :return, :bookmark)
52
- end
53
-
54
- # required: name and id
55
- # note: you can only change the name
56
- # return true if the changed happened
57
- def modifyBookmark(details={})
58
- if has_needed_fields(details, :id)
59
- format_result(modifyApiCall({:bookmark => details}), :ok)
60
- end
61
- end
62
-
63
- # id = integer
64
- # e.g. @connect.deleteBookmark(12345)
65
- # return true when contactgroup is deleted
66
- def deleteBookmark(id)
67
- format_result(deleteApiCall(id), :ok)
68
- end
69
-
70
- end # class
71
-
72
- end # module
@@ -1,244 +0,0 @@
1
- require 'parsedate'
2
- require "savon"
3
- require "memotoo/core-ext/hash"
4
- require "memotoo/core-ext/kernel"
5
- require "memotoo/contact/contact"
6
- require "memotoo/contact/contact_group"
7
- require "memotoo/bookmark/bookmark"
8
-
9
-
10
- module Memotoo
11
-
12
- # = Memotoo::Connect
13
- #
14
- # Memotoo::Connect is the main object for connecting
15
- # to the {memotoo}[http://www.memotoo.com/index-saleshype.php] SOAP service.
16
-
17
- class Connect
18
-
19
- # will hold username and password in a hash style (used for all requests)
20
- attr_accessor :opts
21
-
22
- SEARCHDEFAULTS = { :limit_start => '0', :limit_nb => '100' }
23
-
24
- #[https] default:true for the SOAP service.
25
- # example: @connect=Memotoo::Connect.new("myusername","mypassword")
26
- def initialize(username, password, https=true)
27
-
28
- # we will need it for every request - will be merged in
29
- self.opts= {
30
- :param => {
31
- :login => username,
32
- :password => password,
33
- }
34
- }
35
-
36
- # creates client with memotoo settings
37
- client(https)
38
- end
39
-
40
- # Creates the <tt>Savon::Client</tt>.
41
- def client(https=true)
42
- #--
43
- # in any case problems switch back to receiving the wsdl file from memotoo
44
- # https: wsdl.document = "https://www.memotoo.com/SOAP-server.php?wsdl"
45
- # http: wsdl.document = "http://www.memotoo.com/SOAP-server.php?wsdl"
46
- #++
47
-
48
- @client ||= Savon::Client.new do
49
- wsdl.namespace="urn:memotooSoap"
50
- if https
51
- wsdl.endpoint="https://www.memotoo.com/SOAP-server.php"
52
- http.auth.ssl.verify_mode = :none
53
- else
54
- wsdl.endpoint="http://www.memotoo.com/SOAP-server.php"
55
- end
56
- http.auth.basic self.opts[:param][:login], self.opts[:param][:password]
57
- end
58
- end
59
-
60
-
61
- def searchApiCall(searchparameter)
62
- search = SEARCHDEFAULTS.merge!(searchparameter)
63
- apicall(calling_method.to_sym, search)
64
- end
65
-
66
- def getApiCall(id)
67
- apicall(calling_method.to_sym, { :id => id })
68
- end
69
-
70
- def getSyncApiCall(datetime)
71
- date2time=Time.mktime(*ParseDate.parsedate(datetime))
72
- formated_date=date2time.strftime("%Y-%m-%d %H:%M:%S")
73
- apicall(calling_method.to_sym, { :date => formated_date })
74
- end
75
-
76
- def deleteApiCall(id)
77
- apicall(calling_method.to_sym, { :id => id })
78
- end
79
-
80
- def modifyApiCall(details)
81
- apicall(calling_method.to_sym, details )
82
- end
83
-
84
- def addApiCall(details)
85
- apicall(calling_method.to_sym, details )
86
- end
87
-
88
-
89
- # used internally for a request
90
- def apicall(action, parameter)
91
-
92
- response=@client.request :wsdl, action do
93
- soap.body = { :param => parameter }.deep_merge_me!(self.opts)
94
- end
95
- response
96
-
97
- #--
98
- # TODO: error-handling - I was tooo lazy.....
99
- #++
100
-
101
- rescue Savon::Error => error
102
- if error.message.nil?
103
- puts "invalid username/password"
104
-
105
- # I don't know which error is still possible
106
- # else
107
- # puts error.to_s
108
- end
109
- end
110
-
111
- def format_result(response, *_keys_)
112
- output_key = [(calling_method.underscore+"_response").to_sym] | _keys_
113
- response.nil? ? nil : response.to_hash.seek(output_key)
114
- end
115
-
116
-
117
-
118
- private
119
-
120
- def go_home(message)
121
- #--
122
- # TODO: raising errors instead of writing to STDOUT
123
- #++
124
- puts "missing fields: " + message.to_s
125
- false
126
- end
127
-
128
- def has_needed_fields(thehash, *args)
129
- valid=true
130
- retarr=[]
131
- args.each do |arg_item|
132
- unless thehash.has_key?(arg_item)
133
- valid = false
134
- retarr << arg_item
135
- end
136
- end
137
- valid ? true : go_home(retarr.join(", "))
138
- end
139
-
140
- def has_needed_search_parameter(searchparameter)
141
- has_needed_fields(searchparameter, :search)
142
- end
143
-
144
- end # class
145
-
146
- end # module
147
-
148
- # stop savon logging
149
-
150
- module Savon
151
- module Global
152
- def log?
153
- false
154
- end
155
- def raise_errors?
156
- @raise_errors = true
157
- end
158
-
159
- end
160
- end
161
-
162
- #-- available memotoo soap actions !!!!!!!!!!
163
-
164
- #event
165
-
166
- #:get_event,
167
- #:delete_event,
168
- #:get_event_sync,
169
- #:modify_event,
170
- #:search_event,
171
- #:add_event,
172
-
173
- #calendar_category
174
-
175
- #:search_calendar_category,
176
- #:add_calendar_category,
177
- #:delete_calendar_category,
178
- #:get_calendar_category,
179
- #:modify_calendar_category,
180
- #:get_calendar_category_sync,
181
-
182
- #holiday
183
-
184
- #:get_holiday,
185
- #:delete_holiday,
186
- #:get_holiday_sync,
187
- #:modify_holiday,
188
- #:search_holiday,
189
- #:add_holiday,
190
- #
191
-
192
- #contact - ready implemented
193
- #:add_contact,
194
- #:modify_contact,
195
- #:search_contact,
196
- #:delete_contact,
197
- #:get_contact_sync,
198
- #:get_contact,
199
-
200
- #contact-group - ready implemented
201
- #
202
- #:search_contact_group,
203
- #:add_contact_group,
204
- #:delete_contact_group,
205
- #:get_contact_group,
206
- #:get_contact_group_sync
207
- #:modify_contact_group
208
- #
209
- #bookmark
210
- #
211
- #:get_bookmark,
212
- #:modify_bookmark,
213
- #:search_bookmark
214
- #:add_bookmark,
215
- #:delete_bookmark,
216
- #:get_bookmark_sync,
217
- #
218
- #bookmarkfolder
219
- #
220
- #:search_bookmark_folder,
221
- #:add_bookmark_folder,
222
- #:delete_bookmark_folder,
223
- #:get_bookmark_folder,
224
- #:get_bookmark_folder_sync,
225
- #:modify_bookmark_folder,
226
-
227
- #task
228
-
229
- #:modify_task,
230
- #:get_task,
231
- #:get_task_sync,
232
- #:search_task,
233
- #:add_task,
234
- #:delete_task,
235
-
236
- #note
237
-
238
- #:get_note_sync
239
- #:modify_note,
240
- #:search_note,
241
- #:delete_note,
242
- #:add_note,
243
- #:get_note,
244
- #++