Module: Crowdin::ApiResources::Reports
- Defined in:
- lib/crowdin-api/api_resources/reports.rb
Instance Method Summary collapse
- #add_report_settings_template(query = {}, project_id = config.project_id) ⇒ Object
- #check_group_report_generation_status(group_id = nil, report_id = nil) ⇒ Object
- #check_organization_report_generation_status(report_id = nil) ⇒ Object
- #check_report_generation_status(report_id = nil, project_id = config.project_id) ⇒ Object
- #delete_report_settings_template(template_id = nil, project_id = config.project_id) ⇒ Object
- #download_group_report(group_id = nil, report_id = nil, destination = nil) ⇒ Object
- #download_organization_report(report_id = nil, destination = nil) ⇒ Object
- #download_report(report_id = nil, destination = nil, project_id = config.project_id) ⇒ Object
- #edit_report_settings_template(query = {}, template_id = nil, project_id = config.project_id) ⇒ Object
-
#generate_group_report(group_id = nil, query = {}) ⇒ Object
– For Enterprise mode only –.
- #generate_organization_report(query = {}) ⇒ Object
- #generate_report(query = {}, project_id = config.project_id) ⇒ Object
- #get_report_settings_template(template_id = nil, project_id = config.project_id) ⇒ Object
- #list_report_settings_templates(query = {}, project_id = config.project_id) ⇒ Object
Instance Method Details
#add_report_settings_template(query = {}, project_id = config.project_id) ⇒ Object
131 132 133 134 135 136 137 138 139 140 141 142 143 144 |
# File 'lib/crowdin-api/api_resources/reports.rb', line 131 def add_report_settings_template(query = {}, project_id = config.project_id) project_id || raise_project_id_is_required_error %i[name currency unit mode config].each do |param| query[param] || raise_parameter_is_required_error(param) end request = Web::Request.new( connection, :post, "#{config.target_api_url}/projects/#{project_id}/reports/settings-templates", { params: query } ) Web::SendRequest.new(request).perform end |
#check_group_report_generation_status(group_id = nil, report_id = nil) ⇒ Object
57 58 59 60 61 62 63 64 65 66 67 68 |
# File 'lib/crowdin-api/api_resources/reports.rb', line 57 def check_group_report_generation_status(group_id = nil, report_id = nil) enterprise_mode? || raise_only_for_enterprise_mode_error group_id || raise_parameter_is_required_error(:group_id) report_id || raise_parameter_is_required_error(:report_id) request = Web::Request.new( connection, :get, "#{config.target_api_url}/groups/#{group_id}/reports/#{report_id}" ) Web::SendRequest.new(request).perform end |
#check_organization_report_generation_status(report_id = nil) ⇒ Object
95 96 97 98 99 100 101 102 103 104 105 |
# File 'lib/crowdin-api/api_resources/reports.rb', line 95 def check_organization_report_generation_status(report_id = nil) enterprise_mode? || raise_only_for_enterprise_mode_error report_id || raise_parameter_is_required_error(:report_id) request = Web::Request.new( connection, :get, "#{config.target_api_url}/reports/#{report_id}" ) Web::SendRequest.new(request).perform end |
#check_report_generation_status(report_id = nil, project_id = config.project_id) ⇒ Object
18 19 20 21 22 23 24 25 26 27 28 |
# File 'lib/crowdin-api/api_resources/reports.rb', line 18 def check_report_generation_status(report_id = nil, project_id = config.project_id) report_id || raise_parameter_is_required_error(:report_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/reports/#{report_id}" ) Web::SendRequest.new(request).perform end |
#delete_report_settings_template(template_id = nil, project_id = config.project_id) ⇒ Object
171 172 173 174 175 176 177 178 179 180 181 |
# File 'lib/crowdin-api/api_resources/reports.rb', line 171 def delete_report_settings_template(template_id = nil, project_id = config.project_id) project_id || raise_project_id_is_required_error template_id || raise_parameter_is_required_error(:template_id) request = Web::Request.new( connection, :delete, "#{config.target_api_url}/projects/#{project_id}/reports/settings-templates/#{template_id}" ) Web::SendRequest.new(request).perform end |
#download_group_report(group_id = nil, report_id = nil, destination = nil) ⇒ Object
70 71 72 73 74 75 76 77 78 79 80 81 |
# File 'lib/crowdin-api/api_resources/reports.rb', line 70 def download_group_report(group_id = nil, report_id = nil, destination = nil) enterprise_mode? || raise_only_for_enterprise_mode_error group_id || raise_parameter_is_required_error(:group_id) report_id || raise_parameter_is_required_error(:report_id) request = Web::Request.new( connection, :get, "#{config.target_api_url}/groups/#{group_id}/reports/#{report_id}/download" ) Web::SendRequest.new(request, destination).perform end |
#download_organization_report(report_id = nil, destination = nil) ⇒ Object
107 108 109 110 111 112 113 114 115 116 117 |
# File 'lib/crowdin-api/api_resources/reports.rb', line 107 def download_organization_report(report_id = nil, destination = nil) enterprise_mode? || raise_only_for_enterprise_mode_error report_id || raise_parameter_is_required_error(:report_id) request = Web::Request.new( connection, :get, "#{config.target_api_url}/reports/#{report_id}/download" ) Web::SendRequest.new(request, destination).perform end |
#download_report(report_id = nil, destination = nil, project_id = config.project_id) ⇒ Object
30 31 32 33 34 35 36 37 38 39 40 |
# File 'lib/crowdin-api/api_resources/reports.rb', line 30 def download_report(report_id = nil, destination = nil, project_id = config.project_id) report_id || raise_parameter_is_required_error(:report_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/reports/#{report_id}/download" ) Web::SendRequest.new(request, destination).perform end |
#edit_report_settings_template(query = {}, template_id = nil, project_id = config.project_id) ⇒ Object
158 159 160 161 162 163 164 165 166 167 168 169 |
# File 'lib/crowdin-api/api_resources/reports.rb', line 158 def edit_report_settings_template(query = {}, template_id = nil, project_id = config.project_id) project_id || raise_project_id_is_required_error template_id || raise_parameter_is_required_error(:template_id) request = Web::Request.new( connection, :patch, "#{config.target_api_url}/projects/#{project_id}/reports/settings-templates/#{template_id}", { params: query } ) Web::SendRequest.new(request).perform end |
#generate_group_report(group_id = nil, query = {}) ⇒ Object
– For Enterprise mode only –
44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/crowdin-api/api_resources/reports.rb', line 44 def generate_group_report(group_id = nil, query = {}) enterprise_mode? || raise_only_for_enterprise_mode_error group_id || raise_parameter_is_required_error(:group_id) request = Web::Request.new( connection, :post, "#{config.target_api_url}/groups/#{group_id}/reports", { params: query } ) Web::SendRequest.new(request).perform end |
#generate_organization_report(query = {}) ⇒ Object
83 84 85 86 87 88 89 90 91 92 93 |
# File 'lib/crowdin-api/api_resources/reports.rb', line 83 def generate_organization_report(query = {}) enterprise_mode? || raise_only_for_enterprise_mode_error request = Web::Request.new( connection, :post, "#{config.target_api_url}/reports", { params: query } ) Web::SendRequest.new(request).perform end |
#generate_report(query = {}, project_id = config.project_id) ⇒ Object
6 7 8 9 10 11 12 13 14 15 16 |
# File 'lib/crowdin-api/api_resources/reports.rb', line 6 def generate_report(query = {}, project_id = config.project_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :post, "#{config.target_api_url}/projects/#{project_id}/reports", { params: query } ) Web::SendRequest.new(request).perform end |
#get_report_settings_template(template_id = nil, project_id = config.project_id) ⇒ Object
146 147 148 149 150 151 152 153 154 155 156 |
# File 'lib/crowdin-api/api_resources/reports.rb', line 146 def get_report_settings_template(template_id = nil, project_id = config.project_id) project_id || raise_project_id_is_required_error template_id || raise_parameter_is_required_error(:template_id) request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/reports/settings-templates/#{template_id}" ) Web::SendRequest.new(request).perform end |
#list_report_settings_templates(query = {}, project_id = config.project_id) ⇒ Object
119 120 121 122 123 124 125 126 127 128 129 |
# File 'lib/crowdin-api/api_resources/reports.rb', line 119 def list_report_settings_templates(query = {}, project_id = config.project_id) project_id || raise_project_id_is_required_error request = Web::Request.new( connection, :get, "#{config.target_api_url}/projects/#{project_id}/reports/settings-templates", { params: query } ) Web::SendRequest.new(request).perform end |