omniauth-expressov3 1.0.3 → 1.0.4
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,15 +1,15 @@
|
|
1
1
|
---
|
2
2
|
!binary "U0hBMQ==":
|
3
3
|
metadata.gz: !binary |-
|
4
|
-
|
4
|
+
NmQ0OGM2MmVlMTEzZmQ0ZDlkMjdiY2FhYjFlZDQ1ZGE3ZTQ1NDI2Nw==
|
5
5
|
data.tar.gz: !binary |-
|
6
|
-
|
6
|
+
OTg3MDI1MmMwODQ0ZmViMTk2Y2JjNTg1OWI1MmIyYmZmMTQ3Nzg5Mw==
|
7
7
|
SHA512:
|
8
8
|
metadata.gz: !binary |-
|
9
|
-
|
10
|
-
|
11
|
-
|
9
|
+
NjBiZDA3NmVjM2Y1ODllNTM0ZGFmNWZkYTUwYWE4N2U4YmJhOGI3MmU5MDI5
|
10
|
+
Y2NlYzc1ODNlNGI3NTY1MWRiZGI1MDZmY2YyMWY2MmJkMmM1YjYxOWRiNDA1
|
11
|
+
NWZkYjU0MzNjMTc5YTNlMzYyNDMwM2M4ZWY2Zjk1NTFjZDI4MTU=
|
12
12
|
data.tar.gz: !binary |-
|
13
|
-
|
14
|
-
|
15
|
-
|
13
|
+
YmUwZTA1NDNmNjYyOTlmM2JiYTk1YmM4YjhkYTVlZDk5YWI2YjIxMmYwYmYw
|
14
|
+
MjZmZjRlNzAzNjQ5ZTg4MTA5MTA1ZGUyYTFjM2E5YTE3NmEwNjc3MGJjZmEw
|
15
|
+
YTQ1ZDMzNjAyYWEzNThiMThmN2I3ZjUwMjRkNDVkMzQxNzc5OTU=
|
data/Gemfile.lock
CHANGED
@@ -12,8 +12,8 @@ module OmniAuth
|
|
12
12
|
|
13
13
|
def initialize(options={})
|
14
14
|
service_url = options['service_url'] || SERVICE_URL
|
15
|
-
@
|
16
|
-
@
|
15
|
+
@debug = options['debug'] || options[:debug]
|
16
|
+
@json_tine = JSONRPCTineConnection.new service_url, @debug
|
17
17
|
end
|
18
18
|
|
19
19
|
def send(method_name, args={})
|
@@ -35,6 +35,7 @@ module OmniAuth
|
|
35
35
|
|
36
36
|
def send method, args=nil
|
37
37
|
@json_tine.send method, args
|
38
|
+
@json_tine.result
|
38
39
|
end
|
39
40
|
|
40
41
|
def get_user_data
|
@@ -43,7 +44,8 @@ module OmniAuth
|
|
43
44
|
#hash with user data
|
44
45
|
{ 'keys' => @json_tine.result['keys'],
|
45
46
|
'currentAccount' => @json_tine.result['Tinebase']['currentAccount'],
|
46
|
-
'userContact' => @json_tine.result['Tinebase']['userContact']
|
47
|
+
'userContact' => @json_tine.result['Tinebase']['userContact'],
|
48
|
+
'expressoAccount' => @json_tine.result['Expressomail']['accounts']['results'][0]
|
47
49
|
}
|
48
50
|
end
|
49
51
|
|
@@ -37,7 +37,7 @@ module OmniAuth
|
|
37
37
|
end
|
38
38
|
|
39
39
|
def send(tine_method, args=nil)
|
40
|
-
|
40
|
+
puts "STARTING METHOD: #{tine_method} - WITH PARAMS: #{args.inspect}" if @debug
|
41
41
|
response = execute_http_call(tine_method, args)
|
42
42
|
hash_response = parse_response(response)
|
43
43
|
@json_return = hash_response[:json_object]
|
@@ -87,6 +87,9 @@ private
|
|
87
87
|
@req = Net::HTTP::Post.new(@uri.request_uri, initheader = {'Content-Type'=>'application/json'})
|
88
88
|
json_body = {:jsonrpc => '2.0', :method => tine_method, :id => next_cont}
|
89
89
|
json_body.merge!({:params => args}) unless args.nil?
|
90
|
+
|
91
|
+
#puts "REQUEST BODY: #{json_body.to_json}" if @debug
|
92
|
+
|
90
93
|
@req.body = uri_escape_sanely( json_body.to_json )
|
91
94
|
add_request_fields #headers e cookies
|
92
95
|
unless @http
|
@@ -98,11 +101,16 @@ private
|
|
98
101
|
end
|
99
102
|
|
100
103
|
def parse_response response
|
101
|
-
|
104
|
+
# puts "BODY: #{response.body}" if @debug
|
105
|
+
json_obj = JSON.parse(response.body)
|
106
|
+
# puts json_obj.inspect if @debug
|
102
107
|
|
103
|
-
json_key = json['result']['jsonKey'] if json['result']
|
104
108
|
|
105
|
-
|
109
|
+
if json_obj['result'] and json_obj['result'].is_a? Hash
|
110
|
+
json_key = json_obj['result']['jsonKey'] if json_obj['result']['jsonKey']
|
111
|
+
end
|
112
|
+
|
113
|
+
cookies = tine_key = nil
|
106
114
|
|
107
115
|
if response.get_fields('Set-Cookie')
|
108
116
|
tine_key = response.get_fields('Set-Cookie').to_s.split(';')[0].split('=')[1]
|
@@ -113,16 +121,16 @@ private
|
|
113
121
|
end
|
114
122
|
|
115
123
|
return {
|
116
|
-
:json_object =>
|
124
|
+
:json_object => json_obj,
|
117
125
|
:tine_key => (tine_key || @tine_key) ,
|
118
|
-
:json_key => json_key,
|
119
|
-
:cookies => (cookies
|
126
|
+
:json_key => json_key || @json_key,
|
127
|
+
:cookies => (cookies || @cookies)
|
120
128
|
}
|
121
129
|
end
|
122
130
|
|
123
131
|
def output_debug_response_and_vars(response)
|
124
132
|
if @debug
|
125
|
-
puts "Response #{response.code} #{response.message}: #{response.body}"
|
133
|
+
#puts "Response #{response.code} #{response.message}: #{response.body}"
|
126
134
|
puts "TINE_KEY: "+@tine_key if @tine_key
|
127
135
|
puts "JSON_KEY: "+@json_key if @json_key
|
128
136
|
puts "COOKIES: #{@cookies}" if @cookies
|
@@ -14,4 +14,78 @@ describe "OmniAuth::ExpressoV3::AuthClient" do
|
|
14
14
|
auth.close
|
15
15
|
end
|
16
16
|
end
|
17
|
+
|
18
|
+
context 'explore tine api' do
|
19
|
+
|
20
|
+
before :all do
|
21
|
+
@auth = OmniAuth::ExpressoV3::AuthClient.new :debug => false
|
22
|
+
#@auth.authenticate(ENV['EXPRESSO_USERNAME'], ENV['EXPRESSO_PASSWORD'])
|
23
|
+
@auth_data = @auth.authenticate(ENV['EXPRESSO_USERNAME'], ENV['EXPRESSO_PASSWORD'])
|
24
|
+
@user_data = @auth.get_user_data
|
25
|
+
end
|
26
|
+
|
27
|
+
after :all do
|
28
|
+
@auth.close
|
29
|
+
end
|
30
|
+
|
31
|
+
context 'queries' do
|
32
|
+
it 'search folders' do
|
33
|
+
args = {
|
34
|
+
filter:
|
35
|
+
[
|
36
|
+
{field: "account_id", operator: "equals", value: @user_data["expressoAccount"]["id"]},
|
37
|
+
{field: "globalname", operator: "equals", value: ""}
|
38
|
+
|
39
|
+
]
|
40
|
+
}
|
41
|
+
result = @auth.send("Expressomail.searchFolders", args)
|
42
|
+
puts "----------------------------------------------------------"
|
43
|
+
puts "PRINTING FOLDERS"
|
44
|
+
puts "----------------------------------------------------------"
|
45
|
+
result['results'].each do |folder|
|
46
|
+
puts "FOLDER: #{folder['id']} - #{folder['globalname']} (#{folder['cache_totalcount']}) emails (#{folder['cache_unreadcount']}) unread"
|
47
|
+
puts "FOLDER DATA: #{folder.inspect}"
|
48
|
+
puts "----------------------------------------------------------"
|
49
|
+
end
|
50
|
+
end
|
51
|
+
it 'search Messages' do
|
52
|
+
args = {
|
53
|
+
filter:
|
54
|
+
[
|
55
|
+
{
|
56
|
+
condition: "OR",
|
57
|
+
filters: [
|
58
|
+
{condition: "AND", filters: [{field: "query", operator: "contains", value: "", id: "ext-record-351"},
|
59
|
+
{ field: "path", operator: "in",
|
60
|
+
value: ["/4e3f366969900893e80664b9c745a254f451aacb/NGUzZjM2Njk2OTkwMDg5M2U4MDY2NGI5Yzc0NWEyNTRmNDUxYWFjYjtJTkJPWA2"],
|
61
|
+
id: "ext-record-368"}],
|
62
|
+
id: "ext-comp-1101", label: "Messages"}]}],
|
63
|
+
paging:
|
64
|
+
{
|
65
|
+
sort: "received", dir: "DESC", start: 0, limit: 5
|
66
|
+
}
|
67
|
+
}
|
68
|
+
result = @auth.send("Expressomail.searchMessages", args)
|
69
|
+
puts "----------------------------------------------------------"
|
70
|
+
puts "LSITING LAST 5 MESSAGES"
|
71
|
+
puts "----------------------------------------------------------"
|
72
|
+
(0..4).each do |i|
|
73
|
+
puts "SUBJECT: #{result['results'][i]['subject']}"
|
74
|
+
puts "EMAIL DATA: #{result['results'][i].inspect}"
|
75
|
+
puts "----------------------------------------------------------"
|
76
|
+
end
|
77
|
+
end
|
78
|
+
it 'query for Expressomail.updateMessageCache' do
|
79
|
+
args = {
|
80
|
+
folderId: 'NGUzZjM2Njk2OTkwMDg5M2U4MDY2NGI5Yzc0NWEyNTRmNDUxYWFjYjtJTkJPWA2',
|
81
|
+
time: 10
|
82
|
+
}
|
83
|
+
result = @auth.send("Expressomail.updateMessageCache", args)
|
84
|
+
puts "----------------------------------------------------------"
|
85
|
+
puts "UPDATING MESSAGES CACHE"
|
86
|
+
puts "----------------------------------------------------------"
|
87
|
+
puts result
|
88
|
+
end
|
89
|
+
end
|
90
|
+
end
|
17
91
|
end
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: omniauth-expressov3
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Abner Oliveira
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-02-
|
11
|
+
date: 2015-02-12 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: omniauth
|