Module: Crowdin::ApiResources::Teams

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

Instance Method Summary collapse

Instance Method Details

#add_team(query = {}) ⇒ Object



33
34
35
36
37
38
39
40
41
42
43
# File 'lib/crowdin-api/api_resources/teams.rb', line 33

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



96
97
98
99
100
101
102
103
104
105
106
107
# File 'lib/crowdin-api/api_resources/teams.rb', line 96

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

– For Enterprise mode only –



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

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



109
110
111
112
113
114
115
116
117
118
119
# File 'lib/crowdin-api/api_resources/teams.rb', line 109

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



58
59
60
61
62
63
64
65
66
67
68
# File 'lib/crowdin-api/api_resources/teams.rb', line 58

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



121
122
123
124
125
126
127
128
129
130
131
132
# File 'lib/crowdin-api/api_resources/teams.rb', line 121

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



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

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

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



45
46
47
48
49
50
51
52
53
54
55
56
# File 'lib/crowdin-api/api_resources/teams.rb', line 45

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_teams(query = {}) ⇒ Object



21
22
23
24
25
26
27
28
29
30
31
# File 'lib/crowdin-api/api_resources/teams.rb', line 21

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



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

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