cliskip2 0.0.6 → 0.0.7

Sign up to get free protection for your applications and to get access to all the features.
@@ -83,7 +83,7 @@ module Cliskip2
83
83
  inserted_users_count = inserted_users_count + 1
84
84
  end
85
85
  else
86
- log_text = " Skipped email: #{email}"
86
+ log_text = " Skipped to sync users. because of blank-email."
87
87
  log_texts << log_text
88
88
  logger.info log_text
89
89
  skipped_users_count = skipped_users_count + 1
@@ -145,9 +145,42 @@ module Cliskip2
145
145
 
146
146
  # Leave from the community by the target-community and params
147
147
  # @return [Cliskip2::CommunityParticipation]
148
- def leave_community community, community_participation
149
- community_participation_attr = delete("/tenants/#{current_user.tenant_id}/communities/#{community.id}/community_participations/#{community_participation.id}.json")
148
+ def leave_community community_participation
149
+ community_participation_attr = delete("/tenants/#{current_user.tenant_id}/communities/#{community_participation.community_id}/community_participations/#{community_participation.id}.json")
150
150
  Cliskip2::CommunityParticipation.new(community_participation_attr['community_participation'])
151
151
  end
152
+
153
+ # Search communitiy_participatioms by some conditions
154
+ # @return [Array<Cliskip2::Community>]
155
+ def search_members params
156
+ if user_id = params.delete(:user_id)
157
+ community_participation_attrs = get("/admin/tenants/#{current_user.tenant_id}/users/#{user_id}/community_participations.json", params)
158
+ community_participation_attrs.map { |community_participation_attr| Cliskip2::CommunityParticipation.new(community_participation_attr['community_participation']) }
159
+ else
160
+ []
161
+ end
162
+ end
163
+
164
+ # Join some communities by some conditions
165
+ # @return [Array<Cliskip2::CommunityParticipation>]
166
+ def join_communities params
167
+ if user_id = params.delete(:user_id)
168
+ community_participation_attrs = post("/admin/tenants/#{current_user.tenant_id}/users/#{user_id}/community_participations/join_communities.json", params)
169
+ community_participation_attrs.map { |community_participation_attr| Cliskip2::CommunityParticipation.new(community_participation_attr['community_participation']) }
170
+ else
171
+ []
172
+ end
173
+ end
174
+
175
+ # Leave from some communities by some conditions
176
+ # @return [Array<Cliskip2::CommunityParticipation>]
177
+ def leave_communities params
178
+ if user_id = params.delete(:user_id)
179
+ community_participation_attrs = delete("/admin/tenants/#{current_user.tenant_id}/users/#{user_id}/community_participations/leave_communities.json", params)
180
+ community_participation_attrs.map { |community_participation_attr| Cliskip2::CommunityParticipation.new(community_participation_attr['community_participation']) }
181
+ else
182
+ []
183
+ end
184
+ end
152
185
  end
153
186
  end
@@ -3,7 +3,7 @@ require 'cliskip2/base'
3
3
 
4
4
  module Cliskip2
5
5
  class CommunityParticipation < Cliskip2::Base
6
- lazy_attr_reader :id, :user_id, :community_id, :admin
6
+ lazy_attr_reader :id, :user_id, :community_id, :admin, :community_name
7
7
  end
8
8
  end
9
9
 
@@ -1,3 +1,3 @@
1
1
  module Cliskip2
2
- VERSION = "0.0.6"
2
+ VERSION = "0.0.7"
3
3
  end
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.6
4
+ version: 0.0.7
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors: