Module: RubyLokaliseApi::Rest::Keys
- Included in:
- RubyLokaliseApi::Rest
- Defined in:
- lib/ruby_lokalise_api/rest/keys.rb
Instance Method Summary collapse
-
#create_keys(project_id, req_params) ⇒ RubyLokaliseApi::Collections::Keys
Creates one or multiple keys in the project.
-
#destroy_key(project_id, key_id) ⇒ RubyLokaliseApi::Generics::DeletedResource
Deletes a single key from the project.
-
#destroy_keys(project_id, key_ids) ⇒ RubyLokaliseApi::Generics::DeletedResource
Deletes multiple keys from the project.
-
#key(project_id, key_id, req_params = {}) ⇒ RubyLokaliseApi::Resources::Key
Returns a single translation key.
-
#keys(project_id, req_params = {}) ⇒ RubyLokaliseApi::Collections::Keys
Returns project translation keys.
-
#update_key(project_id, key_id, req_params = {}) ⇒ RubyLokaliseApi::Resources::Key
Updates a single translation key.
-
#update_keys(project_id, req_params) ⇒ RubyLokaliseApi::Collections::Keys
Updates multiple keys in the project.
Instance Method Details
#create_keys(project_id, req_params) ⇒ RubyLokaliseApi::Collections::Keys
Creates one or multiple keys in the project
44 45 46 47 48 49 50 51 |
# File 'lib/ruby_lokalise_api/rest/keys.rb', line 44 def create_keys(project_id, req_params) name = 'Keys' params = { query: project_id, req: req_params.to_array_obj(:keys) } data = endpoint(name: name, params: params).do_post collection name, data end |
#destroy_key(project_id, key_id) ⇒ RubyLokaliseApi::Generics::DeletedResource
Deletes a single key from the project
89 90 91 92 93 94 95 |
# File 'lib/ruby_lokalise_api/rest/keys.rb', line 89 def destroy_key(project_id, key_id) params = { query: [project_id, key_id] } data = endpoint(name: 'Keys', params: params).do_delete RubyLokaliseApi::Generics::DeletedResource.new data.content end |
#destroy_keys(project_id, key_ids) ⇒ RubyLokaliseApi::Generics::DeletedResource
Deletes multiple keys from the project
103 104 105 106 107 108 109 |
# File 'lib/ruby_lokalise_api/rest/keys.rb', line 103 def destroy_keys(project_id, key_ids) params = { query: project_id, req: key_ids.to_array_obj(:keys) } data = endpoint(name: 'Keys', params: params).do_delete RubyLokaliseApi::Generics::DeletedResource.new data.content end |
#key(project_id, key_id, req_params = {}) ⇒ RubyLokaliseApi::Resources::Key
Returns a single translation key
15 16 17 18 19 20 21 |
# File 'lib/ruby_lokalise_api/rest/keys.rb', line 15 def key(project_id, key_id, req_params = {}) params = { query: [project_id, key_id], req: req_params } data = endpoint(name: 'Keys', params: params).do_get resource 'Key', data end |
#keys(project_id, req_params = {}) ⇒ RubyLokaliseApi::Collections::Keys
Returns project translation keys
29 30 31 32 33 34 35 36 |
# File 'lib/ruby_lokalise_api/rest/keys.rb', line 29 def keys(project_id, req_params = {}) name = 'Keys' params = { query: project_id, req: req_params } data = endpoint(name: name, params: params).do_get collection name, data end |
#update_key(project_id, key_id, req_params = {}) ⇒ RubyLokaliseApi::Resources::Key
Updates a single translation key
60 61 62 63 64 65 66 |
# File 'lib/ruby_lokalise_api/rest/keys.rb', line 60 def update_key(project_id, key_id, req_params = {}) params = { query: [project_id, key_id], req: req_params } data = endpoint(name: 'Keys', params: params).do_put resource 'Key', data end |
#update_keys(project_id, req_params) ⇒ RubyLokaliseApi::Collections::Keys
Updates multiple keys in the project
74 75 76 77 78 79 80 81 |
# File 'lib/ruby_lokalise_api/rest/keys.rb', line 74 def update_keys(project_id, req_params) name = 'Keys' params = { query: project_id, req: req_params.to_array_obj(:keys) } data = endpoint(name: name, params: params).do_put collection name, data end |