cliskip2 0.0.7 → 0.0.8
Sign up to get free protection for your applications and to get access to all the features.
- data/lib/cliskip2/client.rb +8 -26
- data/lib/cliskip2/connection.rb +1 -0
- data/lib/cliskip2/version.rb +1 -1
- metadata +2 -2
data/lib/cliskip2/client.rb
CHANGED
@@ -62,57 +62,39 @@ module Cliskip2
|
|
62
62
|
updated_users_count = 0
|
63
63
|
failed_users_count = 0
|
64
64
|
skipped_users_count = 0
|
65
|
-
|
66
|
-
log_text = 'Start syncing users...'
|
67
|
-
log_texts << log_text
|
68
|
-
logger.info log_text
|
65
|
+
logger.info 'Start syncing users...'
|
69
66
|
CSV.foreach(File.expand_path(users_csv_path), :headers => true, :encoding => 'UTF-8') do |row|
|
70
67
|
begin
|
71
68
|
if email = row['email'] and email != ''
|
72
69
|
if user = self.get_user(:email => email)
|
73
70
|
self.update_user :user => {:name => row['name'], :email => email, :section => row['section'], :status => row['status']}
|
74
|
-
|
75
|
-
log_texts << log_text
|
76
|
-
logger.info log_text
|
71
|
+
logger.info " Updated email: #{email}"
|
77
72
|
updated_users_count = updated_users_count + 1
|
78
73
|
else
|
79
74
|
self.create_user :user => {:name => row['name'], :email => email, :section => row['section']}
|
80
|
-
|
81
|
-
log_texts << log_text
|
82
|
-
logger.info log_text
|
75
|
+
logger.info " Inserted email: #{email}"
|
83
76
|
inserted_users_count = inserted_users_count + 1
|
84
77
|
end
|
85
78
|
else
|
86
|
-
|
87
|
-
log_texts << log_text
|
88
|
-
logger.info log_text
|
79
|
+
logger.info " Skipped to sync users. because of blank-email."
|
89
80
|
skipped_users_count = skipped_users_count + 1
|
90
81
|
end
|
91
82
|
rescue Faraday::Error::ClientError => e
|
92
|
-
|
93
|
-
log_texts << log_text
|
94
|
-
logger.error log_text
|
83
|
+
logger.error " Failed email: #{email}"
|
95
84
|
failed_users_count = failed_users_count + 1
|
96
|
-
log_texts << e.message
|
97
85
|
logger.error e.message
|
98
86
|
rescue => e
|
99
|
-
|
100
|
-
log_texts << log_text
|
101
|
-
logger.error log_text
|
87
|
+
logger.error " Failed email: #{email}"
|
102
88
|
failed_users_count = failed_users_count + 1
|
103
|
-
log_texts << e.backtrace.join("\n")
|
104
89
|
logger.error e
|
105
90
|
end
|
106
91
|
end
|
107
|
-
|
108
|
-
log_texts << log_text
|
109
|
-
logger.info log_text
|
92
|
+
logger.info 'Finish syncing users...'
|
110
93
|
{
|
111
94
|
:inserted_users_count => inserted_users_count,
|
112
95
|
:updated_users_count => updated_users_count,
|
113
96
|
:failed_users_count => failed_users_count,
|
114
|
-
:skipped_users_count => skipped_users_count
|
115
|
-
:log_texts => log_texts
|
97
|
+
:skipped_users_count => skipped_users_count
|
116
98
|
}
|
117
99
|
end
|
118
100
|
|
data/lib/cliskip2/connection.rb
CHANGED
data/lib/cliskip2/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: cliskip2
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.8
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-06-
|
12
|
+
date: 2012-06-29 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: faraday_middleware
|