Class: Lifen::Flow
Instance Method Summary collapse
Instance Method Details
#attach_users(users_to_attach) ⇒ Object
31 32 33 34 35 36 37 38 39 40 41 |
# File 'lib/lifen/flow.rb', line 31 def attach_users(users_to_attach) params = extract_users_uuids(users_to_attach) json = client.post("central/api/chats/#{uuid}/attach_users?rel=activeUsers", params) build_users(json) check_if_users_were_attached!(users_to_attach) self end |
#create ⇒ Object
9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 |
# File 'lib/lifen/flow.rb', line 9 def create users_to_attach = users params = {title: title, users: extract_users_uuids(users_to_attach)} json = client.post("central/api/chats?rel=activeUsers", params) json_flow = json.first flow = self.class.new(json_flow) self.user = user self.uuid = flow.uuid self.title = flow.title build_users(json_flow) check_if_users_were_attached!(users_to_attach) self end |
#detach_users(users_to_detach) ⇒ Object
43 44 45 46 47 48 49 50 51 52 53 |
# File 'lib/lifen/flow.rb', line 43 def detach_users(users_to_detach) params = extract_users_uuids(users_to_detach) json = client.post("central/api/chats/#{uuid}/detach_users?rel=activeUsers", params) build_users(json) check_if_users_were_detached!(users_to_detach) self end |