Module: RubyLokaliseApi::Rest::Contributors
- Included in:
- RubyLokaliseApi::Rest
- Defined in:
- lib/ruby_lokalise_api/rest/contributors.rb
Instance Method Summary collapse
-
#contributor(project_id, contributor_id) ⇒ RubyLokaliseApi::Resources::Contributor
Returns a single contributor.
-
#contributors(project_id, req_params = {}) ⇒ RubyLokaliseApi::Collections::Contributors
Returns project contributors.
-
#create_contributors(project_id, req_params) ⇒ RubyLokaliseApi::Collections::Contributors
Creates one or multiple contributors for a project.
-
#destroy_contributor(project_id, contributor_id) ⇒ RubyLokaliseApi::Generics::DeletedResource
Deletes a single contributor from the project.
-
#update_contributor(project_id, contributor_id, req_params) ⇒ RubyLokaliseApi::Resources::Contributor
Updates a contributor for a project.
Instance Method Details
#contributor(project_id, contributor_id) ⇒ RubyLokaliseApi::Resources::Contributor
Returns a single contributor
14 15 16 17 18 19 20 |
# File 'lib/ruby_lokalise_api/rest/contributors.rb', line 14 def contributor(project_id, contributor_id) params = { query: [project_id, contributor_id] } data = endpoint(name: 'Contributors', params: params).do_get resource 'Contributor', data end |
#contributors(project_id, req_params = {}) ⇒ RubyLokaliseApi::Collections::Contributors
Returns project contributors
28 29 30 31 32 33 34 35 |
# File 'lib/ruby_lokalise_api/rest/contributors.rb', line 28 def contributors(project_id, req_params = {}) name = 'Contributors' params = { query: project_id, req: req_params } data = endpoint(name: name, params: params).do_get collection name, data end |
#create_contributors(project_id, req_params) ⇒ RubyLokaliseApi::Collections::Contributors
Creates one or multiple contributors for a project
43 44 45 46 47 48 49 50 |
# File 'lib/ruby_lokalise_api/rest/contributors.rb', line 43 def create_contributors(project_id, req_params) name = 'Contributors' params = { query: project_id, req: req_params.to_array_obj(:contributors) } data = endpoint(name: name, params: params).do_post collection name, data end |
#destroy_contributor(project_id, contributor_id) ⇒ RubyLokaliseApi::Generics::DeletedResource
Deletes a single contributor from the project
73 74 75 76 77 78 79 |
# File 'lib/ruby_lokalise_api/rest/contributors.rb', line 73 def destroy_contributor(project_id, contributor_id) params = { query: [project_id, contributor_id] } data = endpoint(name: 'Contributors', params: params).do_delete RubyLokaliseApi::Generics::DeletedResource.new data.content end |
#update_contributor(project_id, contributor_id, req_params) ⇒ RubyLokaliseApi::Resources::Contributor
Updates a contributor for a project
59 60 61 62 63 64 65 |
# File 'lib/ruby_lokalise_api/rest/contributors.rb', line 59 def update_contributor(project_id, contributor_id, req_params) params = { query: [project_id, contributor_id], req: req_params } data = endpoint(name: 'Contributors', params: params).do_put resource 'Contributor', data end |