Class: RubyLokaliseApi::Resources::Branch

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

Constant Summary collapse

ID_KEY =
'branch_id'

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

Instance 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

.endpoint(project_id, branch_id = nil, action = nil) ⇒ Object



19
20
21
22
23
24
25
26
# File 'lib/ruby_lokalise_api/resources/branch.rb', line 19

def endpoint(project_id, branch_id = nil, action = nil)
  params = {projects: project_id,
            branches: branch_id}

  params[:merge] = '' if action == :merge

  path_from params
end

.merge(client, path, params, *_args) ⇒ Object



15
16
17
# File 'lib/ruby_lokalise_api/resources/branch.rb', line 15

def merge(client, path, params, *_args)
  post(path, client, params)['content']
end

Instance Method Details

#merge(params = {}) ⇒ Object



9
10
11
12
# File 'lib/ruby_lokalise_api/resources/branch.rb', line 9

def merge(params = {})
  klass = self.class
  klass.merge @client, klass.endpoint(project_id, branch_id, :merge), params
end