Module: Crowdin::ApiResources::Teams

Defined in:
lib/crowdin-api/api_resources/teams.rb

Instance Method Summary collapse

Instance Method Details

#add_team(query = {}) ⇒ Object

Parameters:

  • query (Hash) (defaults to: {}) —

    Request Body



39
40
41
42
43
44
45
46
47
48
49
# File 'lib/crowdin-api/api_resources/teams.rb', line 39

def add_team(query = {})
  enterprise_mode? || raise_only_for_enterprise_mode_error

  request = Web::Request.new(
    connection,
    :post,
    "#{config.target_api_url}/teams",
    { params: query }
  )
  Web::SendRequest.new(request).perform
end

#add_team_members(team_id = nil, query = {}) ⇒ Object

Parameters:

  • team_id (Integer) (defaults to: nil) —

    Team Identifier

  • query (Hash) (defaults to: {}) —

    Request Body



116
117
118
119
120
121
122
123
124
125
126
127
# File 'lib/crowdin-api/api_resources/teams.rb', line 116

def add_team_members(team_id = nil, query = {})
  enterprise_mode? || raise_only_for_enterprise_mode_error
  team_id          || raise_parameter_is_required_error(:team_id)

  request = Web::Request.new(
    connection,
    :post,
    "#{config.target_api_url}/teams/#{team_id}/members",
    { params: query }
  )
  Web::SendRequest.new(request).perform
end

#add_team_to_project(query = {}, project_id = config.project_id) ⇒ Object

Parameters:

  • query (Hash) (defaults to: {}) —

    Request Body



10
11
12
13
14
15
16
17
18
19
20
21
# File 'lib/crowdin-api/api_resources/teams.rb', line 10

def add_team_to_project(query = {}, project_id = config.project_id)
  enterprise_mode? || raise_only_for_enterprise_mode_error
  project_id       || raise_project_id_is_required_error

  request = Web::Request.new(
    connection,
    :post,
    "#{config.target_api_url}/projects/#{project_id}/teams",
    { params: query }
  )
  Web::SendRequest.new(request).perform
end

#delete_all_team_members(team_id = nil) ⇒ Object

Parameters:

  • team_id (Integer) (defaults to: nil) —

    Team Identifier



131
132
133
134
135
136
137
138
139
140
141
# File 'lib/crowdin-api/api_resources/teams.rb', line 131

def delete_all_team_members(team_id = nil)
  enterprise_mode? || raise_only_for_enterprise_mode_error
  team_id          || raise_parameter_is_required_error(:team_id)

  request = Web::Request.new(
    connection,
    :delete,
    "#{config.target_api_url}/teams/#{team_id}/members"
  )
  Web::SendRequest.new(request).perform
end

#delete_team(team_id = nil) ⇒ Object

Parameters:

  • team_id (Integer) (defaults to: nil) —

    Team Identifier



69
70
71
72
73
74
75
76
77
78
79
# File 'lib/crowdin-api/api_resources/teams.rb', line 69

def delete_team(team_id = nil)
  enterprise_mode? || raise_only_for_enterprise_mode_error
  team_id          || raise_parameter_is_required_error(:team_id)

  request = Web::Request.new(
    connection,
    :delete,
    "#{config.target_api_url}/teams/#{team_id}"
  )
  Web::SendRequest.new(request).perform
end

#delete_team_member(team_id = nil, member_id = nil) ⇒ Object

Parameters:

  • team_id (Integer) (defaults to: nil) —

    Team Identifier

  • member_id (Integer) (defaults to: nil) —

    Team Member Identifier



146
147
148
149
150
151
152
153
154
155
156
157
# File 'lib/crowdin-api/api_resources/teams.rb', line 146

def delete_team_member(team_id = nil, member_id = nil)
  enterprise_mode? || raise_only_for_enterprise_mode_error
  team_id          || raise_parameter_is_required_error(:team_id)
  member_id        || raise_parameter_is_required_error(:member_id)

  request = Web::Request.new(
    connection,
    :delete,
    "#{config.target_api_url}/teams/#{team_id}/members/#{member_id}"
  )
  Web::SendRequest.new(request).perform
end

#edit_team(team_id = nil, query = {}) ⇒ Object

Parameters:

  • team_id (Integer) (defaults to: nil) —

    Team Identifier

  • query (Hash) (defaults to: {}) —

    Request Body



84
85
86
87
88
89
90
91
92
93
94
95
# File 'lib/crowdin-api/api_resources/teams.rb', line 84

def edit_team(team_id = nil, query = {})
  enterprise_mode? || raise_only_for_enterprise_mode_error
  team_id          || raise_parameter_is_required_error(:team_id)

  request = Web::Request.new(
    connection,
    :patch,
    "#{config.target_api_url}/teams/#{team_id}",
    { params: query }
  )
  Web::SendRequest.new(request).perform
end

#edit_team_projects_permissions(team_id, body = []) ⇒ Object

Parameters:

  • team_id (Integer) —

    Team Identifier

  • body (Array) (defaults to: []) —

    Request Body



221
222
223
224
225
226
227
228
229
230
231
# File 'lib/crowdin-api/api_resources/teams.rb', line 221

def edit_team_projects_permissions(team_id, body = [])
  enterprise_mode? || raise_only_for_enterprise_mode_error

  request = Web::Request.new(
    connection,
    :patch,
    "#{config.target_api_url}/teams/#{team_id}/projects/permissions",
    { params: body }
  )
  Web::SendRequest.new(request).perform
end

#get_group_team(group_id, team_id) ⇒ Object

Parameters:

  • group_id (Integer) —

    Group Identifier

  • team_id (Integer) —

    Team Identifier



192
193
194
195
196
197
198
199
200
201
# File 'lib/crowdin-api/api_resources/teams.rb', line 192

def get_group_team(group_id, team_id)
  enterprise_mode? || raise_only_for_enterprise_mode_error

  request = Web::Request.new(
    connection,
    :get,
    "#{config.target_api_url}/groups/#{group_id}/teams/#{team_id}"
  )
  Web::SendRequest.new(request).perform
end

#get_team(team_id = nil, query = {}) ⇒ Object

Parameters:

  • team_id (Integer) (defaults to: nil) —

    Team Identifier

  • query (Hash) (defaults to: {}) —

    Request Query Parameters



54
55
56
57
58
59
60
61
62
63
64
65
# File 'lib/crowdin-api/api_resources/teams.rb', line 54

def get_team(team_id = nil, query = {})
  enterprise_mode? || raise_only_for_enterprise_mode_error
  team_id          || raise_parameter_is_required_error(:team_id)

  request = Web::Request.new(
    connection,
    :get,
    "#{config.target_api_url}/teams/#{team_id}",
    { params: query }
  )
  Web::SendRequest.new(request).perform
end

#list_group_teams(group_id, query = {}) ⇒ Object

Parameters:

  • group_id (Integer) —

    Group Identifier

  • query (Hash) (defaults to: {}) —

    Request Query Parameters



162
163
164
165
166
167
168
169
170
171
172
# File 'lib/crowdin-api/api_resources/teams.rb', line 162

def list_group_teams(group_id, query = {})
  enterprise_mode? || raise_only_for_enterprise_mode_error

  request = Web::Request.new(
    connection,
    :get,
    "#{config.target_api_url}/groups/#{group_id}/teams",
    { params: query }
  )
  Web::SendRequest.new(request).perform
end

#list_team_projects_permissions(team_id, query = {}) ⇒ Object

Parameters:

  • team_id (Integer) —

    Team Identifier

  • query (Hash) (defaults to: {}) —

    Request Query Parameters



206
207
208
209
210
211
212
213
214
215
216
# File 'lib/crowdin-api/api_resources/teams.rb', line 206

def list_team_projects_permissions(team_id, query = {})
  enterprise_mode? || raise_only_for_enterprise_mode_error

  request = Web::Request.new(
    connection,
    :get,
    "#{config.target_api_url}/teams/#{team_id}/projects/permissions",
    { params: query }
  )
  Web::SendRequest.new(request).perform
end

#list_teams(query = {}) ⇒ Object

Parameters:

  • query (Hash) (defaults to: {}) —

    Request Query Parameters



25
26
27
28
29
30
31
32
33
34
35
# File 'lib/crowdin-api/api_resources/teams.rb', line 25

def list_teams(query = {})
  enterprise_mode? || raise_only_for_enterprise_mode_error

  request = Web::Request.new(
    connection,
    :get,
    "#{config.target_api_url}/teams",
    { params: query }
  )
  Web::SendRequest.new(request).perform
end

#team_members_list(team_id = nil, query = {}) ⇒ Object

Parameters:

  • team_id (Integer) (defaults to: nil) —

    Team Identifier

  • query (Hash) (defaults to: {}) —

    Request Query Parameters



100
101
102
103
104
105
106
107
108
109
110
111
# File 'lib/crowdin-api/api_resources/teams.rb', line 100

def team_members_list(team_id = nil, query = {})
  enterprise_mode? || raise_only_for_enterprise_mode_error
  team_id          || raise_parameter_is_required_error(:team_id)

  request = Web::Request.new(
    connection,
    :get,
    "#{config.target_api_url}/teams/#{team_id}/members",
    { params: query }
  )
  Web::SendRequest.new(request).perform
end

#update_group_teams(group_id, body = []) ⇒ Object

Parameters:

  • group_id (Integer) —

    Group Identifier

  • body (Array) (defaults to: []) —

    Request Body



177
178
179
180
181
182
183
184
185
186
187
# File 'lib/crowdin-api/api_resources/teams.rb', line 177

def update_group_teams(group_id, body = [])
  enterprise_mode? || raise_only_for_enterprise_mode_error

  request = Web::Request.new(
    connection,
    :patch,
    "#{config.target_api_url}/groups/#{group_id}/teams",
    { params: body }
  )
  Web::SendRequest.new(request).perform
end