Class: RubyLokaliseApi::Resources::File

Inherits:
Base
  • Object
show all
Defined in:
lib/ruby_lokalise_api/resources/file.rb

Constant Summary

Constants included from RubyLokaliseApi::Request

RubyLokaliseApi::Request::PAGINATION_HEADERS

Constants included from Utils::AttributeHelpers

Utils::AttributeHelpers::UNIFIED_RESOURCES

Instance Attribute Summary

Attributes inherited from Base

#branch, #client, #key_id, #path, #project_id, #raw_data, #team_id, #user_id

Class Method Summary collapse

Methods inherited from Base

#[], create, destroy, #extract_common_attributes_for, find, #id_from, #infer_path_from, inherited, #initialize, #path_with_id, #populate_attributes_for, supports, update

Methods included from BaseRequest

#delete, #get, #patch, #post, #put

Methods included from Connection

#connection

Methods included from JsonHandler

#custom_dump, #custom_load

Methods included from Utils::AttributeHelpers

#attributes_for, #data_key_for, #id_key_for

Methods included from Utils::EndpointHelpers

#path_from

Constructor Details

This class inherits a constructor from RubyLokaliseApi::Resources::Base

Class Method Details

.download(client, path, params) ⇒ Object



7
8
9
# File 'lib/ruby_lokalise_api/resources/file.rb', line 7

def download(client, path, params)
  post(path, client, params)['content']
end

.endpoint(project_id, action = '') ⇒ Object



17
18
19
20
# File 'lib/ruby_lokalise_api/resources/file.rb', line 17

def endpoint(project_id, action = '')
  path_from projects: project_id,
            files: action
end

.upload(client, path, params) ⇒ Object



11
12
13
14
15
# File 'lib/ruby_lokalise_api/resources/file.rb', line 11

def upload(client, path, params)
  klass = RubyLokaliseApi::Resources::QueuedProcess
  klass.new post(path, client, params),
            ->(project_id, id) { klass.endpoint(project_id, id) }
end