ecircle 0.1.0 → 0.1.1
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +1 -1
- data/README.md +44 -45
- data/lib/ecircle/api.rb +3 -22
- data/lib/ecircle/version.rb +1 -1
- data/lib/ecircle/wrapped_response.rb +13 -11
- metadata +18 -18
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -12,39 +12,6 @@ The API coverage is far from complete, however as far as I can see the most usef
|
|
12
12
|
|
13
13
|
The existing API methods can be considered stable and are used in production.
|
14
14
|
|
15
|
-
Features
|
16
|
-
-------------
|
17
|
-
|
18
|
-
###Synchronous API
|
19
|
-
|
20
|
-
The following methods are implemented:
|
21
|
-
|
22
|
-
* createMember
|
23
|
-
* createOrUpdateGroup
|
24
|
-
* createOrUpdateUserByEmail
|
25
|
-
* deleteGroup
|
26
|
-
* deleteMember
|
27
|
-
* logon (only for debugging purposes)
|
28
|
-
* logout
|
29
|
-
* sendParametrizedSingleMessageToUser
|
30
|
-
|
31
|
-
See the [online API documentation](http://rubydoc.info/github/troessner/ecircle/master/frames) for details on arguments and return values
|
32
|
-
|
33
|
-
###Asnchronous API
|
34
|
-
|
35
|
-
Since the asynchronous API is neither documented by ecircle nor intuitive at all, you're on your own. Jump to the examples section and good luck.
|
36
|
-
|
37
|
-
To do
|
38
|
-
-------------
|
39
|
-
|
40
|
-
* Fix TODOs in source code
|
41
|
-
* Implement missing API methods:
|
42
|
-
* deleteUser
|
43
|
-
* deleteUserByEmail
|
44
|
-
* lookupGroups
|
45
|
-
* Write specs
|
46
|
-
|
47
|
-
|
48
15
|
Installation
|
49
16
|
-------------
|
50
17
|
|
@@ -54,7 +21,6 @@ Either as a gem:
|
|
54
21
|
|
55
22
|
or via Bundler by adding it to your Gemfile.
|
56
23
|
|
57
|
-
|
58
24
|
Configuration
|
59
25
|
-------------
|
60
26
|
|
@@ -64,16 +30,9 @@ Configuration
|
|
64
30
|
config.password = 'your_password'
|
65
31
|
end
|
66
32
|
|
67
|
-
|
68
33
|
The reason for the unusual configuration setting "sync_realm" is that there is also an asynchronous ecircle API with a different realm.
|
69
34
|
|
70
|
-
|
71
|
-
-------------
|
72
|
-
|
73
|
-
The ecircle gem does the session handling for you, there is no need to logon explicitly.
|
74
|
-
Session tokens will be re-used to keep the number of session related traffic to a minimum.
|
75
|
-
|
76
|
-
Response
|
35
|
+
Response handling
|
77
36
|
-------------
|
78
37
|
|
79
38
|
The ecircle gem will always return a wrapped response for all API methods, except for the logon method (see examples below or the API doc).
|
@@ -87,12 +46,37 @@ The most usefull (and self-explanatory) would be:
|
|
87
46
|
* fault_code
|
88
47
|
* ecircle_id IF the API returns an ID an success, e.g. for create_member and create_or_update_user_by_email
|
89
48
|
* convenience methods which depend on your (failed request), e.g.:
|
90
|
-
* member_does_not_exist? (
|
91
|
-
*
|
49
|
+
* member_does_not_exist? (delete_member requests)
|
50
|
+
* message_id_does_not_exist? (send_parametrized_message_to_user requests)
|
51
|
+
* no_such_group? (create_member requests)
|
52
|
+
* no_such_user? (create_member_requests)
|
92
53
|
|
93
54
|
For details see [here](http://rubydoc.info/github/troessner/ecircle/master/Ecircle/WrappedResponse)
|
94
55
|
|
95
|
-
|
56
|
+
Features
|
57
|
+
-------------
|
58
|
+
|
59
|
+
###Synchronous API
|
60
|
+
|
61
|
+
The following methods are implemented:
|
62
|
+
|
63
|
+
* createMember
|
64
|
+
* createOrUpdateGroup
|
65
|
+
* createOrUpdateUserByEmail
|
66
|
+
* deleteGroup
|
67
|
+
* deleteMember
|
68
|
+
* logon (only for debugging purposes)
|
69
|
+
* logout
|
70
|
+
* sendParametrizedSingleMessageToUser
|
71
|
+
|
72
|
+
See the [online API documentation](http://rubydoc.info/github/troessner/ecircle/master/frames) for details on arguments and return values
|
73
|
+
|
74
|
+
###Asnchronous API
|
75
|
+
|
76
|
+
Since the asynchronous API is neither documented by ecircle nor intuitive at all, you're on your own. Jump to the examples section and good luck.
|
77
|
+
|
78
|
+
|
79
|
+
Using ecircle
|
96
80
|
-------------
|
97
81
|
|
98
82
|
### Synchronous API
|
@@ -155,6 +139,21 @@ Note the async_realm in the configure block, this another realm as for the sync
|
|
155
139
|
|
156
140
|
Ecircle::JobPackage.send_async_message_to_group @options
|
157
141
|
|
142
|
+
To do
|
143
|
+
-------------
|
144
|
+
|
145
|
+
* Implement missing API methods:
|
146
|
+
* deleteUser
|
147
|
+
* deleteUserByEmail
|
148
|
+
* lookupGroups
|
149
|
+
* Write specs
|
150
|
+
|
151
|
+
Logon
|
152
|
+
-------------
|
153
|
+
|
154
|
+
The ecircle gem does the session handling for you, there is no need to logon explicitly.
|
155
|
+
Session tokens will be re-used to keep the number of session related traffic to a minimum.
|
156
|
+
|
158
157
|
Documentation
|
159
158
|
-------------
|
160
159
|
|
data/lib/ecircle/api.rb
CHANGED
@@ -15,34 +15,15 @@ module Ecircle
|
|
15
15
|
#@private
|
16
16
|
def ensuring_logon &block
|
17
17
|
begin
|
18
|
-
@auth_token
|
18
|
+
@auth_token = logon
|
19
|
+
block.call
|
19
20
|
rescue Savon::SOAP::Fault => e
|
20
21
|
# If we are here this probably means that our login credentials are wrong.
|
21
22
|
wrapped_response = WrappedResponse.new(e)
|
22
23
|
if wrapped_response.permission_problem?
|
23
24
|
puts @@help
|
24
|
-
raise
|
25
|
-
end
|
26
|
-
end
|
27
|
-
|
28
|
-
first_try = true
|
29
|
-
begin
|
30
|
-
block.call
|
31
|
-
rescue Savon::SOAP::Fault => e
|
32
|
-
# If we are here that probably means that our session token has expired.
|
33
|
-
wrapped_response = WrappedResponse.new(e)
|
34
|
-
if wrapped_response.permission_problem?
|
35
|
-
if first_try
|
36
|
-
first_try = false
|
37
|
-
@auth_token = logon
|
38
|
-
retry
|
39
|
-
else
|
40
|
-
puts "!!! Could not re-authenticate after session expired: #{wrapped_response.inspect} !!!"
|
41
|
-
raise
|
42
|
-
end
|
43
|
-
else
|
44
|
-
raise # Re-raise cause something else went wrong.
|
45
25
|
end
|
26
|
+
raise
|
46
27
|
end
|
47
28
|
end
|
48
29
|
|
data/lib/ecircle/version.rb
CHANGED
@@ -22,27 +22,29 @@ module Ecircle
|
|
22
22
|
end
|
23
23
|
end
|
24
24
|
|
25
|
+
# Useful for `delete_member` requests.
|
26
|
+
# @return [Boolean]
|
25
27
|
def member_does_not_exist?
|
26
|
-
@fault_code == 100
|
27
|
-
end
|
28
|
-
|
29
|
-
def group_does_not_exist?
|
30
|
-
@fault_code == 500
|
28
|
+
@fault_code == 100 && @error_message == 'No Member Id'
|
31
29
|
end
|
32
30
|
|
31
|
+
# This method will tell you if referred to a user id that doesn't exist for ecircle.
|
32
|
+
# Usefull for create_member requests
|
33
33
|
def no_such_user?
|
34
|
-
@fault_code ==
|
34
|
+
@fault_code == 103 && @error_message == 'No such User'
|
35
35
|
end
|
36
36
|
|
37
|
+
# If you do a create_member request where the group id you pass in doesn't exist you get back a "permission problem".
|
38
|
+
# Yes, I know. It hurts.
|
39
|
+
# @return [Boolean]
|
37
40
|
def permission_problem?
|
38
41
|
@fault_code == 502 && @error_message = 'Permission Problem'
|
39
42
|
end
|
43
|
+
alias :no_such_group? :permission_problem?
|
40
44
|
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
end
|
45
|
-
|
45
|
+
# This method will tell you if you referred to a message id that ecircle doesn't know about.
|
46
|
+
# Usefull for send_parametrized_message_to_user requests.
|
47
|
+
# @return[Boolean]
|
46
48
|
def message_id_does_not_exist?
|
47
49
|
@error_message =~ /MessageInfo '(\d+)' not found/
|
48
50
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: ecircle
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,11 +9,11 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2011-11-
|
12
|
+
date: 2011-11-22 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: activesupport
|
16
|
-
requirement: &
|
16
|
+
requirement: &74974340 !ruby/object:Gem::Requirement
|
17
17
|
none: false
|
18
18
|
requirements:
|
19
19
|
- - ! '>='
|
@@ -21,10 +21,10 @@ dependencies:
|
|
21
21
|
version: '0'
|
22
22
|
type: :runtime
|
23
23
|
prerelease: false
|
24
|
-
version_requirements: *
|
24
|
+
version_requirements: *74974340
|
25
25
|
- !ruby/object:Gem::Dependency
|
26
26
|
name: i18n
|
27
|
-
requirement: &
|
27
|
+
requirement: &74973630 !ruby/object:Gem::Requirement
|
28
28
|
none: false
|
29
29
|
requirements:
|
30
30
|
- - ! '>='
|
@@ -32,10 +32,10 @@ dependencies:
|
|
32
32
|
version: '0'
|
33
33
|
type: :runtime
|
34
34
|
prerelease: false
|
35
|
-
version_requirements: *
|
35
|
+
version_requirements: *74973630
|
36
36
|
- !ruby/object:Gem::Dependency
|
37
37
|
name: rake
|
38
|
-
requirement: &
|
38
|
+
requirement: &74972700 !ruby/object:Gem::Requirement
|
39
39
|
none: false
|
40
40
|
requirements:
|
41
41
|
- - ! '>='
|
@@ -43,10 +43,10 @@ dependencies:
|
|
43
43
|
version: '0'
|
44
44
|
type: :runtime
|
45
45
|
prerelease: false
|
46
|
-
version_requirements: *
|
46
|
+
version_requirements: *74972700
|
47
47
|
- !ruby/object:Gem::Dependency
|
48
48
|
name: savon
|
49
|
-
requirement: &
|
49
|
+
requirement: &74971890 !ruby/object:Gem::Requirement
|
50
50
|
none: false
|
51
51
|
requirements:
|
52
52
|
- - ! '>='
|
@@ -54,10 +54,10 @@ dependencies:
|
|
54
54
|
version: 0.9.7
|
55
55
|
type: :runtime
|
56
56
|
prerelease: false
|
57
|
-
version_requirements: *
|
57
|
+
version_requirements: *74971890
|
58
58
|
- !ruby/object:Gem::Dependency
|
59
59
|
name: rspec
|
60
|
-
requirement: &
|
60
|
+
requirement: &74968680 !ruby/object:Gem::Requirement
|
61
61
|
none: false
|
62
62
|
requirements:
|
63
63
|
- - =
|
@@ -65,10 +65,10 @@ dependencies:
|
|
65
65
|
version: 2.6.0
|
66
66
|
type: :development
|
67
67
|
prerelease: false
|
68
|
-
version_requirements: *
|
68
|
+
version_requirements: *74968680
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: yard
|
71
|
-
requirement: &
|
71
|
+
requirement: &74967950 !ruby/object:Gem::Requirement
|
72
72
|
none: false
|
73
73
|
requirements:
|
74
74
|
- - ! '>='
|
@@ -76,10 +76,10 @@ dependencies:
|
|
76
76
|
version: '0'
|
77
77
|
type: :development
|
78
78
|
prerelease: false
|
79
|
-
version_requirements: *
|
79
|
+
version_requirements: *74967950
|
80
80
|
- !ruby/object:Gem::Dependency
|
81
81
|
name: ruby-debug19
|
82
|
-
requirement: &
|
82
|
+
requirement: &74966950 !ruby/object:Gem::Requirement
|
83
83
|
none: false
|
84
84
|
requirements:
|
85
85
|
- - ! '>='
|
@@ -87,7 +87,7 @@ dependencies:
|
|
87
87
|
version: '0'
|
88
88
|
type: :development
|
89
89
|
prerelease: false
|
90
|
-
version_requirements: *
|
90
|
+
version_requirements: *74966950
|
91
91
|
description: The ecircle gem aims to be a full-fledged client for all ecircle services.
|
92
92
|
email:
|
93
93
|
- timo.roessner@googlemail.com
|
@@ -127,7 +127,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
127
127
|
version: '0'
|
128
128
|
segments:
|
129
129
|
- 0
|
130
|
-
hash:
|
130
|
+
hash: 846535155
|
131
131
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
132
132
|
none: false
|
133
133
|
requirements:
|
@@ -136,7 +136,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
136
136
|
version: '0'
|
137
137
|
segments:
|
138
138
|
- 0
|
139
|
-
hash:
|
139
|
+
hash: 846535155
|
140
140
|
requirements: []
|
141
141
|
rubyforge_project: ecircle
|
142
142
|
rubygems_version: 1.8.10
|