restpack-group-client 0.0.36 → 0.0.37
Sign up to get free protection for your applications and to get access to all the features.
@@ -53,36 +53,17 @@ module RestPack
|
|
53
53
|
invitations = response[:invitations].map { |i| Invitation.new(i) } if response[:invitations]
|
54
54
|
groups = response[:groups].map { |g| Group.new(g, memberships, invitations) } if response[:groups]
|
55
55
|
group = Group.new(response[:group], memberships, invitations) if response[:group]
|
56
|
-
|
57
|
-
#TODO: GJ: get related users (from cache)
|
58
|
-
user_ids = memberships.map { |m| m.user_id }
|
59
|
-
p "NEW OPTIONS: #{@options.merge(domain: 'localhost:1112')}"
|
60
|
-
users = UserApi.new(@options.merge(domain: 'localhost:1112')).show_multiple(user_ids) #TODO: GJ: replace service domain in options
|
61
56
|
|
62
57
|
{
|
63
58
|
groups: groups,
|
64
59
|
group: group,
|
65
60
|
memberships: memberships,
|
66
61
|
invitations: invitations,
|
67
|
-
users: users
|
62
|
+
users: response[:users]
|
68
63
|
}
|
69
64
|
end
|
70
65
|
end
|
71
66
|
|
72
|
-
class UserApi < RestPack::Client::Api
|
73
|
-
def show_multiple(ids)
|
74
|
-
p "GJ: get User IDs: #{ids}"
|
75
|
-
users = []
|
76
|
-
ids.each do |id|
|
77
|
-
#TODO: GJ: use the user gem
|
78
|
-
response = http_get("/api/v1/users/#{id}.json")
|
79
|
-
p response
|
80
|
-
|
81
|
-
users << response[:user]
|
82
|
-
end
|
83
|
-
users
|
84
|
-
end
|
85
|
-
end
|
86
67
|
|
87
68
|
end
|
88
69
|
|