cliskip2 0.0.5 → 0.0.6
Sign up to get free protection for your applications and to get access to all the features.
- data/Gemfile.lock +2 -2
- data/lib/cliskip2/client.rb +26 -8
- data/lib/cliskip2/version.rb +1 -1
- metadata +104 -118
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
cliskip2 (0.0.
|
4
|
+
cliskip2 (0.0.5)
|
5
5
|
faraday_middleware (~> 0.8.7)
|
6
6
|
json (~> 1.7.3)
|
7
7
|
oauth (~> 0.4)
|
@@ -11,7 +11,7 @@ GEM
|
|
11
11
|
remote: http://rubygems.org/
|
12
12
|
specs:
|
13
13
|
diff-lcs (1.1.3)
|
14
|
-
faraday (0.8.
|
14
|
+
faraday (0.8.1)
|
15
15
|
multipart-post (~> 1.1)
|
16
16
|
faraday_middleware (0.8.7)
|
17
17
|
faraday (>= 0.7.4, < 0.9)
|
data/lib/cliskip2/client.rb
CHANGED
@@ -62,39 +62,57 @@ module Cliskip2
|
|
62
62
|
updated_users_count = 0
|
63
63
|
failed_users_count = 0
|
64
64
|
skipped_users_count = 0
|
65
|
-
|
65
|
+
log_texts = []
|
66
|
+
log_text = 'Start syncing users...'
|
67
|
+
log_texts << log_text
|
68
|
+
logger.info log_text
|
66
69
|
CSV.foreach(File.expand_path(users_csv_path), :headers => true, :encoding => 'UTF-8') do |row|
|
67
70
|
begin
|
68
71
|
if email = row['email'] and email != ''
|
69
72
|
if user = self.get_user(:email => email)
|
70
73
|
self.update_user :user => {:name => row['name'], :email => email, :section => row['section'], :status => row['status']}
|
71
|
-
|
74
|
+
log_text = " Updated email: #{email}"
|
75
|
+
log_texts << log_text
|
76
|
+
logger.info log_text
|
72
77
|
updated_users_count = updated_users_count + 1
|
73
78
|
else
|
74
79
|
self.create_user :user => {:name => row['name'], :email => email, :section => row['section']}
|
75
|
-
|
80
|
+
log_text = " Inserted email: #{email}"
|
81
|
+
log_texts << log_text
|
82
|
+
logger.info log_text
|
76
83
|
inserted_users_count = inserted_users_count + 1
|
77
84
|
end
|
78
85
|
else
|
79
|
-
|
86
|
+
log_text = " Skipped email: #{email}"
|
87
|
+
log_texts << log_text
|
88
|
+
logger.info log_text
|
80
89
|
skipped_users_count = skipped_users_count + 1
|
81
90
|
end
|
82
91
|
rescue Faraday::Error::ClientError => e
|
83
|
-
|
92
|
+
log_text = " Failed email: #{email}"
|
93
|
+
log_texts << log_text
|
94
|
+
logger.error log_text
|
84
95
|
failed_users_count = failed_users_count + 1
|
96
|
+
log_texts << e.message
|
85
97
|
logger.error e.message
|
86
98
|
rescue => e
|
87
|
-
|
99
|
+
log_text = "Failed email: #{email}"
|
100
|
+
log_texts << log_text
|
101
|
+
logger.error log_text
|
88
102
|
failed_users_count = failed_users_count + 1
|
103
|
+
log_texts << e.backtrace.join("\n")
|
89
104
|
logger.error e
|
90
105
|
end
|
91
106
|
end
|
92
|
-
|
107
|
+
log_text = 'Finish syncing users...'
|
108
|
+
log_texts << log_text
|
109
|
+
logger.info log_text
|
93
110
|
{
|
94
111
|
:inserted_users_count => inserted_users_count,
|
95
112
|
:updated_users_count => updated_users_count,
|
96
113
|
:failed_users_count => failed_users_count,
|
97
|
-
:skipped_users_count => skipped_users_count
|
114
|
+
:skipped_users_count => skipped_users_count,
|
115
|
+
:log_texts => log_texts
|
98
116
|
}
|
99
117
|
end
|
100
118
|
|
data/lib/cliskip2/version.rb
CHANGED
metadata
CHANGED
@@ -1,138 +1,135 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: cliskip2
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
prerelease:
|
6
|
-
segments:
|
7
|
-
- 0
|
8
|
-
- 0
|
9
|
-
- 5
|
10
|
-
version: 0.0.5
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.0.6
|
5
|
+
prerelease:
|
11
6
|
platform: ruby
|
12
|
-
authors:
|
7
|
+
authors:
|
13
8
|
- Naoki Maeda
|
14
9
|
autorequire:
|
15
10
|
bindir: bin
|
16
11
|
cert_chain: []
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
dependencies:
|
21
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2012-06-28 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
22
15
|
name: faraday_middleware
|
23
|
-
|
24
|
-
requirement: &id001 !ruby/object:Gem::Requirement
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
25
17
|
none: false
|
26
|
-
requirements:
|
18
|
+
requirements:
|
27
19
|
- - ~>
|
28
|
-
- !ruby/object:Gem::Version
|
29
|
-
hash: 49
|
30
|
-
segments:
|
31
|
-
- 0
|
32
|
-
- 8
|
33
|
-
- 7
|
20
|
+
- !ruby/object:Gem::Version
|
34
21
|
version: 0.8.7
|
35
22
|
type: :runtime
|
36
|
-
version_requirements: *id001
|
37
|
-
- !ruby/object:Gem::Dependency
|
38
|
-
name: simple_oauth
|
39
23
|
prerelease: false
|
40
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ~>
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.8.7
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: simple_oauth
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
41
33
|
none: false
|
42
|
-
requirements:
|
34
|
+
requirements:
|
43
35
|
- - ~>
|
44
|
-
- !ruby/object:Gem::Version
|
45
|
-
hash: 11
|
46
|
-
segments:
|
47
|
-
- 0
|
48
|
-
- 1
|
49
|
-
- 8
|
36
|
+
- !ruby/object:Gem::Version
|
50
37
|
version: 0.1.8
|
51
38
|
type: :runtime
|
52
|
-
version_requirements: *id002
|
53
|
-
- !ruby/object:Gem::Dependency
|
54
|
-
name: json
|
55
39
|
prerelease: false
|
56
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
41
|
none: false
|
58
|
-
requirements:
|
42
|
+
requirements:
|
59
43
|
- - ~>
|
60
|
-
- !ruby/object:Gem::Version
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.1.8
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: json
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ~>
|
52
|
+
- !ruby/object:Gem::Version
|
66
53
|
version: 1.7.3
|
67
54
|
type: :runtime
|
68
|
-
version_requirements: *id003
|
69
|
-
- !ruby/object:Gem::Dependency
|
70
|
-
name: oauth
|
71
55
|
prerelease: false
|
72
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ~>
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.7.3
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: oauth
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
73
65
|
none: false
|
74
|
-
requirements:
|
66
|
+
requirements:
|
75
67
|
- - ~>
|
76
|
-
- !ruby/object:Gem::Version
|
77
|
-
|
78
|
-
segments:
|
79
|
-
- 0
|
80
|
-
- 4
|
81
|
-
version: "0.4"
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '0.4'
|
82
70
|
type: :runtime
|
83
|
-
version_requirements: *id004
|
84
|
-
- !ruby/object:Gem::Dependency
|
85
|
-
name: rake
|
86
71
|
prerelease: false
|
87
|
-
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '0.4'
|
78
|
+
- !ruby/object:Gem::Dependency
|
79
|
+
name: rake
|
80
|
+
requirement: !ruby/object:Gem::Requirement
|
88
81
|
none: false
|
89
|
-
requirements:
|
90
|
-
- -
|
91
|
-
- !ruby/object:Gem::Version
|
92
|
-
|
93
|
-
segments:
|
94
|
-
- 0
|
95
|
-
version: "0"
|
82
|
+
requirements:
|
83
|
+
- - ! '>='
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
96
86
|
type: :development
|
97
|
-
version_requirements: *id005
|
98
|
-
- !ruby/object:Gem::Dependency
|
99
|
-
name: rake-compiler
|
100
87
|
prerelease: false
|
101
|
-
|
88
|
+
version_requirements: !ruby/object:Gem::Requirement
|
102
89
|
none: false
|
103
|
-
requirements:
|
104
|
-
- -
|
105
|
-
- !ruby/object:Gem::Version
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
|
90
|
+
requirements:
|
91
|
+
- - ! '>='
|
92
|
+
- !ruby/object:Gem::Version
|
93
|
+
version: '0'
|
94
|
+
- !ruby/object:Gem::Dependency
|
95
|
+
name: rake-compiler
|
96
|
+
requirement: !ruby/object:Gem::Requirement
|
97
|
+
none: false
|
98
|
+
requirements:
|
99
|
+
- - ! '>='
|
100
|
+
- !ruby/object:Gem::Version
|
101
|
+
version: '0'
|
110
102
|
type: :development
|
111
|
-
version_requirements: *id006
|
112
|
-
- !ruby/object:Gem::Dependency
|
113
|
-
name: rspec
|
114
103
|
prerelease: false
|
115
|
-
|
104
|
+
version_requirements: !ruby/object:Gem::Requirement
|
105
|
+
none: false
|
106
|
+
requirements:
|
107
|
+
- - ! '>='
|
108
|
+
- !ruby/object:Gem::Version
|
109
|
+
version: '0'
|
110
|
+
- !ruby/object:Gem::Dependency
|
111
|
+
name: rspec
|
112
|
+
requirement: !ruby/object:Gem::Requirement
|
116
113
|
none: false
|
117
|
-
requirements:
|
114
|
+
requirements:
|
118
115
|
- - ~>
|
119
|
-
- !ruby/object:Gem::Version
|
120
|
-
|
121
|
-
segments:
|
122
|
-
- 2
|
123
|
-
version: "2"
|
116
|
+
- !ruby/object:Gem::Version
|
117
|
+
version: '2'
|
124
118
|
type: :development
|
125
|
-
|
119
|
+
prerelease: false
|
120
|
+
version_requirements: !ruby/object:Gem::Requirement
|
121
|
+
none: false
|
122
|
+
requirements:
|
123
|
+
- - ~>
|
124
|
+
- !ruby/object:Gem::Version
|
125
|
+
version: '2'
|
126
126
|
description: A Ruby wrapper for the SKIP2 REST APIs
|
127
|
-
email:
|
127
|
+
email:
|
128
128
|
- maeda.na@gmail.com
|
129
129
|
executables: []
|
130
|
-
|
131
130
|
extensions: []
|
132
|
-
|
133
131
|
extra_rdoc_files: []
|
134
|
-
|
135
|
-
files:
|
132
|
+
files:
|
136
133
|
- .gitignore
|
137
134
|
- Gemfile
|
138
135
|
- Gemfile.lock
|
@@ -152,39 +149,28 @@ files:
|
|
152
149
|
- lib/cliskip2/version.rb
|
153
150
|
- spec/cliskip2_spec.rb
|
154
151
|
- spec/spec_helper.rb
|
155
|
-
has_rdoc: true
|
156
152
|
homepage: https://github.com/SonicGarden/cliskip2
|
157
153
|
licenses: []
|
158
|
-
|
159
154
|
post_install_message:
|
160
155
|
rdoc_options: []
|
161
|
-
|
162
|
-
require_paths:
|
156
|
+
require_paths:
|
163
157
|
- lib
|
164
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
158
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
165
159
|
none: false
|
166
|
-
requirements:
|
167
|
-
- -
|
168
|
-
- !ruby/object:Gem::Version
|
169
|
-
|
170
|
-
|
171
|
-
- 0
|
172
|
-
version: "0"
|
173
|
-
required_rubygems_version: !ruby/object:Gem::Requirement
|
160
|
+
requirements:
|
161
|
+
- - ! '>='
|
162
|
+
- !ruby/object:Gem::Version
|
163
|
+
version: '0'
|
164
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
174
165
|
none: false
|
175
|
-
requirements:
|
176
|
-
- -
|
177
|
-
- !ruby/object:Gem::Version
|
178
|
-
|
179
|
-
segments:
|
180
|
-
- 0
|
181
|
-
version: "0"
|
166
|
+
requirements:
|
167
|
+
- - ! '>='
|
168
|
+
- !ruby/object:Gem::Version
|
169
|
+
version: '0'
|
182
170
|
requirements: []
|
183
|
-
|
184
171
|
rubyforge_project: cliskip2
|
185
|
-
rubygems_version: 1.
|
172
|
+
rubygems_version: 1.8.24
|
186
173
|
signing_key:
|
187
174
|
specification_version: 3
|
188
175
|
summary: A Ruby wrapper for the SKIP2 REST APIs
|
189
176
|
test_files: []
|
190
|
-
|