Module: RubyLokaliseApi::Rest::TeamUserGroups

Included in:
RubyLokaliseApi::Rest
Defined in:
lib/ruby_lokalise_api/rest/team_user_groups.rb

Instance Method Summary collapse

Instance Method Details

#add_members_to_group(team_id, group_id, user_ids) ⇒ RubyLokaliseApi::Resources::TeamUserGroup

Adds members to the group

Parameters:

  • team_id (String, Integer)
  • group_id (String, Integer)
  • user_ids (Array, String)

Returns:

See Also:



117
118
119
120
121
122
123
# File 'lib/ruby_lokalise_api/rest/team_user_groups.rb', line 117

def add_members_to_group(team_id, group_id, user_ids)
  params = { query: [team_id, group_id, :members, :add], req: user_ids.to_array_obj(:users) }

  data = endpoint(name: 'TeamUserGroups', params: params).do_put

  resource 'TeamUserGroup', data
end

#add_projects_to_group(team_id, group_id, project_ids) ⇒ RubyLokaliseApi::Resources::TeamUserGroup

Adds projects to the group

Parameters:

  • team_id (String, Integer)
  • group_id (String, Integer)
  • project_ids (Array, String)

Returns:

See Also:



87
88
89
90
91
92
93
# File 'lib/ruby_lokalise_api/rest/team_user_groups.rb', line 87

def add_projects_to_group(team_id, group_id, project_ids)
  params = { query: [team_id, group_id, :projects, :add], req: project_ids.to_array_obj(:projects) }

  data = endpoint(name: 'TeamUserGroups', params: params).do_put

  resource 'TeamUserGroup', data
end

#create_team_user_group(team_id, req_params) ⇒ RubyLokaliseApi::Resources::TeamUserGroup

Creates a team user group

Parameters:

  • team_id (String, Integer)
  • req_params (Hash)

Returns:

See Also:



43
44
45
46
47
48
49
# File 'lib/ruby_lokalise_api/rest/team_user_groups.rb', line 43

def create_team_user_group(team_id, req_params)
  params = { query: team_id, req: req_params }

  response = endpoint(name: 'TeamUserGroups', params: params).do_post

  resource 'TeamUserGroup', response
end

#destroy_team_user_group(team_id, group_id) ⇒ RubyLokaliseApi::Generics::DeletedResource

Deletes a team user group

Parameters:

  • team_id (String, Integer)
  • group_id (String, Integer)

Returns:

See Also:



72
73
74
75
76
77
78
# File 'lib/ruby_lokalise_api/rest/team_user_groups.rb', line 72

def destroy_team_user_group(team_id, group_id)
  params = { query: [team_id, group_id] }

  data = endpoint(name: 'TeamUserGroups', params: params).do_delete

  RubyLokaliseApi::Generics::DeletedResource.new data.content
end

#remove_members_from_group(team_id, group_id, user_ids) ⇒ RubyLokaliseApi::Resources::TeamUserGroup

Removes members from the group

Parameters:

  • team_id (String, Integer)
  • group_id (String, Integer)
  • user_ids (Array, String)

Returns:

See Also:



132
133
134
135
136
137
138
# File 'lib/ruby_lokalise_api/rest/team_user_groups.rb', line 132

def remove_members_from_group(team_id, group_id, user_ids)
  params = { query: [team_id, group_id, :members, :remove], req: user_ids.to_array_obj(:users) }

  data = endpoint(name: 'TeamUserGroups', params: params).do_put

  resource 'TeamUserGroup', data
end

#remove_projects_from_group(team_id, group_id, project_ids) ⇒ RubyLokaliseApi::Resources::TeamUserGroup

Removes projects from the group

Parameters:

  • team_id (String, Integer)
  • group_id (String, Integer)
  • project_ids (Array, String)

Returns:

See Also:



102
103
104
105
106
107
108
# File 'lib/ruby_lokalise_api/rest/team_user_groups.rb', line 102

def remove_projects_from_group(team_id, group_id, project_ids)
  params = { query: [team_id, group_id, :projects, :remove], req: project_ids.to_array_obj(:projects) }

  data = endpoint(name: 'TeamUserGroups', params: params).do_put

  resource 'TeamUserGroup', data
end

#team_user_group(team_id, group_id) ⇒ RubyLokaliseApi::Resources::TeamUserGroup

Returns a single team user group

Parameters:

  • team_id (String, Integer)
  • group_id (String, Integer)

Returns:

See Also:



29
30
31
32
33
34
35
# File 'lib/ruby_lokalise_api/rest/team_user_groups.rb', line 29

def team_user_group(team_id, group_id)
  params = { query: [team_id, group_id] }

  response = endpoint(name: 'TeamUserGroups', params: params).do_get

  resource 'TeamUserGroup', response
end

#team_user_groups(team_id, req_params = {}) ⇒ RubyLokaliseApi::Collections::TeamUserGroups

Returns team user groups

Parameters:

  • team_id (Integer, String)
  • req_params (Hash) (defaults to: {})

Returns:

See Also:



14
15
16
17
18
19
20
21
# File 'lib/ruby_lokalise_api/rest/team_user_groups.rb', line 14

def team_user_groups(team_id, req_params = {})
  name = 'TeamUserGroups'
  params = { query: team_id, req: req_params }

  data = endpoint(name: name, params: params).do_get

  collection name, data
end

#update_team_user_group(team_id, group_id, req_params = {}) ⇒ RubyLokaliseApi::Resources::TeamUserGroup

Updates a team user group

Parameters:

  • team_id (String, Integer)
  • group_id (String, Integer)
  • req_params (Hash) (defaults to: {})

Returns:

See Also:



58
59
60
61
62
63
64
# File 'lib/ruby_lokalise_api/rest/team_user_groups.rb', line 58

def update_team_user_group(team_id, group_id, req_params = {})
  params = { query: [team_id, group_id], req: req_params }

  data = endpoint(name: 'TeamUserGroups', params: params).do_put

  resource 'TeamUserGroup', data
end