teamlab 0.3.16 → 0.4.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (38) hide show
  1. checksums.yaml +4 -4
  2. data/.overcommit.yml +34 -0
  3. data/.rubocop.yml +2 -0
  4. data/.rubocop_todo.yml +85 -0
  5. data/.travis.yml +6 -0
  6. data/Changelog.md +4 -0
  7. data/Gemfile +2 -0
  8. data/Rakefile +9 -0
  9. data/lib/teamlab/{Config.rb → config.rb} +5 -5
  10. data/lib/teamlab/{Modules/Calendar.rb → modules/calendar.rb} +12 -13
  11. data/lib/teamlab/{Modules/Community.rb → modules/community.rb} +16 -17
  12. data/lib/teamlab/{Modules/Crm.rb → modules/crm.rb} +62 -63
  13. data/lib/teamlab/{Modules/Files.rb → modules/files.rb} +14 -15
  14. data/lib/teamlab/{Modules/Group.rb → modules/group.rb} +6 -8
  15. data/lib/teamlab/{Modules/Mail.rb → modules/mail.rb} +34 -36
  16. data/lib/teamlab/{Modules/People.rb → modules/people.rb} +16 -18
  17. data/lib/teamlab/modules/portals.rb +15 -0
  18. data/lib/teamlab/{Modules/Project.rb → modules/project.rb} +46 -46
  19. data/lib/teamlab/{Modules/Settings.rb → modules/settings.rb} +1 -3
  20. data/lib/teamlab/{Request.rb → request.rb} +5 -5
  21. data/lib/teamlab/{Response.rb → response.rb} +3 -5
  22. data/lib/teamlab/version.rb +1 -1
  23. data/lib/teamlab.rb +18 -14
  24. data/spec/lib/calendar_spec.rb +2 -3
  25. data/spec/lib/community_spec.rb +3 -4
  26. data/spec/lib/crm_spec.rb +25 -26
  27. data/spec/lib/files_spec.rb +19 -19
  28. data/spec/lib/group_spec.rb +2 -2
  29. data/spec/lib/mail_spec.rb +2 -3
  30. data/spec/lib/people_spec.rb +2 -2
  31. data/spec/lib/portal_spec.rb +25 -0
  32. data/spec/lib/project_spec.rb +6 -8
  33. data/spec/lib/settings_spec.rb +2 -2
  34. data/spec/lib/{Teamlab_spec.rb → teamlab_spec.rb} +1 -5
  35. data/spec/spec_helper.rb +1 -2
  36. data/spec/support/http_data.rb +23 -23
  37. data/teamlab.gemspec +6 -6
  38. metadata +23 -16
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1985457a12122937b4544697668409ea3c4a3921
4
- data.tar.gz: bc3e5b322657b0d06f95cd64f15a4c35307588f8
3
+ metadata.gz: cd3e9c4178f3641076cfee00e402309a4f9d157f
4
+ data.tar.gz: deb6c25b5415f8832643d2485e0c8508010753bf
5
5
  SHA512:
6
- metadata.gz: 7148780e98038ead90bbd076d0fd085449c123139ae99da6fa78efd09b1864f5932148a3eda5847b212b1f6e3c36d00aa49502c3a031a83d28c42da8d928f0df
7
- data.tar.gz: e0096d9877a71468ae3f5b6b0844b8ddd9b2d34e24b3b0ea2f1ff8645f946adba4aabe3f294ac2ff31cf69e96f7c35d37001ac146b7b53d7de3d4af4241583d4
6
+ metadata.gz: 40d57ca2c2c9256a21e9bfce1456348ab7a4d4547358181e908db39bd3cbbb9877b04951cc9da33470ac099be0622d209b8e94177d18e47ad6bb902ede06cbb8
7
+ data.tar.gz: 8717620258d5a2dcecab548b56add918de0f049dfa60664a7cba8d2ef00b5217277cd118328abd1ce34c1d9affde2f4a5d0e8f2bc531c8b17cd9d0da2cc7c60c
data/.overcommit.yml ADDED
@@ -0,0 +1,34 @@
1
+ # Use this file to configure the Overcommit hooks you wish to use. This will
2
+ # extend the default configuration defined in:
3
+ # https://github.com/brigade/overcommit/blob/master/config/default.yml
4
+ #
5
+ # At the topmost level of this YAML file is a key representing type of hook
6
+ # being run (e.g. pre-commit, commit-msg, etc.). Within each type you can
7
+ # customize each hook, such as whether to only run it on certain files (via
8
+ # `include`), whether to only display output if it fails (via `quiet`), etc.
9
+ #
10
+ # For a complete list of hooks, see:
11
+ # https://github.com/brigade/overcommit/tree/master/lib/overcommit/hook
12
+ #
13
+ # For a complete list of options that you can use to customize hooks, see:
14
+ # https://github.com/brigade/overcommit#configuration
15
+ #
16
+ # Uncomment the following lines to make the configuration take effect.
17
+
18
+ #PreCommit:
19
+ # RuboCop:
20
+ # on_warn: fail # Treat all warnings as failures
21
+ #
22
+ # TrailingWhitespace:
23
+ # exclude:
24
+ # - '**/db/structure.sql' # Ignore trailing whitespace in generated files
25
+ #
26
+ #PostCheckout:
27
+ # ALL: # Special hook name that customizes all hooks of this type
28
+ # quiet: true # Change all post-checkout hooks to only display output on failure
29
+ #
30
+ # IndexTags:
31
+ # enabled: true # Generate a tags file with `ctags` each time HEAD changes
32
+ PreCommit:
33
+ RuboCop:
34
+ enabled: true
data/.rubocop.yml ADDED
@@ -0,0 +1,2 @@
1
+ inherit_from:
2
+ - .rubocop_todo.yml
data/.rubocop_todo.yml ADDED
@@ -0,0 +1,85 @@
1
+ # This configuration was generated by
2
+ # `rubocop --auto-gen-config`
3
+ # on 2015-12-24 18:35:59 +0300 using RuboCop version 0.35.1.
4
+ # The point is for the user to remove these configuration records
5
+ # one by one as the offenses are removed from the code base.
6
+ # Note that changes in the inspected code, or installation of new
7
+ # versions of RuboCop, may require this file to be generated again.
8
+
9
+ # Offense count: 1
10
+ Lint/RescueException:
11
+ Exclude:
12
+ - 'lib/teamlab/request.rb'
13
+
14
+ # Offense count: 4
15
+ Metrics/AbcSize:
16
+ Max: 24
17
+
18
+ # Offense count: 5
19
+ # Configuration parameters: CountComments.
20
+ Metrics/ClassLength:
21
+ Max: 557
22
+
23
+ # Offense count: 1
24
+ Metrics/CyclomaticComplexity:
25
+ Max: 9
26
+
27
+ # Offense count: 266
28
+ # Configuration parameters: AllowURI, URISchemes.
29
+ Metrics/LineLength:
30
+ Max: 418
31
+
32
+ # Offense count: 2
33
+ # Configuration parameters: CountComments.
34
+ Metrics/MethodLength:
35
+ Max: 14
36
+
37
+ # Offense count: 5
38
+ # Configuration parameters: CountKeywordArgs.
39
+ Metrics/ParameterLists:
40
+ Max: 7
41
+
42
+ # Offense count: 1
43
+ Metrics/PerceivedComplexity:
44
+ Max: 10
45
+
46
+ # Offense count: 66
47
+ Style/AccessorMethodName:
48
+ Exclude:
49
+ - 'lib/teamlab/modules/calendar.rb'
50
+ - 'lib/teamlab/modules/community.rb'
51
+ - 'lib/teamlab/modules/crm.rb'
52
+ - 'lib/teamlab/modules/files.rb'
53
+ - 'lib/teamlab/modules/group.rb'
54
+ - 'lib/teamlab/modules/mail.rb'
55
+ - 'lib/teamlab/modules/people.rb'
56
+ - 'lib/teamlab/modules/project.rb'
57
+ - 'lib/teamlab/modules/settings.rb'
58
+
59
+ # Offense count: 16
60
+ # Configuration parameters: Exclude.
61
+ Style/Documentation:
62
+ Exclude:
63
+ - 'spec/**/*'
64
+ - 'test/**/*'
65
+ - 'lib/teamlab.rb'
66
+ - 'lib/teamlab/config.rb'
67
+ - 'lib/teamlab/modules/calendar.rb'
68
+ - 'lib/teamlab/modules/community.rb'
69
+ - 'lib/teamlab/modules/crm.rb'
70
+ - 'lib/teamlab/modules/files.rb'
71
+ - 'lib/teamlab/modules/group.rb'
72
+ - 'lib/teamlab/modules/mail.rb'
73
+ - 'lib/teamlab/modules/people.rb'
74
+ - 'lib/teamlab/modules/portals.rb'
75
+ - 'lib/teamlab/modules/project.rb'
76
+ - 'lib/teamlab/modules/settings.rb'
77
+ - 'lib/teamlab/request.rb'
78
+ - 'lib/teamlab/response.rb'
79
+ - 'lib/teamlab/version.rb'
80
+
81
+ # Offense count: 1
82
+ # Configuration parameters: NamePrefix, NamePrefixBlacklist, NameWhitelist.
83
+ Style/PredicateName:
84
+ Exclude:
85
+ - 'lib/teamlab/modules/mail.rb'
data/.travis.yml ADDED
@@ -0,0 +1,6 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.2
4
+ matrix:
5
+ allow_failures:
6
+ - rvm: 2.2
data/Changelog.md CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change log
2
2
 
3
+ ## 0.4.0
4
+ * Add portal submodule with `Portal#invite_user_url` and `Portal#invite_visitor_url` methods
5
+ * Add rubocop support in project. Fix a lot of minor problems, should have no impact on existing working code
6
+
3
7
  ## 0.3.16
4
8
  * change method Settings#set_access
5
9
 
data/Gemfile CHANGED
@@ -2,3 +2,5 @@ source 'https://rubygems.org'
2
2
 
3
3
  # Specify your gem's dependencies in teamlab.gemspec
4
4
  gemspec
5
+ gem 'overcommit'
6
+ gem 'rubocop', require: false
data/Rakefile CHANGED
@@ -1,2 +1,11 @@
1
1
  require 'bundler'
2
+ require 'rspec/core/rake_task'
3
+
2
4
  Bundler::GemHelper.install_tasks
5
+
6
+ desc 'Test All'
7
+ task :test do
8
+ RSpec::Core::RakeTask.new(:spec)
9
+ Rake::Task['spec'].execute
10
+ end
11
+ task default: [:test]
@@ -1,17 +1,17 @@
1
1
  # encoding: utf-8
2
2
  require 'active_support/configurable'
3
- require_relative 'Request'
3
+ require_relative 'request'
4
4
 
5
5
  module Teamlab
6
6
  attr_reader :config
7
7
 
8
- def self.configure(&block)
8
+ def self.configure(&_block)
9
9
  @config ||= Config.new
10
10
  yield @config if block_given?
11
- auth_response = Teamlab::Request.new('authentication').post('', {:userName => @config.username, :password => @config.password}).body
11
+ auth_response = Teamlab::Request.new('authentication').post('', userName: @config.username, password: @config.password).body
12
12
  fail "Cannot get response token for #{auth_response}" if auth_response['response'].nil? || auth_response['response']['token'].nil?
13
13
  @config.token = auth_response['response']['token']
14
- @config.headers = { 'authorization' => @config.token}
14
+ @config.headers = { 'authorization' => @config.token }
15
15
  end
16
16
 
17
17
  def self.config
@@ -35,4 +35,4 @@ module Teamlab
35
35
  self.password = 'password'
36
36
  end
37
37
  end
38
- end
38
+ end
@@ -1,6 +1,5 @@
1
1
  module Teamlab
2
2
  class Calendar
3
-
4
3
  def initialize
5
4
  @request = Teamlab::Request.new('calendar')
6
5
  end
@@ -38,43 +37,43 @@ module Teamlab
38
37
  end
39
38
 
40
39
  def create_calendar(name, time_zone, options = {})
41
- @request.post('', {name: name, timeZone: time_zone}.merge(options))
40
+ @request.post('', { name: name, timeZone: time_zone }.merge(options))
42
41
  end
43
42
 
44
43
  def create_calendar_by_ical_link(ical_url, name, options = {})
45
- @request.post(%w(calendarurl), {iCalUrl: ical_url, name: name}.merge(options))
44
+ @request.post(%w(calendarurl), { iCalUrl: ical_url, name: name }.merge(options))
46
45
  end
47
46
 
48
- #============== TODO: OPTIONAL VARIABLES
47
+ #============== TODO: OPTIONAL VARIABLES
49
48
 
50
49
  def add_event(calendar_id, name, options = {})
51
- @request.post([calendar_id.to_s, 'event'], {name: name}.merge(options))
50
+ @request.post([calendar_id.to_s, 'event'], { name: name }.merge(options))
52
51
  end
53
52
 
54
53
  def import_ical(calendar_id, file)
55
54
  @request.post([calendar_id.to_s, 'import'], somefile: File.new(file))
56
55
  end
57
56
 
58
- #============== TODO: OPTIONAL VARIABLES
57
+ #============== TODO: OPTIONAL VARIABLES
59
58
 
60
59
  def update_calendar(calendar_id, name, time_zone, options = {})
61
- @request.put([calendar_id.to_s], {name: name, timeZone: time_zone}.merge(options))
60
+ @request.put([calendar_id.to_s], { name: name, timeZone: time_zone }.merge(options))
62
61
  end
63
62
 
64
- #============== TODO: OPTIONAL VARIABLES
63
+ #============== TODO: OPTIONAL VARIABLES
65
64
 
66
65
  def update_calendar_user_view(calendar_id, name, time_zone, options = {})
67
- @request.put([calendar_id.to_s, 'view'], {name: name, timeZone: time_zone}.merge(options))
66
+ @request.put([calendar_id.to_s, 'view'], { name: name, timeZone: time_zone }.merge(options))
68
67
  end
69
68
 
70
69
  def manage_subscriptions(states)
71
70
  @request.put(%w(subscriptions manage), states: states)
72
71
  end
73
72
 
74
- #============== TODO: OPTIONAL VARIABLES
73
+ #============== TODO: OPTIONAL VARIABLES
75
74
 
76
75
  def update_event(calendar_id, event_id, name, options = {})
77
- @request.put([calendar_id.to_s, event_id.to_s], {name: name}.merge(options))
76
+ @request.put([calendar_id.to_s, event_id.to_s], { name: name }.merge(options))
78
77
  end
79
78
 
80
79
  def delete_calendar(calendar_id)
@@ -85,7 +84,7 @@ module Teamlab
85
84
  @request.delete(['events', event_id.to_s])
86
85
  end
87
86
 
88
- #============== TODO: OPTIONAL VARIABLES
87
+ #============== TODO: OPTIONAL VARIABLES
89
88
 
90
89
  def remove_event(event_id, options = {})
91
90
  @request.delete(['events', event_id.to_s, 'custom'], options)
@@ -95,4 +94,4 @@ module Teamlab
95
94
  @request.delete(['events', event_id.to_s, 'unsubscribe'])
96
95
  end
97
96
  end
98
- end
97
+ end
@@ -37,15 +37,15 @@ module Teamlab
37
37
  end
38
38
 
39
39
  def create_post(title, content, options = {})
40
- @request.post(%w(blog), {title: title, content: content}.merge(options))
40
+ @request.post(%w(blog), { title: title, content: content }.merge(options))
41
41
  end
42
42
 
43
43
  def add_comment(post_id, content, options = {})
44
- @request.post(['blog', post_id.to_s, 'comment'], {content: content}.merge(options))
44
+ @request.post(['blog', post_id.to_s, 'comment'], { content: content }.merge(options))
45
45
  end
46
46
 
47
47
  def update_post(post_id, title, content, options = {})
48
- @request.put(['blog', post_id.to_s], {title: title, content: content}.merge(options))
48
+ @request.put(['blog', post_id.to_s], { title: title, content: content }.merge(options))
49
49
  end
50
50
 
51
51
  def delete_post(post_id)
@@ -93,11 +93,11 @@ module Teamlab
93
93
  end
94
94
 
95
95
  def add_bookmark(url, title, options = {})
96
- @request.post(%w(bookmark), {url: url, title: title}.merge(options))
96
+ @request.post(%w(bookmark), { url: url, title: title }.merge(options))
97
97
  end
98
98
 
99
99
  def add_comment_to_bookmark(bookmark_id, content, options = {})
100
- @request.post(['bookmark', bookmark_id.to_s, 'comment'], {content: content}.merge(options))
100
+ @request.post(['bookmark', bookmark_id.to_s, 'comment'], { content: content }.merge(options))
101
101
  end
102
102
 
103
103
  def get_all_events
@@ -121,7 +121,7 @@ module Teamlab
121
121
  end
122
122
 
123
123
  def create_event(title, content, options = {})
124
- @request.post(%w(event), {title: title, content: content}.merge(options))
124
+ @request.post(%w(event), { title: title, content: content }.merge(options))
125
125
  end
126
126
 
127
127
  def vote_for_event(event_id, *variants)
@@ -129,11 +129,11 @@ module Teamlab
129
129
  end
130
130
 
131
131
  def add_comment_to_event(event_id, content, options = {})
132
- @request.post(['event', event_id.to_s, 'comment'], {content: content}.merge(options))
132
+ @request.post(['event', event_id.to_s, 'comment'], { content: content }.merge(options))
133
133
  end
134
134
 
135
135
  def update_event(event_id, title, content, options = {})
136
- @request.put(['event', event_id.to_s], {title: title, content: content}.merge(options))
136
+ @request.put(['event', event_id.to_s], { title: title, content: content }.merge(options))
137
137
  end
138
138
 
139
139
  def get_forums
@@ -156,22 +156,22 @@ module Teamlab
156
156
  @request.get(['forum', '@search', query.to_s])
157
157
  end
158
158
 
159
- #==================================== TODO: ERROR
159
+ #==================================== TODO: ERROR
160
160
 
161
161
  def add_thread_to_category(category_id, category_name, thread_name, description)
162
162
  @request.post(%w(forum), categoryId: category_id, categoryName: category_name.to_s, threadName: thread_name, threadDescription: description)
163
163
  end
164
164
 
165
165
  def add_topic_to_thread(thread_id, subject, content, options = {})
166
- @request.post(['forum', thread_id], {subject: subject, content: content}.merge(options))
166
+ @request.post(['forum', thread_id], { subject: subject, content: content }.merge(options))
167
167
  end
168
168
 
169
169
  def add_post_to_topic(topic_id, subject, content, options = {})
170
- @request.post(['forum', 'topic', topic_id.to_s], {subject: subject, content: content}.merge(options))
170
+ @request.post(['forum', 'topic', topic_id.to_s], { subject: subject, content: content }.merge(options))
171
171
  end
172
172
 
173
173
  def update_topic_in_thread(topic_id, subject, options = {})
174
- @request.put(['forum', 'topic', topic_id.to_s], {subject: subject}.merge(options))
174
+ @request.put(['forum', 'topic', topic_id.to_s], { subject: subject }.merge(options))
175
175
  end
176
176
 
177
177
  def update_post_in_topic(topic_id, post_id, options = {})
@@ -211,7 +211,7 @@ module Teamlab
211
211
  end
212
212
 
213
213
  def create_page(name, body)
214
- @request.post(%w(wiki), {name: name.to_s, body: body.to_s})
214
+ @request.post(%w(wiki), name: name.to_s, body: body.to_s)
215
215
  end
216
216
 
217
217
  def upload_files(file)
@@ -219,11 +219,11 @@ module Teamlab
219
219
  end
220
220
 
221
221
  def create_wiki_page_comment(page_name, content, options = {})
222
- @request.post(['wiki', page_name.to_s, 'comment'], {content: content.to_s}.merge(options))
222
+ @request.post(['wiki', page_name.to_s, 'comment'], { content: content.to_s }.merge(options))
223
223
  end
224
224
 
225
225
  def update_wiki_page(name, body)
226
- @request.put(['wiki', name.to_s], {body: body.to_s})
226
+ @request.put(['wiki', name.to_s], body: body.to_s)
227
227
  end
228
228
 
229
229
  def update_wiki_page_comment(comment_id, body)
@@ -241,6 +241,5 @@ module Teamlab
241
241
  def delete_wiki_page_comment(id)
242
242
  @request.delete(['wiki', 'comment', id.to_s])
243
243
  end
244
-
245
244
  end
246
- end
245
+ end